示例#1
0
 public void Setup()
 {
     _mockery            = new MockRepository( );
     _mockGateway        = _mockery.DynamicMock <IDatabaseGateway>( );
     _boatMapper         = _mockery.DynamicMock <IBoatDataMapper>( );
     _leaseDataMapper    = _mockery.DynamicMock <ILeaseDataMapper>( );
     _registrationMapper = _mockery.DynamicMock <IRegistrationDataMapper>( );
 }
示例#2
0
 public CustomerDataMapper(IDatabaseGateway gateway, IBoatDataMapper boatMapper, ILeaseDataMapper leaseMapper,
                           IRegistrationDataMapper registrationMapper)
 {
     _gateway            = gateway;
     _boatMapper         = boatMapper;
     _leaseMapper        = leaseMapper;
     _registrationMapper = registrationMapper;
 }
        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);
        }
        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);
        }