public void WillMerge_UnorderedRecorder_WhenRecorderHasSingleRecorderInside()
		{
            CustomerMapper mapper = new CustomerMapper();

            ICustomer customer = MockRepository.Mock<ICustomer>();
            customer.Expect(x => x.Id)
                .Return(0);

            customer.Expect(x => x.IsPreferred = true);

            Assert.Throws<ExpectationViolationException>(
                () => mapper.MarkCustomerAsPreferred(customer));
		}
        public void WillMerge_UnorderedRecorder_WhenRecorderHasSingleRecorderInside()
        {
            ICustomer customer = MockRepository.GenerateStrictMock<ICustomer>();

            CustomerMapper mapper = new CustomerMapper();

            customer.Expect(x => x.Id).Return(0);
            customer.Expect(x => x.IsPreferred = true);

            mapper.MarkCustomerAsPreferred(customer);
            var ex = Assert.Throws<ExpectationViolationException>(() =>
                {
                    customer.AssertWasCalled(x => x.IsPreferred = true).After(customer.AssertWasCalled(x => x.Id));
                });
            Assert.Equal("Expected that call Int32 get_Id() occurs before call Void set_IsPreferred(Boolean), but the expectation is not satisfied.", ex.Message);
        }
        public void WillMerge_UnorderedRecorder_WhenRecorderHasSingleRecorderInside()
        {
            MockRepository mocks = new MockRepository();
            ICustomer customer = mocks.StrictMock<ICustomer>();

            CustomerMapper mapper = new CustomerMapper();

            using (mocks.Record())
            using (mocks.Ordered())
            {
                Expect.Call(customer.Id).Return(0);

                customer.IsPreferred = true;
            }

            using (mocks.Playback())
            {
                mapper.MarkCustomerAsPreferred(customer);
            }
        }
        public void WillMerge_UnorderedRecorder_WhenRecorderHasSingleRecorderInside()
        {
            MockRepository mocks = new MockRepository();
            ICustomer customer = mocks.StrictMock<ICustomer>();

            CustomerMapper mapper = new CustomerMapper();

            using (mocks.Record())
            using (mocks.Ordered())
            {
                Expect.Call(customer.Id).Return(0);

                customer.IsPreferred = true;
            }

            Assert.Throws<ExpectationViolationException>("Unordered method call! The expected call is: 'Ordered: { ICustomer.get_Id(); }' but was: 'ICustomer.set_IsPreferred(True);'", () =>
            {
                using (mocks.Playback())
                {
                    mapper.MarkCustomerAsPreferred(customer);
                }
            });
        }