本文整理汇总了C#中LibsndfileApi类的典型用法代码示例。如果您正苦于以下问题:C# LibsndfileApi类的具体用法?C# LibsndfileApi怎么用?C# LibsndfileApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LibsndfileApi类属于命名空间,在下文中一共展示了LibsndfileApi类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: OpenFileDescriptor_ShouldThrowExceptionOnZeroFileHandle
public void OpenFileDescriptor_ShouldThrowExceptionOnZeroFileHandle()
{
var info = new LibsndfileInfo();
var mock = new Mock<ILibsndfileApi>();
mock.Setup(x => x.OpenFileDescriptor(It.IsAny<int>(), It.IsAny<LibsndfileMode>(), ref info, It.IsAny<int>())).Returns(IntPtr.Zero);
var api = new LibsndfileApi(mock.Object);
var retval = api.OpenFileDescriptor(20, LibsndfileMode.Read, ref info, 0);
Assert.AreEqual(IntPtr.Zero, retval);
}
开发者ID:xVir,项目名称:NLibsndfile,代码行数:12,代码来源:OpenTests.cs
示例17: Open_ShouldReturnZeroHandleOnEmptyFileHandle
public void Open_ShouldReturnZeroHandleOnEmptyFileHandle()
{
var info = new LibsndfileInfo();
var mock = new Mock<ILibsndfileApi>();
mock.Setup(x => x.Open(It.IsAny<string>(), It.IsAny<LibsndfileMode>(), ref info)).Returns(IntPtr.Zero);
var api = new LibsndfileApi(mock.Object);
var retval = api.Open("junk.txt", LibsndfileMode.Read, ref info);
Assert.AreEqual(IntPtr.Zero, retval);
}
开发者ID:xVir,项目名称:NLibsndfile,代码行数:12,代码来源:OpenTests.cs
示例18: GetString_ShouldReturnValidString
public void GetString_ShouldReturnValidString()
{
const string Tag = "AlbumTag";
var mock = new Mock<ILibsndfileApi>();
mock.Setup(x => x.GetString(It.IsAny<IntPtr>(), It.IsAny<LibsndfileStringType>())).Returns(Tag);
var api = new LibsndfileApi(mock.Object);
var retval = api.GetString(new IntPtr(1), It.IsAny<LibsndfileStringType>());
Assert.AreEqual(Tag, retval);
}
开发者ID:xVir,项目名称:NLibsndfile,代码行数:12,代码来源:StringTests.cs
示例19: OpenWav_ReadWriteModeReturnsValidHandle
public void OpenWav_ReadWriteModeReturnsValidHandle()
{
var api = new LibsndfileApi();
var info = TestConfiguration.GetValidWavFileInfo();
Assert.That(File.Exists(TestConfiguration.ValidWavFile));
var open = api.Open(TestConfiguration.ValidWavFile, LibsndfileMode.Rdwr, ref info);
Assert.That(open != IntPtr.Zero);
var close = api.Close(open);
Assert.That(close == LibsndfileError.NoError);
}
开发者ID:xVir,项目名称:NLibsndfile,代码行数:13,代码来源:OpenTests.cs
示例20: WriteFloatFrames_ShouldReturnSameAsItemsRequested
public void WriteFloatFrames_ShouldReturnSameAsItemsRequested()
{
const long Frames = 10;
var mock = new Mock<ILibsndfileApi>();
mock.Setup(x => x.WriteFrames(It.IsAny<IntPtr>(), It.IsAny<float[]>(), It.IsAny<long>())).Returns(Frames);
var api = new LibsndfileApi(mock.Object);
var buffer = new float[1];
var retval = api.WriteFrames(new IntPtr(1), buffer, Frames);
Assert.AreEqual(Frames, retval);
}
开发者ID:xVir,项目名称:NLibsndfile,代码行数:13,代码来源:WriteFramesTests.cs
注:本文中的LibsndfileApi类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论