Exemplo n.º 1
0
        public void InvoiceAccessorGet()
        {//updated
            List <HotelGuest> guest = HotelGuestAccessor.HotelGuestGet(100);
            int id = (int)guest[guest.Count - 1].HotelGuestID;

            Invoice invoice = InvoiceAccessor.GetInvoiceByGuest(id);

            Assert.AreEqual(id, invoice.HotelGuestID);
        }
Exemplo n.º 2
0
        public void HotelAccessorAdd()
        {
            int changed = HotelGuestAccessor.HotelGuestAdd(new HotelGuest("Fake", "Person", "1111 Fake St.", "", new CityState("52641", "Mt. Pleasant", "IA"), "5556667777", "*****@*****.**", "234234234", "3456", true));

            //This line below must remain here, helps to properly track and delete invoice, which is linked to Guest record
            TestCleanupAccessor.ClearOutInvoice();
            //Asserts that the update has been made
            Assert.AreEqual(2, changed);
        }
Exemplo n.º 3
0
        public void TestVerifyGuestPINBookingAccessor()
        {   //Pulls a guest from the database and collects the guest information
            List <HotelGuest> guest1 = HotelGuestAccessor.HotelGuestGet(100);
            //Checks using a pin in the database, stores guest info from database into a guest object
            //Asserts that a record is found, that guest is not null by passing the guest1 guest pin
            HotelGuest guest = BookingAccessor.VerifyHotelGuestPin(guest1[guest1.Count - 1].GuestPIN);

            Assert.IsNotNull(guest);
        }
Exemplo n.º 4
0
        public void InvoiceManagerGetGuestBookingDetailsList()
        {
            List <BookingDetails> guestBookings = null;
            List <HotelGuest>     guest         = HotelGuestAccessor.HotelGuestGet();
            int id = (int)guest[0].HotelGuestID;

            guestBookings = access.RetrieveGuestBookingDetailsList(id);
            Assert.IsNotNull(guestBookings);
        }
Exemplo n.º 5
0
        public void InvoiceManagerGetByBooking()
        {
            List <BookingDetails> guestBookings = null;
            List <HotelGuest>     guest         = HotelGuestAccessor.HotelGuestGet();
            int id = (int)guest[guest.Count - 1].HotelGuestID;

            guestBookings = access.RetrieveGuestBookingDetailsList(id);
            Assert.AreNotEqual(null, guestBookings);
        }
Exemplo n.º 6
0
        public void InvoiceManagerGetByGuest()
        {   //Updated Test- Grabs hotel guest by id
            List <HotelGuest> guest = HotelGuestAccessor.HotelGuestGet(100);
            int id = (int)guest[guest.Count - 1].HotelGuestID;
            //Grabs invoice by guest id
            Invoice invoice = access.RetrieveInvoiceByGuest(id);

            Assert.AreEqual(id, invoice.HotelGuestID);
        }
Exemplo n.º 7
0
        public void HotelAccessorGet()
        {
            //calls generic Test accessor to grab the guestID
            int guestID = TestCleanupAccessor.GetHotelGuest();
            //Calls to the accessor method
            List <HotelGuest> guest = HotelGuestAccessor.HotelGuestGet(guestID);

            //Asserts that the firstname of the in the list corresponds to the dummy record first name
            Assert.AreEqual("Fake", guest[guest.Count - 1].FirstName);
        }
Exemplo n.º 8
0
        public void InvoiceAccessorGuestBooking()
        {
            List <BookingDetails> guestBookings = null;
            List <HotelGuest>     guest         = HotelGuestAccessor.HotelGuestGet();
            int id = (int)guest[guest.Count - 1].HotelGuestID;

            guestBookings = InvoiceAccessor.GetInvoiceBookingsByGuest(id);

            Assert.AreNotEqual(null, guestBookings);
        }
Exemplo n.º 9
0
        public void InvoiceManagerCheckArchiveInvoiceFail()
        {
            List <HotelGuest> listGuest = HotelGuestAccessor.HotelGuestGet();
            int id = (int)listGuest[1].HotelGuestID;
            List <BookingDetails> guestBookings = access.RetrieveGuestBookingDetailsList(id);
            var invoices = access.RetrieveActiveInvoiceDetails();
            var invoice  = invoices[1];
            var result   = access.CheckToArchiveInvoice(invoice, guestBookings);

            Assert.AreEqual(ResultsArchive.CannotArchive, result);
        }
Exemplo n.º 10
0
        public void HotelAccessorUpdate()
        {
            //gets the guestID from the Test accessor
            int guestID = TestCleanupAccessor.GetHotelGuest();
            //passes guestID to the HotelGuestAccessor method to grab the guest.
            List <HotelGuest> guest = HotelGuestAccessor.HotelGuestGet(guestID);
            int hotelGuest          = guest.Count - 1;

            guest.Add(new HotelGuest((int)guest[hotelGuest].HotelGuestID, guest[hotelGuest].FirstName, guest[hotelGuest].LastName, guest[hotelGuest].Address1, guest[hotelGuest].Address2, guest[hotelGuest].CityState, guest[hotelGuest].PhoneNumber, guest[hotelGuest].EmailAddress, guest[hotelGuest].Room, guest[hotelGuest].GuestPIN, false));
            int changed = HotelGuestAccessor.HotelGuestUpdate(guest[guest.Count - 2], guest[hotelGuest]);

            Assert.AreEqual(1, changed);
        }
Exemplo n.º 11
0
 /// <summary>
 /// Miguel Santana
 /// Created: 2015/02/12
 ///
 /// Gets a hotel guest by id
 /// </summary>
 /// <remarks>
 /// Rose Steffensmeier
 /// Updated: 2015/03/12
 /// Updated try/catch blocks
 /// </remarks>
 /// <param name="hotelGuestId">the id of a hotel guest to retrieve</param>
 /// <returns>HotelGuest object retrieved from database</returns>
 public HotelGuest GetHotelGuest(int hotelGuestId)
 {
     try
     {
         List <HotelGuest> list = HotelGuestAccessor.HotelGuestGet(hotelGuestId);
         return((list.Count == 1) ? list.ElementAt(0) : null);
     }
     catch (ApplicationException)
     {
         throw;
     }
     catch (SqlException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Miguel Santana
 /// Created: 2015/02/12
 /// Creates a new Hotel Guest in the database
 /// </summary>
 /// <remarks>
 /// Rose Steffensmeier
 /// Updated: 2015/03/10
 ///
 /// Rose Steffensmeier
 /// Updated: 2015/03/12
 /// Updated try/catch blocks
 ///
 /// Tony Noel
 /// Updated 2015/04/13 by
 /// Updated to comply with the ResultsEdit class of error codes.
 /// </remarks>
 /// <param name="newHotelGuest">Object containing new hotel guest information</param>
 /// <returns>Number of rows effected</returns>
 public ResultsEdit AddHotelGuest(HotelGuest newHotelGuest)
 {
     try
     {
         bool worked = HotelGuestAccessor.HotelGuestAdd(newHotelGuest) > 0;
         if (worked == true)
         {
             return(ResultsEdit.Success);
         }
     }
     catch (SqlException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
     return(ResultsEdit.DatabaseError);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Miguel Santana
 /// Created: 2015/02/12
 ///
 /// Updates a hotel guest with new information
 /// </summary>
 /// <remarks>
 /// Rose Steffensmeier
 /// Updated: 2015/03/12
 /// Updated try/catch blocks
 ///
 /// Tony Noel
 /// Updated 2015/04/13
 /// Updated to comply with the ResultsEdit class of error codes.
 /// </remarks>
 /// <param name="oldHotelGuest">Object containing original information about a hotel guest</param>
 /// <param name="newHotelGuest">Object containing new hotel guest information</param>
 /// <returns>Number of rows effected</returns>
 public ResultsEdit UpdateHotelGuest(HotelGuest oldHotelGuest, HotelGuest newHotelGuest)
 {
     try
     {
         bool worked = HotelGuestAccessor.HotelGuestUpdate(oldHotelGuest, newHotelGuest) > 0;
         if (worked == true)
         {
             return(ResultsEdit.Success);
         }
     }
     catch (ApplicationException)
     {
         throw;
     }
     catch (SqlException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
     return(ResultsEdit.DatabaseError);
 }
Exemplo n.º 14
0
 public void HotelAccessorGetFail()
 {
     List <HotelGuest> guest = HotelGuestAccessor.HotelGuestGet(-1);
 }
Exemplo n.º 15
0
 public void HotelAccessorAddFail()
 {
     HotelGuestAccessor.HotelGuestAdd(new HotelGuest("Fake", "Person", "1111 Fake St.", "", new CityState("52641", "Mt. Pleasant", "IA"), "5556667777", "*****@*****.**", "000", "5678", true));
     //This line below must remain here, helps to properly track and delete invoice
     TestCleanupAccessor.ClearOutInvoice();
 }