public async void ConfirmSpotBooked_ExpectedTrue_Success() { using (var context = Fixture.CreateContext()) { // arrange bool spotsCreated = await GenerateBookingData.CreateBookingWithOneSpot() != null; bool expected = true; ILocationService locationService = new LocationService(context); IMarinaService marinaService = new MarinaService(context, locationService); IBookingFormService bookingFormService = new BookingFormService(context, marinaService); IBookingLineService service = new BookingLineService(context, bookingFormService); IPDFService <Booking> pDFService = new BookingPDFService(); IBookingService bookingService = new BookingService(context, service, null, pDFService, null); IMarinaOwnerService marinaOwnerService = new MarinaOwnerService(context, service); // act var unconfirmedBookingLines = (List <BookingLine>) await marinaOwnerService.GetUnconfirmedBookingLines(1); bool actual = await bookingService.ConfirmSpotBooked(unconfirmedBookingLines.First().BookingLineId); // assert Assert.True(spotsCreated); Assert.Equal(expected, actual); } }
public async void GetUnconfirmedBookingLines_Pass() { using (var context = Fixture.CreateContext()) { bool expected = true; ILocationService locationService = new LocationService(context); IMarinaService marinaService = new MarinaService(context, locationService); IBookingFormService bookingFormService = new BookingFormService(context, marinaService); IBookingLineService service = new BookingLineService(context, bookingFormService); IMarinaOwnerService marinaOwnerService = new MarinaOwnerService(context, service); Marina marina = context.Marinas.Find(1); MarinaOwner marinaOwner = context.MarinaOwners.Where(mo => mo.MarinaOwnerId == marina.MarinaOwnerId).FirstOrDefault(); bool spotsCreated = await GenerateBookingData.CreateBookingWithTwoSpotsInSameMarina() != null; var spotsToConfirm = (List <BookingLine>) await marinaOwnerService.GetUnconfirmedBookingLines(marinaOwner.MarinaOwnerId); bool actual = spotsToConfirm == null ? false : spotsToConfirm.Count > 0 ? true : false; Assert.True(spotsCreated); Assert.Equal(expected, actual); } }