public void Should_Set_SequenceInvocationIndices()
        {
            var sequenceInvocationIndices = new SequenceInvocationIndices {
                1, 2, 3
            };
            var dummyInvocable = new DummyInvocable(null, null, null, sequenceInvocationIndices, null);

            Assert.That(((IInvocable)dummyInvocable).SequenceInvocationIndices, Is.EqualTo(sequenceInvocationIndices));
        }
        public void Verifiable_Should_Call_The_VerifiableWrapper()
        {
            var mockSetUp             = new Mock <ISetup <IToMock> >();
            var mockVerifiableWrapper = new Mock <IVerifiableWrapper>();
            var dummyInvocable        = new DummyInvocable(mockSetUp.Object, null, null, 0, mockVerifiableWrapper.Object);

            dummyInvocable.Verifiable();
            mockVerifiableWrapper.Verify(m => m.Verifiable());
        }
        public void Should_Invoke_Sequence_When_Invoked_After_Registration()
        {
            var mockSequence = new Mock <ISequence>();

            var dummyInvocable = new DummyInvocable(null, null, mockSequence.Object, 0, null);

            dummyInvocable.InvokeBase();

            mockSequence.Verify(s => s.Invoked(dummyInvocable));
        }
        public void Verifiable_Msg_Should_Call_Wrapped_And_Be_Verified()
        {
            var mockSetUp             = new Mock <ISetup <IToMock> >();
            var mockVerifiableWrapper = new Mock <IVerifiableWrapper>();
            var dummyInvocable        = new DummyInvocable(mockSetUp.Object, null, null, 0, mockVerifiableWrapper.Object);
            var msg = "msg";

            dummyInvocable.Verifiable(msg);

            mockVerifiableWrapper.Verify(m => m.Verifiable(msg));
        }
        public void Verified_Should_Get_From_VerifiableWrapper(bool wrapperVerified)
        {
            var mockSetUp             = new Mock <ISetup <IToMock> >();
            var mockVerifiableWrapper = new Mock <IVerifiableWrapper>();

            mockVerifiableWrapper.SetupGet(m => m.Verified).Returns(wrapperVerified);
            var dummyInvocable = new DummyInvocable(mockSetUp.Object, null, null, 0, mockVerifiableWrapper.Object);

            var verified = dummyInvocable.Verified;

            Assert.That(verified, Is.EqualTo(wrapperVerified));
        }
        public void Should_Invoke_Sequence_When_Invoked_Through_Callback()
        {
            var mockCallbackWrapper   = new Mock <ICallbackWrapper>();
            var mockedCallbackWrapper = mockCallbackWrapper.Object;

            mockCallbackWrapper.SetupAllProperties();
            var mockSequence = new Mock <ISequence>();

            var dummyInvocable = new DummyInvocable(null, null, mockSequence.Object, 0, null, mockedCallbackWrapper);

            ((ICallbackInvokedHandler)dummyInvocable).Invoked();

            mockSequence.Verify(s => s.Invoked(dummyInvocable));
        }
        public void Throws_Should_Call_Wrapped_And_Wrap_For_Verification()
        {
            var mockRepository     = new MockRepository(MockBehavior.Loose);
            var mockSetUp          = mockRepository.Create <ISetup <IToMock> >();
            var mockedThrowsResult = new Mock <IThrowsResult>().Object;

            mockSetUp.Setup(m => m.Throws <ArgumentException>()).Returns(mockedThrowsResult);

            var mockVerifiableWrapper     = mockRepository.Create <IVerifiableWrapper>();
            var mockedWrappedThrowsResult = new Mock <IThrowsResult>().Object;

            mockVerifiableWrapper.Setup(m => m.WrapThrowsForVerification(mockedThrowsResult)).Returns(mockedWrappedThrowsResult);

            var dummyInvocable = new DummyInvocable(mockSetUp.Object, null, null, 0, mockVerifiableWrapper.Object);
            var throwsResult   = dummyInvocable.Throws <ArgumentException>();

            mockRepository.VerifyAll();
            Assert.That(throwsResult, Is.EqualTo(mockedWrappedThrowsResult));
        }
        public void Should_Set_ConsecutiveInvocations()
        {
            var dummyInvocable = new DummyInvocable(null, null, null, 10, null);

            Assert.That(((IInvocable)dummyInvocable).ConsecutiveInvocations, Is.EqualTo(10));
        }