Example #1
0
        public void GetClipping_ShouldThrowExceptionOnNegativeResult()
        {
            var marshallerMock = new Mock<ILibsndfileMarshaller>();

            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Command(It.IsAny<IntPtr>(), It.IsAny<LibsndfileCommand>(), It.IsAny<IntPtr>(), It.IsAny<int>())).Returns(-1);

            var api = new LibsndfileCommandApiNativeWrapper(mock.Object, marshallerMock.Object);
            api.GetClipping(new IntPtr(1));
        }
Example #2
0
        public void GetClipping_ShouldThrowExceptionOnGreaterThanOneResult()
        {
            var marshallerMock = new Mock <ILibsndfileMarshaller>();

            var mock = new Mock <ILibsndfileApi>();

            mock.Setup(x => x.Command(It.IsAny <IntPtr>(), It.IsAny <LibsndfileCommand>(), It.IsAny <IntPtr>(), It.IsAny <int>())).Returns(2);

            var api = new LibsndfileCommandApiNativeWrapper(mock.Object, marshallerMock.Object);

            api.GetClipping(new IntPtr(1));
        }
Example #3
0
        public void GetClipping_ShouldPassOnZeroClipping()
        {
            const int Clipping = 0;

            var marshallerMock = new Mock<ILibsndfileMarshaller>();

            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Command(It.IsAny<IntPtr>(), It.IsAny<LibsndfileCommand>(), It.IsAny<IntPtr>(), It.IsAny<int>())).Returns(Clipping);

            var api = new LibsndfileCommandApiNativeWrapper(mock.Object, marshallerMock.Object);
            var retval = api.GetClipping(new IntPtr(1));

            Assert.AreEqual(Convert.ToBoolean(Clipping), retval);
        }
Example #4
0
        public void GetClipping_ShouldPassOnOneClipping()
        {
            const int Clipping = 1;

            var marshallerMock = new Mock <ILibsndfileMarshaller>();

            var mock = new Mock <ILibsndfileApi>();

            mock.Setup(x => x.Command(It.IsAny <IntPtr>(), It.IsAny <LibsndfileCommand>(), It.IsAny <IntPtr>(), It.IsAny <int>())).Returns(Clipping);

            var api    = new LibsndfileCommandApiNativeWrapper(mock.Object, marshallerMock.Object);
            var retval = api.GetClipping(new IntPtr(1));

            Assert.AreEqual(Convert.ToBoolean(Clipping), retval);
        }