Ejemplo n.º 1
0
        public void Verify_VerifiableSetupsButNoInvocations_ThrowsVerificationException()
        {
            var setup = new Setup(TestDataFactory.CreateMethodCallInfo());

            setup.Verifiable();
            ConfigureSetups(setup);

            var subject = new InvocationTracker(_setupManagerMock.Object);

            Assert.Throws <VerificationException>(() => subject.Verify());
        }
Ejemplo n.º 2
0
        public void Verify_NoVerifiableSetupsOrInvocations_DoesntThrow()
        {
            // We have a setup, but it's not verifiable
            var setup = new Setup(TestDataFactory.CreateMethodCallInfo());

            ConfigureSetups(setup);

            var subject = new InvocationTracker(_setupManagerMock.Object);

            Assert.DoesNotThrow(() => subject.Verify());
        }
Ejemplo n.º 3
0
        public void Verify_VerifiableSetupsButNoMatchingInvocations_ThrowsVerificationException()
        {
            var setup = new Setup(TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine()));

            setup.Verifiable();
            ConfigureSetups(setup);

            var subject = new InvocationTracker(_setupManagerMock.Object);

            subject.Track(ReflectionUtility.GetMethod(() => Console.ReadKey()), new object[0], null);

            Assert.Throws <VerificationException>(() => subject.Verify());
        }
Ejemplo n.º 4
0
        public void Verify_VerifiableSetupsWithMatchingInvocations_DoesntThrow()
        {
            var setup = new Setup(TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine()));

            setup.Verifiable();
            ConfigureSetups(setup);

            var subject = new InvocationTracker(_setupManagerMock.Object);

            subject.Track(ReflectionUtility.GetMethod(() => Console.WriteLine()), new object[0], setup);

            Assert.DoesNotThrow(() => subject.Verify());
        }
Ejemplo n.º 5
0
        public void Verify_NoSetupsOrInvocations_DoesntThrow()
        {
            var subject = new InvocationTracker(_setupManagerMock.Object);

            Assert.DoesNotThrow(() => subject.Verify());
        }