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


C# LibsndfileApi类代码示例

本文整理汇总了C#中LibsndfileApi的典型用法代码示例。如果您正苦于以下问题:C# LibsndfileApi类的具体用法?C# LibsndfileApi怎么用?C# LibsndfileApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LibsndfileApi类属于命名空间,在下文中一共展示了LibsndfileApi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpenFileDescriptor_ShouldThrowExceptionOnZeroHandle

        public void OpenFileDescriptor_ShouldThrowExceptionOnZeroHandle()
        {
            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            api.OpenFileDescriptor(0, LibsndfileMode.Read, ref info, 0);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:7,代码来源:OpenTests.cs

示例2: GetLibVersion_ReturnsCorrectVersion

        public void GetLibVersion_ReturnsCorrectVersion()
        {
            var api = new LibsndfileApi();

            var version = api.Commands.GetLibVersion();
            Assert.That(!string.IsNullOrEmpty(version));
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:7,代码来源:GetLibVersionTests.cs

示例3: FormatCheck_ShouldThrowExceptionOnDefaultInfoStruct

        public void FormatCheck_ShouldThrowExceptionOnDefaultInfoStruct()
        {
            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            api.FormatCheck(ref info);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:7,代码来源:FormatCheckTests.cs

示例4: Open_ShouldThrowExceptionOnEmptyPath

        public void Open_ShouldThrowExceptionOnEmptyPath()
        {
            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            api.Open(string.Empty, LibsndfileMode.Read, ref info);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:7,代码来源:OpenTests.cs

示例5: Open_ShouldThrowExceptionOnNullPath

        public void Open_ShouldThrowExceptionOnNullPath()
        {
            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            api.Open(null, LibsndfileMode.Read, ref info);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:7,代码来源:OpenTests.cs

示例6: Seek_ShouldThrowExceptionOnNegativeOffset

        public void Seek_ShouldThrowExceptionOnNegativeOffset()
        {
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Seek(It.IsAny<IntPtr>(), It.IsAny<long>(), It.IsAny<int>())).Returns(-1);

            var api = new LibsndfileApi(mock.Object);
            api.Seek(new IntPtr(1), 1, 1);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:8,代码来源:SeekTests.cs

示例7: ErrorString_ShouldThrowExceptionOnEmptyStringReturned

        public void ErrorString_ShouldThrowExceptionOnEmptyStringReturned()
        {
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.ErrorString(It.IsAny<IntPtr>())).Returns(string.Empty);

            var api = new LibsndfileApi(mock.Object);
            api.ErrorString(new IntPtr(1));
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:8,代码来源:ErrorTests.cs

示例8: ErrorNumber_ShouldThrowExceptionOnNullStringReturned

        public void ErrorNumber_ShouldThrowExceptionOnNullStringReturned()
        {
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.ErrorNumber(It.IsAny<int>())).Returns((string)null);

            var api = new LibsndfileApi(mock.Object);
            api.ErrorNumber(1);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:8,代码来源:ErrorTests.cs

示例9: Close_ShouldThrowExceptionOnErrorResult

        public void Close_ShouldThrowExceptionOnErrorResult()
        {
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Close(It.IsAny<IntPtr>())).Returns(LibsndfileError.MalformedFile);

            var api = new LibsndfileApi(mock.Object);
            api.Close(new IntPtr(1));
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:8,代码来源:CloseTests.cs

示例10: CommandDoubleArray_ShouldThrowExceptionOnInvalidResult

        public void CommandDoubleArray_ShouldThrowExceptionOnInvalidResult()
        {
            var data = new double[1];
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Command(It.IsAny<IntPtr>(), It.IsAny<LibsndfileCommand>(), data, It.IsAny<int>())).Returns(-1);

            var api = new LibsndfileApi(mock.Object);
            api.Command(new IntPtr(1), It.IsAny<LibsndfileCommand>(), data, It.IsAny<int>());
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:9,代码来源:CommandTests.cs

示例11: Close_ShouldPassOnNoErrorResult

        public void Close_ShouldPassOnNoErrorResult()
        {
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Close(It.IsAny<IntPtr>())).Returns(LibsndfileError.NoError);

            var api = new LibsndfileApi(mock.Object);
            var retval = api.Close(new IntPtr(1));

            Assert.AreEqual(LibsndfileError.NoError, retval);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:10,代码来源:CloseTests.cs

示例12: SetString_ShouldPassOnNoErrorResult

        public void SetString_ShouldPassOnNoErrorResult()
        {
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.SetString(It.IsAny<IntPtr>(), It.IsAny<LibsndfileStringType>(), It.IsAny<string>())).Returns(LibsndfileError.NoError);

            var api = new LibsndfileApi(mock.Object);
            var retval = api.SetString(new IntPtr(1), LibsndfileStringType.Album, "album");

            Assert.AreEqual(LibsndfileError.NoError, retval);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:10,代码来源:StringTests.cs

示例13: CommandDoubleArray_ShouldPassOnZeroHandleWithStaticCommand

        public void CommandDoubleArray_ShouldPassOnZeroHandleWithStaticCommand()
        {
            var data = new double[1];
            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Command(It.IsAny<IntPtr>(), It.IsAny<LibsndfileCommand>(), It.IsAny<double[]>(), It.IsAny<int>())).Returns(1);

            var api = new LibsndfileApi(mock.Object);
            var retval = api.Command(IntPtr.Zero, LibsndfileCommand.GetLibVersion, data, It.IsAny<int>());

            Assert.Greater(retval, 0);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:11,代码来源:CommandTests.cs

示例14: ErrorString_ShouldReturnValidErrorString

        public void ErrorString_ShouldReturnValidErrorString()
        {
            const string ErrorString = "Libsndfile encountered no errors.";

            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.ErrorString(It.IsAny<IntPtr>())).Returns(ErrorString);

            var api = new LibsndfileApi(mock.Object);
            var retval = api.ErrorString(new IntPtr(1));

            Assert.AreEqual(ErrorString, retval);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:12,代码来源:ErrorTests.cs

示例15: Seek_ShouldPassOnCorrectOffsetFromBeginning

        public void Seek_ShouldPassOnCorrectOffsetFromBeginning()
        {
            const int Result = 42;

            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Seek(It.IsAny<IntPtr>(), It.IsAny<long>(), It.IsAny<int>())).Returns(Result);

            var api = new LibsndfileApi(mock.Object);
            var retval = api.Seek(new IntPtr(1), 42, 1);

            Assert.AreEqual(Result, retval);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:12,代码来源:SeekTests.cs


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