コード例 #1
0
        public void BookingCollectionGetByIDSuccess()
        {
            BookingCollection testCollection = new BookingCollection();

            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();
            Client mockClient = Substitute.For <Client>("123", "CompanyName1", "CompanyAddress1");

            Booking booking1 = new Booking("1", BookingType.FACILITATED,
                                           mockClient, mockDate, mockTime, mockVenue);
            Booking booking2 = new Booking("2", BookingType.FACILITATED,
                                           mockClient, mockDate, mockTime, mockVenue);

            testCollection.Add(booking1);
            testCollection.Add(booking2);

            Assert.AreEqual <Booking>(booking1, testCollection.GetByID("1"));
            Assert.AreEqual <Booking>(booking2, testCollection.GetByID("2"));
        }
コード例 #2
0
        public void SetBooking(string bookingID)
        {
            if (bookingID == null)
            {
                throw new ArgumentNullException("Booking ID reference null");
            }

            bookingID = bookingID.Substring(5, bookingID.IndexOf('\t') - 5).Trim();
            screen.ResetExtrasList();
            activeBooking = bookings.GetByID(bookingID);

            if (activeBooking != null)
            {
                if (activeBooking.GetBookingType() == BookingType.SIMPLE)
                {
                    screen.SetBookingType("Simple");
                }
                else
                {
                    screen.SetBookingType("Facilitated");
                }

                screen.SetClient(activeBooking.GetClient().ToString());
                screen.SetActivity(activeBooking.GetActivity().ToString());
                screen.SetExtras(activeBooking.GetExtras());
                screen.SetVenue(activeBooking.GetVenue().venueName + ", " + activeBooking.GetVenue().venueAddress);
                screen.SetDate(activeBooking.GetDate().GetFormatted());
                screen.SetTime(activeBooking.GetTime().GetFormatted());
                screen.SetCost(FormatPrice(activeBooking.GetCost()));
                screen.SetDefaultDate(activeBooking.GetDate());
                screen.SetDefaultTime(activeBooking.GetTime());
                screen.EnableButtons();
                screen.HideDateSelector();
                screen.HideTimeSelector();
            }
        }