Exemple #1
0
        public void Test_ValidateImportBooking_Reservation_Did_Not_Exist_For_Cancellation()
        {
            // arrange
            Mock <I_M_CompanyBLL>   _mockM_CompanyBLL     = new Mock <I_M_CompanyBLL>();
            Mock <I_R_B_BookingDAL> _mockI_R_B_BookingDAL = new Mock <I_R_B_BookingDAL>();

            List <P_RImportBooking> listp_RImportBooking = new List <P_RImportBooking>();
            P_RImportBooking        item = new P_RImportBooking();

            item.R_B_Header = new R_B_Header()
            {
                ReservationStatus = "Cancel",
                TimeStamp         = DateTime.Now
            };
            item.R_B_Booking = new R_B_Booking()
            {
                BookingNo         = "123456",
                CustomerName      = "Test17172",
                CustomerNo        = "17172",
                FirstName         = "FirstName Test",
                LastName          = "LastName Test",
                Email             = "Email Test",
                CarRentalProvider = "SX",
                CarCategory       = "MBMR",
                PickupDate        = DateTime.Now,
                ReturnDate        = DateTime.Now,
                PickupTime        = DateTime.Now.Date.ToString(),
                ReturnTime        = DateTime.Now.Date.ToString(),
                PickupCountry     = "DE",
                ReturnCountry     = "DE",
            };

            listp_RImportBooking.Add(item);
            R_B_Booking r_B_Booking = null;

            _mockI_R_B_BookingDAL.Setup(x => x.GetByBookingNo("", "")).Returns(r_B_Booking);
            _mockM_CompanyBLL.Setup(x => x.CheckCompanyInfoHDE(item.R_B_Booking.CustomerName, item.R_B_Booking.CustomerNo, "1", "2")).Returns(0);
            bool result = false;
            // act
            R_B_BookingBLL input = new R_B_BookingBLL(_mockM_CompanyBLL.Object, _mockI_R_B_BookingDAL.Object);

            input.ValidateImportBooking(listp_RImportBooking, Platform.BCD.ToString());

            // assert
            if (listp_RImportBooking.Any(x => x.R_B_Booking.AdditionInformation == "This reservation number did not exist for Cancellation." && x.R_B_Booking.Status == 3))
            {
                result = true;
            }
            Assert.IsTrue(result);
        }
Exemple #2
0
        public void Test_ValidateImportBooking_PickUP_Time_Is_Missing()
        {
            // arrange
            Mock <I_M_CompanyBLL>   _mockM_CompanyBLL     = new Mock <I_M_CompanyBLL>();
            Mock <I_R_B_BookingDAL> _mockI_R_B_BookingDAL = new Mock <I_R_B_BookingDAL>();

            List <P_RImportBooking> listp_RImportBooking = new List <P_RImportBooking>();
            P_RImportBooking        item = new P_RImportBooking();

            item.R_B_Header = new R_B_Header()
            {
                ReservationStatus = "Cancel",
                TimeStamp         = DateTime.Now
            };
            item.R_B_Booking = new R_B_Booking()
            {
                BookingNo         = "123456",
                CustomerName      = "Test17172",
                CustomerNo        = "17172",
                FirstName         = "FirstName Test",
                LastName          = "LastName Test",
                Email             = "Email Test",
                CarRentalProvider = "Sixt",
                CarCategory       = "MBMR",
                PickupDate        = DateTime.Now,
                ReturnDate        = DateTime.Now,
            };

            listp_RImportBooking.Add(item);
            _mockM_CompanyBLL.Setup(x => x.CheckCompanyInfoHDE(item.R_B_Booking.CustomerName, item.R_B_Booking.CustomerNo, "1", "2")).Returns(0);
            List <R_B_Booking> lstR_B_Booking = new List <R_B_Booking>();

            _mockI_R_B_BookingDAL.Setup(x => x.GetList()).Returns(lstR_B_Booking);
            bool result = false;
            // act
            R_B_BookingBLL input = new R_B_BookingBLL(_mockM_CompanyBLL.Object, _mockI_R_B_BookingDAL.Object);

            input.ValidateImportBooking(listp_RImportBooking, Platform.BCD.ToString());

            // assert
            if (listp_RImportBooking.Any(x => x.R_B_Booking.AdditionInformation == "Pick up or return time is missing" && x.R_B_Booking.Status == 3))
            {
                result = true;
            }
            Assert.IsTrue(result);
        }
Exemple #3
0
        public void Test_ValidateImportBooking_Customer_Name_Customer_Code_Is_Wrong()
        {
            // arrange
            List <P_RImportBooking> listp_RImportBooking = new List <P_RImportBooking>();

            P_RImportBooking item = new P_RImportBooking();

            item.R_B_Header = new R_B_Header()
            {
                ReservationStatus = "Cancel",
                TimeStamp         = DateTime.Now
            };
            item.R_B_Booking = new R_B_Booking()
            {
                BookingNo    = "123456",
                CustomerName = "Customer Name Test",
                CustomerNo   = "Customer No",
            };
            listp_RImportBooking.Add(item);
            bool result = false;


            Mock <I_M_CompanyBLL>   _mockM_CompanyBLL     = new Mock <I_M_CompanyBLL>();
            Mock <I_R_B_BookingDAL> _mockI_R_B_BookingDAL = new Mock <I_R_B_BookingDAL>();
            List <R_B_Booking>      list = null;

            _mockI_R_B_BookingDAL.Setup(x => x.GetList()).Returns(list);
            _mockM_CompanyBLL.Setup(x => x.CheckCompanyInfoHDE(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(1);
            // act
            R_B_BookingBLL input = new R_B_BookingBLL(_mockM_CompanyBLL.Object);

            input.ValidateImportBooking(listp_RImportBooking, Platform.BCD.ToString());

            // assert
            if (listp_RImportBooking.Any(x => x.R_B_Booking.AdditionInformation == "Customer name or Customer code is wrong" && x.R_B_Booking.Status == 3))
            {
                result = true;
            }
            Assert.IsTrue(result);
        }
Exemple #4
0
        public void Test_ValidateImportBooking_Traveler_Email_Is_Missing()
        {
            // arrange
            Mock <I_M_CompanyBLL>   _mockM_CompanyBLL     = new Mock <I_M_CompanyBLL>();
            Mock <I_R_B_BookingDAL> _mockI_R_B_BookingDAL = new Mock <I_R_B_BookingDAL>();

            List <P_RImportBooking> listp_RImportBooking = new List <P_RImportBooking>();
            P_RImportBooking        item = new P_RImportBooking();

            item.R_B_Header = new R_B_Header()
            {
                ReservationStatus = "Cancel",
                TimeStamp         = DateTime.Now
            };
            item.R_B_Booking = new R_B_Booking()
            {
                BookingNo    = "123456",
                CustomerName = "Test17172",
                CustomerNo   = "17172",
                FirstName    = "FirstName Test",
                LastName     = "LastName Test"
            };

            listp_RImportBooking.Add(item);
            _mockM_CompanyBLL.Setup(x => x.CheckCompanyInfoHDE(item.R_B_Booking.CustomerName, item.R_B_Booking.CustomerNo, "1", "2")).Returns(0);
            bool result = false;
            // act
            R_B_BookingBLL input = new R_B_BookingBLL(_mockM_CompanyBLL.Object);

            input.ValidateImportBooking(listp_RImportBooking, Platform.BCD.ToString());

            // assert
            if (listp_RImportBooking.Any(x => x.R_B_Booking.AdditionInformation == "Traveler email is missing." && x.R_B_Booking.Status == 3))
            {
                result = true;
            }
            Assert.IsTrue(result);
        }