public void ReadIntItems_ShouldThrowExceptionOnNullBuffer() { var api = new LibsndfileApi(); int[] buffer = null; api.ReadItems(new IntPtr(1), buffer, It.IsAny <long>()); }
public void ReadShortItems_ShouldThrowExceptionOnLessThanZeroItems() { var api = new LibsndfileApi(); var buffer = new short[1]; api.ReadItems(new IntPtr(1), buffer, -1); }
public void ReadShortItems_ShouldThrowExceptionOnEmptyBuffer() { var api = new LibsndfileApi(); var buffer = new short[] { }; api.ReadItems(new IntPtr(1), buffer, It.IsAny <long>()); }
public void ReadDoubleItems_ShouldReturnLessThanItemsRequestedThenZeroOnNextRead() { const long Items = 10; const long PartialItems = 10 - 5; var mock = new Mock<ILibsndfileApi>(); mock.Setup(x => x.ReadItems(It.IsAny<IntPtr>(), It.IsAny<double[]>(), It.IsAny<long>())).Returns(PartialItems); var api = new LibsndfileApi(mock.Object); var buffer = new double[1]; var retval = api.ReadItems(new IntPtr(1), buffer, Items); Assert.AreEqual(PartialItems, retval); mock.Setup(x => x.ReadItems(It.IsAny<IntPtr>(), It.IsAny<double[]>(), It.IsAny<long>())).Returns(0); retval = api.ReadItems(new IntPtr(1), buffer, Items); Assert.AreEqual(0, retval); }
public void ReadShortItems_ShouldReturnLessThanItemsRequestedThenZeroOnNextRead() { const long Items = 10; const long PartialItems = 10 - 5; var mock = new Mock <ILibsndfileApi>(); mock.Setup(x => x.ReadItems(It.IsAny <IntPtr>(), It.IsAny <short[]>(), It.IsAny <long>())).Returns(PartialItems); var api = new LibsndfileApi(mock.Object); var buffer = new short[1]; var retval = api.ReadItems(new IntPtr(1), buffer, Items); Assert.AreEqual(PartialItems, retval); mock.Setup(x => x.ReadItems(It.IsAny <IntPtr>(), It.IsAny <short[]>(), It.IsAny <long>())).Returns(0); retval = api.ReadItems(new IntPtr(1), buffer, Items); Assert.AreEqual(0, retval); }
public void ReadDoubleItems_ShouldReturnSameAsItemsRequested() { const long Items = 10; var mock = new Mock<ILibsndfileApi>(); mock.Setup(x => x.ReadItems(It.IsAny<IntPtr>(), It.IsAny<double[]>(), It.IsAny<long>())).Returns(Items); var api = new LibsndfileApi(mock.Object); var buffer = new double[1]; var retval = api.ReadItems(new IntPtr(1), buffer, Items); Assert.AreEqual(Items, retval); }
public void ReadShortItems_ShouldReturnSameAsItemsRequested() { const long Items = 10; var mock = new Mock <ILibsndfileApi>(); mock.Setup(x => x.ReadItems(It.IsAny <IntPtr>(), It.IsAny <short[]>(), It.IsAny <long>())).Returns(Items); var api = new LibsndfileApi(mock.Object); var buffer = new short[1]; var retval = api.ReadItems(new IntPtr(1), buffer, Items); Assert.AreEqual(Items, retval); }
public void ReadItemsInt_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.ReadItems(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); }
public void ReadItemsDouble_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 double[Items]; var read = api.ReadItems(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); }
public void ReadIntItems_ShouldThrowExceptionOnZeroHandle() { var api = new LibsndfileApi(); api.ReadItems(IntPtr.Zero, It.IsAny <int[]>(), It.IsAny <long>()); }
public void ReadDoubleItems_ShouldThrowExceptionOnZeroHandle() { var api = new LibsndfileApi(); api.ReadItems(IntPtr.Zero, It.IsAny<double[]>(), It.IsAny<long>()); }
public void ReadDoubleItems_ShouldThrowExceptionOnNullBuffer() { var api = new LibsndfileApi(); double[] buffer = null; api.ReadItems(new IntPtr(1), buffer, It.IsAny<long>()); }
public void ReadDoubleItems_ShouldThrowExceptionOnLessThanZeroItems() { var api = new LibsndfileApi(); var buffer = new double[1]; api.ReadItems(new IntPtr(1), buffer, -1); }
public void ReadShortItems_ShouldThrowExceptionOnEmptyBuffer() { var api = new LibsndfileApi(); var buffer = new short[] { }; api.ReadItems(new IntPtr(1), buffer, It.IsAny<long>()); }