public void CanMakePendingBookingWithBookingNumber()
        {
            var booking = Booking.AdminMakeWithBookingNumber(_parameterSet);

            Assert.That(booking.BookingNumber, Is.EqualTo("201310010001_Blue"));
            Assert.That(booking.PickUp, Is.EqualTo(_parameterSet.PickUp));
            Assert.That(booking.DropOff, Is.EqualTo(_parameterSet.DropOff));
            Assert.That(booking.NumberOfAdults, Is.EqualTo(_parameterSet.NumberOfAdults));
            Assert.That(booking.NumberOfChildren, Is.EqualTo(_parameterSet.NumberOfChildren));
            Assert.That(booking.Bus, Is.EqualTo(_parameterSet.Bus));
            Assert.That(booking.CreatedOn, Is.EqualTo(_parameterSet.CreatedOn));
            Assert.That(booking.CreatedBy, Is.EqualTo(_parameterSet.CurrentUser));
            Assert.That(booking.CreatedBy.Username, Is.EqualTo("Application"));
            Assert.That(booking.Customer.Forename, Is.EqualTo(_parameterSet.Forename));
            Assert.That(booking.Customer.Surname, Is.EqualTo(_parameterSet.Surname));
            Assert.That(booking.Customer.AddressLine1, Is.EqualTo(_parameterSet.AddressLine1));
            Assert.That(booking.Customer.AddressLine2, Is.EqualTo(_parameterSet.AddressLine2));
            Assert.That(booking.Customer.AddressLine3, Is.EqualTo(_parameterSet.AddressLine3));
            Assert.That(booking.Customer.Town, Is.EqualTo(_parameterSet.Town));
            Assert.That(booking.Customer.County, Is.EqualTo(_parameterSet.County));
            Assert.That(booking.Customer.PostCode, Is.EqualTo(_parameterSet.PostCode));
            Assert.That(booking.Customer.Email, Is.EqualTo(_parameterSet.Email));
            Assert.That(booking.Customer.TelephoneNumber, Is.EqualTo(_parameterSet.TelephoneNumber));
            Assert.That(booking.Status, Is.EqualTo(_parameterSet.Status));
            Assert.That(booking.TotalCost, Is.EqualTo(_parameterSet.TotalCost));
        }
Esempio n. 2
0
        public string AdminMake(AdminMakeBookingRequest request)
        {
            _log.Add(request);
            var parameterSet = _adminMakeParameterSetMapper.MapWithOtherBookingsToday(request);
            var booking      = Booking.AdminMakeWithBookingNumber(parameterSet);

            _bookingRepository.Save(booking);
            return(booking.BookingNumber);
        }
        public void GetsNextBookingNumberIfBookingsExistThatDay()
        {
            _parameterSet.OtherBookingsToday.Add(new Booking {
                BookingNumber = "201310010001_Purple"
            });
            _parameterSet.OtherBookingsToday.Add(new Booking {
                BookingNumber = "201310010002_Black"
            });
            _parameterSet.OtherBookingsToday.Add(new Booking {
                BookingNumber = "201310010003_Mauve"
            });
            _parameterSet.OtherBookingsToday.Add(new Booking {
                BookingNumber = "201310010004_Red"
            });
            var booking = Booking.AdminMakeWithBookingNumber(_parameterSet);

            Assert.That(booking.BookingNumber, Is.EqualTo("201310010005_Blue"));
        }
 public void InvalidBookingThrowsException()
 {
     _parameterSet.Forename = null;
     Booking.AdminMakeWithBookingNumber(_parameterSet);
 }