本文整理汇总了C#中LibsndfileApi.ReadRaw方法的典型用法代码示例。如果您正苦于以下问题:C# LibsndfileApi.ReadRaw方法的具体用法?C# LibsndfileApi.ReadRaw怎么用?C# LibsndfileApi.ReadRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibsndfileApi
的用法示例。
在下文中一共展示了LibsndfileApi.ReadRaw方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRaw_ShouldReturnLessThanItemsRequestedThenZeroOnNextRead
public void ReadRaw_ShouldReturnLessThanItemsRequestedThenZeroOnNextRead()
{
const long Bytes = 10;
const long PartialBytes = 10 - 5;
var mock = new Mock<ILibsndfileApi>();
mock.Setup(x => x.ReadRaw(It.IsAny<IntPtr>(), It.IsAny<byte[]>(), It.IsAny<long>())).Returns(PartialBytes);
var api = new LibsndfileApi(mock.Object);
var buffer = new byte[1];
var retval = api.ReadRaw(new IntPtr(1), buffer, Bytes);
Assert.AreEqual(PartialBytes, retval);
mock.Setup(x => x.ReadRaw(It.IsAny<IntPtr>(), It.IsAny<byte[]>(), It.IsAny<long>())).Returns(0);
retval = api.ReadRaw(new IntPtr(1), buffer, Bytes);
Assert.AreEqual(0, retval);
}
示例2: ReadRaw_ShouldReturnSameAsItemsRequested
public void ReadRaw_ShouldReturnSameAsItemsRequested()
{
const long Bytes = 10;
var mock = new Mock<ILibsndfileApi>();
mock.Setup(x => x.ReadRaw(It.IsAny<IntPtr>(), It.IsAny<byte[]>(), It.IsAny<long>())).Returns(Bytes);
var api = new LibsndfileApi(mock.Object);
var buffer = new byte[1];
var retval = api.ReadRaw(new IntPtr(1), buffer, Bytes);
Assert.AreEqual(Bytes, retval);
}
示例3: ReadRaw_ShouldThrowExceptionOnZeroHandle
public void ReadRaw_ShouldThrowExceptionOnZeroHandle()
{
var api = new LibsndfileApi();
api.ReadRaw(IntPtr.Zero, It.IsAny<byte[]>(), It.IsAny<long>());
}
示例4: ReadRaw_ShouldThrowExceptionOnNullBuffer
public void ReadRaw_ShouldThrowExceptionOnNullBuffer()
{
var api = new LibsndfileApi();
byte[] buffer = null;
api.ReadRaw(new IntPtr(1), buffer, It.IsAny<long>());
}
示例5: ReadRaw_ShouldThrowExceptionOnLessThanZeroItems
public void ReadRaw_ShouldThrowExceptionOnLessThanZeroItems()
{
var api = new LibsndfileApi();
var buffer = new byte[1];
api.ReadRaw(new IntPtr(1), buffer, -1);
}
示例6: ReadRaw_ShouldThrowExceptionOnEmptyBuffer
public void ReadRaw_ShouldThrowExceptionOnEmptyBuffer()
{
var api = new LibsndfileApi();
var buffer = new byte[] { };
api.ReadRaw(new IntPtr(1), buffer, It.IsAny<long>());
}