当前位置: 首页>>代码示例>>C#>>正文


C# LibsndfileApi.ReadRaw方法代码示例

本文整理汇总了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);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:19,代码来源:ReadRawTests.cs

示例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);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:13,代码来源:ReadRawTests.cs

示例3: ReadRaw_ShouldThrowExceptionOnZeroHandle

 public void ReadRaw_ShouldThrowExceptionOnZeroHandle()
 {
     var api = new LibsndfileApi();
     api.ReadRaw(IntPtr.Zero, It.IsAny<byte[]>(), It.IsAny<long>());
 }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:5,代码来源:ReadRawTests.cs

示例4: ReadRaw_ShouldThrowExceptionOnNullBuffer

 public void ReadRaw_ShouldThrowExceptionOnNullBuffer()
 {
     var api = new LibsndfileApi();
     byte[] buffer = null;
     api.ReadRaw(new IntPtr(1), buffer, It.IsAny<long>());
 }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:6,代码来源:ReadRawTests.cs

示例5: ReadRaw_ShouldThrowExceptionOnLessThanZeroItems

 public void ReadRaw_ShouldThrowExceptionOnLessThanZeroItems()
 {
     var api = new LibsndfileApi();
     var buffer = new byte[1];
     api.ReadRaw(new IntPtr(1), buffer, -1);
 }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:6,代码来源:ReadRawTests.cs

示例6: ReadRaw_ShouldThrowExceptionOnEmptyBuffer

 public void ReadRaw_ShouldThrowExceptionOnEmptyBuffer()
 {
     var api = new LibsndfileApi();
     var buffer = new byte[] { };
     api.ReadRaw(new IntPtr(1), buffer, It.IsAny<long>());
 }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:6,代码来源:ReadRawTests.cs


注:本文中的LibsndfileApi.ReadRaw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。