public void Index_ContainsCorrectModel() { //implement var expectedResources = BookingGenerator.CreateList(); Assert.Equal(1, 2); }
public void GetBookingsInLocationAtDateTime() { var bookings = BookingGenerator.CreateList(); bookings[1].BookingDateTime = bookings[2].BookingDateTime; bookings[1].Facility = bookings[2].Facility; bookings[1].FacilityId = bookings[2].FacilityId; var booking2Expected = bookings[2]; List <Booking> expected = new List <Booking>(); expected.Add(bookings[1]); expected.Add(bookings[2]); using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Booking.AddRange(bookings); context.SaveChanges(); var repository = new BookingRepository(context); var call = repository.GetBookingsInLocationAtDateTime(booking2Expected.BookingDateTime, booking2Expected.Facility.VenueId, booking2Expected.Facility.SportId).ToList(); Assert.Equal(expected, call); } }
public void GetBooking_ReturnsAllBookings() { var bookings = BookingGenerator.CreateList(5); bookingRepository.Setup(r => r.GetAllAsync()); var result = controller.GetBooking(); //implement Assert.Equal(1, 2); }
public async void GetAllAsync_ReturnsAllFromContext() { var expectedBookings = BookingGenerator.CreateList(); using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Booking.AddRange(expectedBookings); context.SaveChanges(); Assert.Equal(expectedBookings.Count, await context.Booking.CountAsync()); var repository = new BookingRepository(context); var resources = repository.GetAllAsync(); Assert.IsAssignableFrom <IQueryable <Booking> >(resources); Assert.Equal(expectedBookings, resources); } }
public async void GetByIdAsync_ReturnsCorrectItems() { var bookings = BookingGenerator.CreateList(5); var expected = bookings[2]; using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Booking.AddRange(bookings); await context.SaveChangesAsync(); Assert.True(true); Assert.Equal(bookings.Count, await context.Booking.CountAsync()); var repository = new BookingRepository(context); var booking = await repository.GetByIdAsync(expected.BookingId); Assert.IsType <Booking>(booking); Assert.Equal(expected, booking); } }