Exemple #1
0
                public async void TableFull_TableOverlap1Hour_returnsTrue()
                {
                    var tablesGetAll      = FakeTables.GetAll3x2Tables();
                    var bookingsGetByDate = FakeBookings.Get3Bookings1Overlap();

                    _bookingRepository.GetByDate(Arg.Any <DateTime>()).Returns(bookingsGetByDate);
                    _tableRepository.GetAll().Returns(tablesGetAll);

                    var bookingService = new BookingService(_bookingRepository, _tableRepository);

                    var bookingRequest = ValidBooking(0);

                    var actual = await bookingService.AdminBookTable(bookingRequest);

                    actual.Success.Should().BeFalse();
                }
Exemple #2
0
                public async void TableAvailable_TableBookedBefore_returnsTrue()
                {
                    var tablesGetAll      = FakeTables.GetAll3x2Tables();
                    var bookingsGetByDate = FakeBookings.Get3Bookings1Early();

                    _bookingRepository.GetByDate(Arg.Any <DateTime>()).Returns(bookingsGetByDate);
                    _tableRepository.GetAll().Returns(tablesGetAll);

                    var bookingService = new BookingService(_bookingRepository, _tableRepository);

                    var bookingRequest = ValidBooking(0);

                    var actual = await bookingService.AdminBookTable(bookingRequest);

                    actual.Success.Should().BeTrue();
                }
Exemple #3
0
                public async void TableAvailable_2TablesAvailable_1TooSmall_ReturnsTrue()
                {
                    var tablesGetAll      = FakeTables.GetAll4x2And1x4Tables();
                    var bookingsGetByDate = FakeBookings.Get3Bookings();

                    _bookingRepository.GetByDate(Arg.Any <DateTime>()).Returns(bookingsGetByDate);
                    _tableRepository.GetAll().Returns(tablesGetAll);

                    var bookingService = new BookingService(_bookingRepository, _tableRepository);

                    var bookingRequest = new BookingRequestModel()
                    {
                        Seats        = 4,
                        Email        = "*****@*****.**",
                        CustomerName = "notCoolguy",
                        Time         = DateTime.Now,
                        PhoneNumber  = "3758374"
                    };

                    var actual = await bookingService.AdminBookTable(bookingRequest);

                    actual.Success.Should().BeTrue();
                }