Exemple #1
0
        public async Task WhenCreated_ShouldSetBookingStatusToNew()
        {
            await _bookingManger.Create();

            var status = _bookingManger.Booking.Status;

            status.Should().Be(BookingStatus.New);
        }
Exemple #2
0
        public void WhenCreateBookingMethodIsCalledBookingCountIncreasesByOne()
        {
            using (var db = new AcademyContext())
            {
                var bookingTotalBeforeAdding = db.Bookings.Count();
                _bookingManager.Create(2, 5, "01/05/2021");
                var bookingTotalAfterAdd = db.Bookings.Count();

                Assert.AreEqual(bookingTotalBeforeAdding + 1, bookingTotalAfterAdd);
            }
        }
Exemple #3
0
        private void ButtonBook_Click(object sender, RoutedEventArgs e)
        {
            if (CourseID.SelectedItem != null && StudentID.SelectedItem != null && lblSelectedDate.Content != null)
            {
                int    studentID             = int.Parse(StudentID.Text);
                int    courseID              = int.Parse(CourseID.Text);
                string selectedDate          = lblSelectedDate.Content.ToString();
                bool   checkDuplicateBooking = _bookingManager.DuplicateBookingRecord(studentID, selectedDate);

                if (checkDuplicateBooking)
                {
                    MessageBox.Show("Student already have a class booked for this date", "Duplicate booking", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    _bookingManager.Create(studentID, courseID, selectedDate);
                    MessageBox.Show($"Congratulations, You have enrolled successfully\n\n" +
                                    $"Your Booking ID is: {_bookingManager.SelectedBooking.BookingID}");

                    PopulateBookingListBox();
                }
            }
            else
            {
                MessageBox.Show("Please select all the fields to make a booking");
            }
        }