Пример #1
0
            public void Test()
            {
                var mock = new Mock <ITest>();

                ITest instance;

                Assert.DoesNotThrow(() => instance = mock.Object);
            }
Пример #2
0
            public void ByteArrayCallbackArgumentShouldNotBeNull()
            {
                var data   = new byte[] { 2, 1, 2 };
                var stream = new Mock <Stream>();

                stream.SetupGet(m => m.Length)
                .Returns(data.Length);
                stream.Setup(m => m.Read(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>()))
                .Callback <byte[], int, int>((b, o, c) => data.CopyTo(b, 0))
                .Returns(data.Length);

                var contents = new byte[stream.Object.Length];

                Assert.DoesNotThrow(() => stream.Object.Read(contents, 0, (int)stream.Object.Length));
            }
Пример #3
0
 public void Test()
 {
     Assert.DoesNotThrow(() => new Mock <IFoo>().SetupAllProperties());
 }