Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }