本文整理汇总了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);
}
示例2: GetLibVersion_ReturnsCorrectVersion
public void GetLibVersion_ReturnsCorrectVersion()
{
var api = new LibsndfileApi();
var version = api.Commands.GetLibVersion();
Assert.That(!string.IsNullOrEmpty(version));
}
示例3: FormatCheck_ShouldThrowExceptionOnDefaultInfoStruct
public void FormatCheck_ShouldThrowExceptionOnDefaultInfoStruct()
{
var api = new LibsndfileApi();
var info = new LibsndfileInfo();
api.FormatCheck(ref info);
}
示例4: Open_ShouldThrowExceptionOnEmptyPath
public void Open_ShouldThrowExceptionOnEmptyPath()
{
var api = new LibsndfileApi();
var info = new LibsndfileInfo();
api.Open(string.Empty, LibsndfileMode.Read, ref info);
}
示例5: Open_ShouldThrowExceptionOnNullPath
public void Open_ShouldThrowExceptionOnNullPath()
{
var api = new LibsndfileApi();
var info = new LibsndfileInfo();
api.Open(null, LibsndfileMode.Read, ref info);
}
示例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);
}
示例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));
}
示例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);
}
示例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));
}
示例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>());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}