本文整理汇总了C#中LibsndfileApi.Close方法的典型用法代码示例。如果您正苦于以下问题:C# LibsndfileApi.Close方法的具体用法?C# LibsndfileApi.Close怎么用?C# LibsndfileApi.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibsndfileApi
的用法示例。
在下文中一共展示了LibsndfileApi.Close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
示例2: 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);
}
示例3: 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);
}
示例4: CalcMaxAllChannels_ReturnsValidData
public void CalcMaxAllChannels_ReturnsValidData()
{
var api = new LibsndfileApi();
var info = new LibsndfileInfo();
var sndfile = api.Open(TestConfiguration.ValidWavFile, LibsndfileMode.Read, ref info);
Assert.That(sndfile != IntPtr.Zero);
var max = api.Commands.CalcMaxAllChannels(sndfile, info.Channels);
Assert.That(max != null);
Assert.That(max.Length == info.Channels);
var close = api.Close(sndfile);
Assert.That(close == LibsndfileError.NoError);
}
示例5: OpenWav_WriteModeReturnsValidHandle
public void OpenWav_WriteModeReturnsValidHandle()
{
var api = new LibsndfileApi();
var info = TestConfiguration.GetValidWavFileInfo();
var filename = string.Format("tmp_{0}", TestConfiguration.ValidWavFile);
var open = api.Open(filename, LibsndfileMode.Write, ref info);
Assert.That(open != IntPtr.Zero);
Assert.That(File.Exists(filename));
var close = api.Close(open);
Assert.That(close == LibsndfileError.NoError);
File.Delete(filename);
Assert.That(!File.Exists(filename));
}
示例6: ReadFramesInt_ReturnsValidData
public void ReadFramesInt_ReturnsValidData()
{
const long Items = 50;
var api = new LibsndfileApi();
var info = new LibsndfileInfo();
var open = api.Open(TestConfiguration.ValidWavFile, LibsndfileMode.Read, ref info);
Assert.That(open != IntPtr.Zero);
var buffer = new int[Items];
var read = api.ReadFrames(open, buffer, Items);
Assert.That(Items == read);
Assert.That(buffer != null);
Assert.That(buffer.Length == Items);
var close = api.Close(open);
Assert.That(close == LibsndfileError.NoError);
}
示例7: Close_ShouldThrowExceptionOnZeroHandle
public void Close_ShouldThrowExceptionOnZeroHandle()
{
var api = new LibsndfileApi();
api.Close(IntPtr.Zero);
}