Пример #1
0
        public void Should_be_able_to_insert_new_registration_for_customer()
        {
            IRegistrationDataMapper mapper     = CreateSUT( );
            long          customerId           = CreateCustomerRecord( );
            IRegistration expectedRegistration =
                new CustomerRegistration("mokhan", "password", "mo", "khan", "4036813389", "calgary");

            mapper.Insert(expectedRegistration, customerId);
            IRegistration actualRegistration = mapper.For(customerId);

            Assert.AreEqual(expectedRegistration, actualRegistration);
        }
Пример #2
0
        public void Should_leverage_mapper_to_load_customer_registration()
        {
            long customerId = 59;

            IRegistration registration = _mockery.DynamicMock <IRegistration>( );

            using (_mockery.Record( )) {
                Expect.Call(_registrationMapper.For(customerId)).Return(registration);
            }

            using (_mockery.Playback( )) {
                ICustomer customer = CreateSUT( ).FindBy(customerId);
                Assert.AreEqual(registration, customer.Registration( ));
            }
        }
Пример #3
0
        public void Should_be_able_to_update_record()
        {
            IRegistrationDataMapper mapper  = CreateSUT( );
            long          customerId        = CreateCustomerRecord( );
            IRegistration firstRegistration =
                new CustomerRegistration("mokhan", "password", "mo", "khan", "4036813389", "calgary");
            IRegistration expectedRegistration =
                new CustomerRegistration("khanmo", "wordpass", "om", "ankh", "1338940368", "garycal");

            mapper.Insert(firstRegistration, customerId);
            mapper.Update(expectedRegistration, customerId);

            IRegistration actualRegistration = mapper.For(customerId);

            Assert.AreEqual(expectedRegistration, actualRegistration);
        }