Exemplo n.º 1
0
                public async void EditTable_ChangeBookingFrom2to3_ReturnsFalse()
                {
                    var tablesGetAll      = FakeTables.GetAll3x2Tables();
                    var bookingsGetByDate = FakeBookings.Get3Bookings();

                    _bookingRepository.GetByDate(Arg.Any <DateTime>()).Returns(bookingsGetByDate);
                    _tableRepository.GetAll().Returns(tablesGetAll);
                    var booking1 = bookingsGetByDate.Where(b => b.CustomerName == "Jane").First();

                    _bookingRepository.GetByID(Arg.Any <Guid>()).Returns(booking1);

                    var bookingService = new BookingService(_bookingRepository, _tableRepository);

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

                    Guid guid = new Guid("3BFD706B-869A-40DE-910A-4D0CDB0FA095");

                    var actual = await bookingService.EditBooking(bookingRequest, guid);

                    actual.Success.Should().BeFalse();
                }
Exemplo n.º 2
0
            public async void BookingEndToEndBefore_ReturnsTrue()
            {
                var tablesGetAll      = FakeTables.GetAll3x2Tables();
                var bookingsGetByDate = FakeBookings.Get3Bookings2HoursLater();

                _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.ClientBookTable(bookingRequest);

                actual.Success.Should().BeTrue();
            }
Exemplo n.º 3
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();
                }
Exemplo n.º 4
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();
                }