public void CreateBookingWithNoPopulatedFieldsThrowsNullReferenceException() { // Arrange var booking = new Booking(); var dao = new BookingDao(); // Act dao.Create(booking, new Order()); // Assert Assert.Fail("NullReferenceException was not thrown."); }
public void CreateConfirmedBookingPopulatesBookingId() { // Arrange var booking = new Booking { BusinessId = 1, Guest = new Guest { Id = 1, Surname = "Test Guest", Email = "*****@*****.**" }, StartDate = new DateTime(2012, 2, 1, 0, 0, 0, DateTimeKind.Utc), EndDate = new DateTime(2012, 2, 2, 0, 0, 0, DateTimeKind.Utc), NumberOfAdults = 2, NumberOfChildren = 1, Cost = new decimal(120.5), BookingStatus = new EnumEntity { Code = BookingStatusType.CONFIRMED }, RoomTypeId = 1, RoomId = 1, RatePlanId = 1, Notes = "Testing note", BookingScenarioType = BookingScenarioTypeEnum.OnAccountBooking, RateType = new EnumEntity { Code = RateType.BEST_AVAILABLE_RATE }, CheckinStatus = new EnumEntity { Code = CheckinStatusOptions.NOTCHECKEDIN } }; var dao = new BookingDao(); // Act dao.Create(booking, new Order()); // Assert Assert.IsNotNull(booking.Id, "The booking id was not attributed."); }