コード例 #1
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CreateGuestWithInvalidEmail()
            {
                //Arrange
                var guestDao = MockRepository.GenerateStub<IGuestDao>();
                var guestManager = new GuestManager();

                var guest = new Guest
                {
                    BusinessId = 1,
                    TitleId = 2,
                    Forename = "Jessica",
                    Surname = "Rabbit",
                    City = "London",
                    PostCode = "TW75FJ",
                    GuestPhones = new List<GuestPhone> { new GuestPhone { Number = "999999999" }, new GuestPhone { Number = "999999999" } },
                    Email = "newemail#eviivo.com",
                    Notes = "Guest's notes",
                    CountryId = 1
                };

                guestDao.Stub(x => x.Create(Arg<Guest>.Is.Anything)).WhenCalled(x => ((Guest)x.Arguments[0]).Id = 787);

                guestManager.GuestDao = guestDao;

                //Act
                guestManager.Create(guest);

                //Assert
                Assert.IsNotNull(guest.Id, "The Guest was not created");
            }
コード例 #2
0
ファイル: OrderEventDaoTest.cs プロジェクト: ognjenm/egle
            public void CreateOrderEventIsSuccessful()
            {
                // Arrange
                var orderDao = new OrderDao();
                GuestManager guestManager = new GuestManager();
                Guest guest = new Guest
                {
                    BusinessId = BUSINESS_ID,
                    DefaultCultureCode = "en-GB",
                    AddressLine1 = "AL1",
                    City = "City",
                    Forename = "Bob",
                    Surname = "Smith"
                };
                guestManager.Create(guest);

                var mockOrder = new Order
                    {
                        IntegrationType = IntegrationTypeEnum.Myweb,
                        OfflineSourceEnum = OfflineSourceEnum.Web,
                        CustomerCurrencyCode = "GBP",
                        OrderSourceCode = SourceType.Online.GetCode(),
                        LeadGuest = guest,
                        LeadGuestId = guest.Id.Value
                    };
                
                orderDao.CreateOrder(BUSINESS_ID, mockOrder);

                Assert.IsTrue(mockOrder.Id.HasValue);

                var orderEvent = new OrderEvent
                    {
                        OrderId = mockOrder.Id.Value,
                        EventType = new Model.Core.EnumEntity { Code = OrderEventTypeEnum.OrderCreated.GetCode() }
                    };

                // Act
                orderEventDao.Create(orderEvent);

                // Assert
                Assert.IsTrue(orderEvent.Id > 0, "Id was not filled in after create");
            }
コード例 #3
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CreateGuest()
            {
                //Arrange
                var guestDao = MockRepository.GenerateStub<IGuestDao>();
                IGuestEventDao guestEventDao = MockRepository.GenerateMock<IGuestEventDao>();

                var guestManager = new GuestManager();
                
                var guest = new Guest
                {
                    BusinessId = 1,
                    TitleId = 2,
                    Forename = "Jessica",
                    Surname = "Rabbit",
                    City = "London",
                    PostCode = "TW75FJ",
                    GuestPhones = new List<GuestPhone> { new GuestPhone { Number = "999999999" }, new GuestPhone { Number = "999999999" } },
                    Email = "*****@*****.**",
                    Notes = "Guest's notes",
                    CountryId = 1
                };

                guestDao.Stub(x => x.Create(Arg<Guest>.Is.Anything)).WhenCalled(x => ((Guest) x.Arguments[0]).Id = 787);
                guestEventDao.Expect(eDao => eDao.Create(Arg<GuestEvent>.Matches(ge => ge.GuestEventType == GuestEventType.Created && ge.GuestId == 787)));
                
                guestManager.GuestDao = guestDao;
                guestManager.GuestEventDao = guestEventDao;

                //Act
                guestManager.Create(guest);

                //Assert
                Assert.IsNotNull(guest.Id, "The Guest was not created");
                guestEventDao.VerifyAllExpectations();

            }
コード例 #4
0
ファイル: OrderDaoTest.cs プロジェクト: ognjenm/egle
            public void ModifyOrderNoteIsSuccessful()
            {
                string notes = "Test";
                string newNotes = "NewNotes";

                // arrange
                // set up guest for order
                var guestManager = new GuestManager();
                var guest = new Guest
                {
                    BusinessId = BUSINESS_ID,
                    DefaultCultureCode = "en-GB",
                    AddressLine1 = "AL1",
                    City = "City",
                    Forename = "Bob",
                    Surname = "Smith"
                };

                guestManager.Create(guest);

                var mockOrder = new Order
                {
                    IntegrationType = IntegrationTypeEnum.Myweb,
                    OfflineSourceEnum = OfflineSourceEnum.Web,
                    CustomerCurrencyCode = "GBP",
                    OrderSourceCode = SourceType.Online.GetCode(),
                    LeadGuest = guest,
                    LeadGuestId = guest.Id.Value,
                    GroupReference = notes
                };

                orderDao.CreateOrder(BUSINESS_ID, mockOrder);
                Assert.IsTrue(mockOrder.Id.HasValue, "Test order was not created");

                var mockBooking = new Booking
                {
                    BusinessId = BUSINESS_ID,
                    StartDate = DateTime.UtcNow,
                    EndDate = DateTime.UtcNow.AddDays(1),
                    Cost = new decimal(0.00),
                    NumberOfAdults = 2,
                    RoomTypeId = 1,
                    RoomId = 1,
                    RatePlanId = 1,
                    BookingStatus = new EnumEntity { Code = BookingStatusType.TENTATIVE },
                    BookingScenarioType = BookingScenarioTypeEnum.OnAccountBooking,
                    BookingReferenceNumber = "ABC123",
                    RateType = new EnumEntity { Code = RateType.BEST_AVAILABLE_RATE },
                    CheckinStatus = new EnumEntity { Code = CheckinStatusOptions.NOTCHECKEDIN },
                    Guest = mockOrder.LeadGuest,
                    OrderId = mockOrder.Id.Value
                };

                bookingDao.Create(mockBooking, mockOrder);

                // act
                orderDao.ModifyOrderNote(mockOrder.Id.Value, newNotes);

                // assert
                var result = orderDao.GetByKey(mockOrder.Id.Value);
                Assert.AreEqual(newNotes, result.Notes, "Notes field has not updated successfully");
            }
コード例 #5
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void ModifyLimitedGuestWithoutCountryIdAssignsCountryIdOfTheBusiness()
            {
                // Arrange
                IGuestDao guestDao = MockRepository.GenerateStub<IGuestDao>();
                IGuestEventDao guestEventDao = MockRepository.GenerateStub<IGuestEventDao>();
                ICountryDao countryDao = MockRepository.GenerateStub<ICountryDao>();
                GuestManager GuestManager = new GuestManager();
                GuestManager.GuestDao = guestDao;
                GuestManager.CountryDao = countryDao;
                GuestManager.GuestEventDao = guestEventDao;

                Guest guest = new Guest { Id = 1, BusinessId = 1, Surname = "Surname" };
                Country country = new Country { Id = 1, Name = "United Kingdom", IsoCode = 826 };
                guestDao.Stub(x => x.Modify(guest));
                guestDao.Stub(c => c.IsGuestAssociatedToConfirmedBooking(1, 1)).Return(false);
                guestEventDao.Stub(ev => ev.Create(Arg<GuestEvent>.Matches(ge => ge.GuestId == 1 && ge.GuestEventType == GuestEventType.Modified)));
                countryDao.Stub(c => c.GetByBusiness(1)).Return(country);

                // Act
                GuestManager.Modify(guest);

                // Assert
                Assert.AreEqual(country.Id, guest.CountryId, "Country id was updated incorrectly.");
            }  
コード例 #6
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void ModifyValidatingMinimumRequiredSetForProvisionalBooking()
            {
                //Arrange
                IGuestDao guestDao = MockRepository.GenerateStub<IGuestDao>();
                GuestManager GuestManager = new GuestManager();

                Guest guest = new Guest();
                guest.Id = 1;
                guest.BusinessId = 1;
                guest.TitleId = 2;

                guestDao.Stub(x => x.Modify(Arg<Guest>.Is.Anything));
                guestDao.Stub(c => c.IsGuestAssociatedToConfirmedBooking(1, 1)).Return(false);

                GuestManager.GuestDao = guestDao;

                //Act
                try
                {
                    GuestManager.Modify(guest);
                    Assert.Fail("An exception SRVEX30017 of type ValidationException should have been thrown"); 
                }
                catch (ValidationException ex)
                {
                    //Assert
                    Assert.AreEqual("SRVEX30017", ex.Code, "The Validation exception is not returning the right error code");
                }
            }
コード例 #7
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void ModifyValidatingMinimumRequiredSetForGuestWithConfirmedBooking()
            {
                //Arrange
                IGuestDao guestDao = MockRepository.GenerateStub<IGuestDao>();
                var guestManager = new GuestManager();

                var guest = new Guest
                    {
                        Id = 1,
                        BusinessId = 1,
                        TitleId = 2,
                        Surname = "Test",
                        IsConfirmationEmailToBeSent = true
                    };

                guestDao.Stub(c => c.IsGuestAssociatedToConfirmedBooking(1, 1)).Return(true);
                guestManager.GuestDao = guestDao;

                //Act
                try
                {
                    guestManager.Modify(guest);
                    Assert.Fail("An exception SRVEX30110 of type ValidationException should have been thrown"); 
                }
                catch (ValidationException ex)
                {
                    //Assert
                    Assert.AreEqual("SRVEX30110", ex.Code, "The Validation exception is not returning the right error code");
                }
            }
コード例 #8
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CheckIfLengthOfAllStringFieldsExceedThrowsValidationException()
            {
                // Arrange
                var guest = new Guest
                {
                    BusinessId = 1,
                    Forename = "FieldValidationTestFieldValidationTestFieldValidationTest",
                    Surname = "FieldValidationTestFieldValidationTestFieldValidationTest",
                    AddressLine1 =
                        "CheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationException",
                    AddressLine2 =
                        "CheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationException",
                    AddressLine3 =
                        "CheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationException",
                    City =
                        "CheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationException",
                    PostCode = "W68JaTW31SlTw33RTW68JaTW31SlTw33RT",
                    GuestPhones = new List<GuestPhone>
                    {
                        new GuestPhone { Number = "123456789012345678901234567890123456789023"},
                        new GuestPhone { Number = "123456789012345678901234567890123456789023"}
                    },
                    Email =
                        "*****@*****.**",
                    Notes =
                        "CheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationExceptionCheckIfLengthOfNotesExceedsThrowsValidationException",
                    CountryId = 227
                };

                var guestManager = new GuestManager();

                try
                {
                    // Act
                    guestManager.Create(guest);
                    Assert.Fail("An exception SRVEX30034 of type ValidationException should have been thrown");
                }
                catch (ValidationException ex)
                {
                    //Assert
                    Assert.AreEqual("SRVEX30034", ex.Code, "The Validation exception is not returning the right error code");

                    // Check if All fields are present in the error message
                    // Note: This is an exception to other unit tests. Here we are making sure if error description contains all invalid field names.
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("Forename"), "Forename is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("Surname"), "Surname is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("AddressLine1"), "AddressLine1 is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("AddressLine2"), "AddressLine2 is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("AddressLine3"), "AddressLine3 is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("City"), "City is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("PostCode"), "PostCode is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("ContactNumber1"), "ContactNumber1 is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("ContactNumber2"), "ContactNumber2 is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("Email"), "Email is not present in error description.");
                    Assert.IsTrue(ex.ErrorContextInfo.ErrorDescription.Contains("Notes"), "Notes is not present in error description.");
                }
            }
コード例 #9
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void ModifyGuest()
            {
                // Arrange
                IGuestDao guestDao = MockRepository.GenerateMock<IGuestDao>();
                IGuestEventDao guestEventDao = MockRepository.GenerateMock<IGuestEventDao>();

                GuestManager GuestManager = new GuestManager();
                GuestManager.GuestDao = guestDao;
                GuestManager.GuestEventDao = guestEventDao;

                guestDao.Expect(x => x.Modify(Arg<Guest>.Is.Anything));

                guestEventDao.Expect(eDao => eDao.Create(Arg<GuestEvent>.Matches(ge => ge.GuestEventType == GuestEventType.Modified && ge.GuestId == 1)));
                
                // Guest record
                Guest updatedGuest = new Guest {Id = 1, BusinessId = 1, Surname = "Test", CountryId = 1};

                // Act
                // Modify Guest record
                GuestManager.Modify(updatedGuest);

                // Assert
                guestDao.VerifyAllExpectations();
                guestEventDao.VerifyAllExpectations();
            }
コード例 #10
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void GetGuestReviewsRequestsExpectSuccess()
            {
                var guestDao = MockRepository.GenerateStub<IGuestDao>();
                var guestManager = new GuestManager { GuestDao = guestDao };
                guestDao.Expect(x => x.GetGuestReviewsRequests(Arg<int>.Is.Anything, Arg<string>.Is.Anything)).Return(ReviewRequests);
                var results = guestManager.GetGuestReviewsRequests(1, string.Empty);

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Count() == 1);
            }
コード例 #11
0
ファイル: OrderDaoTest.cs プロジェクト: ognjenm/egle
            public void CreateOrderWithReasonForIssueIsSuccessful()
            {
                // arrange
                // set up guest for order
                GuestManager guestManager = new GuestManager();
                Guest guest = new Guest
                {
                    BusinessId = BUSINESS_ID,
                    DefaultCultureCode = "en-GB",
                    AddressLine1 = "AL1",
                    City = "City",
                    Forename = "Bob",
                    Surname = "Smith"
                };
                guestManager.Create(guest);

                var mockOrder = new Order
                {
                    IntegrationType = IntegrationTypeEnum.Myweb,
                    OfflineSourceEnum = OfflineSourceEnum.Web,
                    CustomerCurrencyCode = "GBP",
                    OrderSourceCode = SourceType.Online.GetCode(),
                    LeadGuest = guest,
                    LeadGuestId = guest.Id.Value,
                    IsIssue = true,
                    ReasonForIssue = "No Availability"
                };

                orderDao.CreateOrder(BUSINESS_ID, mockOrder);
                Assert.IsTrue(mockOrder.Id.HasValue, "test order was not created");

                // act
                Order resultOrder = orderDao.GetOrderWithBookingsByKey(mockOrder.Id.Value);

                // assert
                Assert.IsNotNull(resultOrder, "Order object has not been returned.");
                Assert.AreEqual(mockOrder.Id, resultOrder.Id, "Order ids did not match");
                Assert.AreEqual(mockOrder.IsIssue, resultOrder.IsIssue, "Order IsIssue did not match");
                Assert.AreEqual(mockOrder.ReasonForIssue, resultOrder.ReasonForIssue, "Order ReasonForIssue did not match");
            }
コード例 #12
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CreateGuestWithoutCountryIdAssignsCountryIdOfTheBusiness()
            {
                // Arrange
                IGuestDao guestDao = MockRepository.GenerateStub<IGuestDao>();
                IGuestEventDao guestEventDao = MockRepository.GenerateStub<IGuestEventDao>();
                ICountryDao countryDao = MockRepository.GenerateStub<ICountryDao>();
                GuestManager GuestManager = new GuestManager();
                GuestManager.GuestDao = guestDao;
                GuestManager.CountryDao = countryDao;
                GuestManager.GuestEventDao = guestEventDao;

                Guest guest = new Guest { BusinessId = 1, Surname = "Surname" };
                Country country = new Country { Id = 1, Name = "United Kingdom", IsoCode = 826 };
                guestDao.Stub(x => x.Create(guest)).WhenCalled(x => guest.Id = 1);
                guestEventDao.Stub(ev => ev.Create(new GuestEvent { GuestId = 1, GuestEventType = Model.Customer.GuestEventType.Created }));
                
                countryDao.Stub(c => c.GetByBusiness(1)).Return(country);

                // Act
                GuestManager.Create(guest);

                // Assert
                Assert.AreEqual(1, guest.Id, "Check that Guest was successfully created with only basic data.");
                Assert.AreEqual(country.Id, guest.CountryId, "Country id was updated incorrectly.");
            }
コード例 #13
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void GetStateProvinceByCountryExpectSuccess()
            {
                const int countryId = 1;
                var country = new Country() {Id = countryId};
                var stateProvinceDao = MockRepository.GenerateStub<IStateProvinceDao>();
                var guestManager = new GuestManager(){StateProvinceDao = stateProvinceDao};
                stateProvinceDao.Expect(x => x.GetAll()).Return(new List<StateProvince>() { new StateProvince(){Country = country}});
                
                var results = guestManager.GetStateProvinceByCountry(countryId);

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Count() == 1);

            }
コード例 #14
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CreateValidatingMinimumRequiredSetForProvisionalBookingSuccess()
            {
                //Arrange
                IGuestDao guestDao = MockRepository.GenerateStub<IGuestDao>();
                IGuestEventDao guestEventDao = MockRepository.GenerateStub<IGuestEventDao>();
                GuestManager GuestManager = new GuestManager();

                Guest guest = new Guest();
                guest.BusinessId = 1;            
                guest.Surname = "Smith";
                guest.CountryId = 1;

                guestDao.Stub(x => x.Create(Arg<Guest>.Is.Anything)).WhenCalled(x => ((Guest)x.Arguments[0]).Id = 787);
                guestEventDao.Stub(ev => ev.Create(Arg<GuestEvent>.Matches(ge => ge.GuestEventType == GuestEventType.Created && ge.GuestId == 787)));

                GuestManager.GuestDao = guestDao;
                GuestManager.GuestEventDao = guestEventDao;

                //Act
                GuestManager.Create(guest);

                // Assert
                Assert.AreEqual(787,guest.Id,"Check that Guest was successfully created with only basic data.");
            }
コード例 #15
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CreateValidatingMinimumRequiredSetForProvisionalBooking()
            {
                //Arrange
                IGuestDao guestDao = MockRepository.GenerateStub<IGuestDao>();
                GuestManager GuestManager = new GuestManager();

                Guest guest = new Guest();
                guest.BusinessId = 1;
                guest.TitleId = 2;

                guestDao.Stub(x => x.Create(Arg<Guest>.Is.Anything)).WhenCalled(x => ((Guest)x.Arguments[0]).Id = 787);

                GuestManager.GuestDao = guestDao;

                //Act
                try
                {
                    GuestManager.Create(guest);
                    Assert.Fail("An exception SRVEX30017 of type ValidationException should have been thrown"); 
                }
                catch (ValidationException ex)
                {
                    //Assert
                    Assert.AreEqual("SRVEX30017", ex.Code, "The Validation exception is not returning the right error code");
                }
            }
コード例 #16
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CreateGuestWithInvalidPhone()
            {
                //Arrange
                var guestDao = MockRepository.GenerateStub<IGuestDao>();
                var guestManager = new GuestManager();

                var guest = new Guest
                {
                    BusinessId = 1,
                    TitleId = 2,
                    Forename = "Jessica",
                    Surname = "Rabbit",
                    City = "London",
                    PostCode = "TW75FJ",
                    GuestPhones = new List<GuestPhone> { new GuestPhone { Number = "abc" }, new GuestPhone { Number = "999999999" } },
                    Email = "newemail#@eviivo.com",
                    Notes = "Guest's notes",
                    CountryId = 1
                };

                guestDao.Stub(x => x.Create(Arg<Guest>.Is.Anything)).WhenCalled(x => ((Guest)x.Arguments[0]).Id = 787);

                guestManager.GuestDao = guestDao;

                try
                {
                    //Act
                    guestManager.Create(guest);
                    Assert.Fail("Guest creation didn't throw exception");
                }
                catch (ValidationException vex)
                {
                    //Assert
                    Assert.AreEqual("SRVEX30055", vex.Code, "Validation code did not match");
                }
            }
コード例 #17
0
ファイル: PaymentEventDaoTest.cs プロジェクト: ognjenm/egle
            protected override void RunBeforeAllTests()
            {
                base.RunBeforeAllTests();

                GuestManager guestManager = new GuestManager();
                PaymentManager paymentManager = new PaymentManager();

                Guest guest = new Guest
                {
                    BusinessId = BUSINESS_ID,
                    DefaultCultureCode = "en-GB",
                    AddressLine1 = "AL1",
                    City = "City",
                    Forename = "Bob",
                    Surname = "Smith"
                };
                guestManager.Create(guest);

                var mockOrder = new Order
                {
                    IntegrationType = IntegrationTypeEnum.Myweb,
                    OfflineSourceEnum = OfflineSourceEnum.Web,
                    CustomerCurrencyCode = "GBP",
                    OrderSourceCode = SourceType.Online.GetCode(),
                    LeadGuest = guest,
                    LeadGuestId = guest.Id.Value
                };

                orderDao.CreateOrder(BUSINESS_ID, mockOrder);

                // set up payment for the order
                setupPayment = new Model.Booking.Payment
                                   {
                                       OrderId = mockOrder.Id.Value,
                                       PaymentSourceEnum = PaymentSourceEnum.Online,
                                       PaymentTypeEnum = PaymentTypeEnum.Payment,
                                       PaymentMethodEnum = PaymentMethodEnum.AccountTransfer,
                                       Currency = new Currency(mockOrder.CustomerCurrencyCode),
                                       Amount = 30,
                                       Notes = "Test Notes",
                                       PaymentStatusEnum = PaymentStatusEnum.Created,
                                       ReceivedDate = DateTime.Now.AddDays(-5),
                                       MerchantType = MerchantTypeEnum.EviivoAccount
                                   };

                paymentManager.CreatePaymentForOrder(setupPayment, BUSINESS_ID);
            }
コード例 #18
0
ファイル: OrderDaoTest.cs プロジェクト: ognjenm/egle
            public void GetGroupReferencesWithMatchReturnsResults()
            {
                const string SEARCH_CRITERIA = "Test";

                // arrange
                // set up guest for order
                var guestManager = new GuestManager();
                var guest = new Guest
                {
                    BusinessId = BUSINESS_ID,
                    DefaultCultureCode = "en-GB",
                    AddressLine1 = "AL1",
                    City = "City",
                    Forename = "Bob",
                    Surname = "Smith"
                };

                guestManager.Create(guest);

                var mockOrder = new Order
                {
                    IntegrationType = IntegrationTypeEnum.Myweb,
                    OfflineSourceEnum = OfflineSourceEnum.Web,
                    CustomerCurrencyCode = "GBP",
                    OrderSourceCode = SourceType.Online.GetCode(),
                    LeadGuest = guest,
                    LeadGuestId = guest.Id.Value,
                    GroupReference = SEARCH_CRITERIA
                };

                orderDao.CreateOrder(BUSINESS_ID, mockOrder);
                Assert.IsTrue(mockOrder.Id.HasValue, "Test order was not created");

                var mockBooking = new Booking
                                      {
                                          BusinessId = BUSINESS_ID,
                                          StartDate = DateTime.UtcNow,
                                          EndDate = DateTime.UtcNow.AddDays(1),
                                          Cost = new decimal(0.00),
                                          NumberOfAdults = 2,
                                          RoomTypeId = 1,
                                          RoomId = 1,
                                          RatePlanId = 1,
                                          BookingStatus = new EnumEntity {Code = BookingStatusType.TENTATIVE},
                                          BookingScenarioType = BookingScenarioTypeEnum.OnAccountBooking,
                                          BookingReferenceNumber = "ABC123",
                                          RateType = new EnumEntity {Code = RateType.BEST_AVAILABLE_RATE},
                                          CheckinStatus = new EnumEntity {Code = CheckinStatusOptions.NOTCHECKEDIN},
                                          Guest = mockOrder.LeadGuest,
                                          OrderId = mockOrder.Id.Value
                                      };

                bookingDao.Create(mockBooking, mockOrder);

                // act
                var results = orderDao.GetGroupReferences(BUSINESS_ID, SEARCH_CRITERIA, 10);

                // assert
                Assert.IsNotNull(results, "Result set has not been returned.");
                Assert.AreEqual(1, results.Count, "Result set count is incorrect.");
            }
コード例 #19
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void GetStateProvinceByCountryWithInvalidCountryExpectExpceptionThrown()
            {
                const int countryId = 0;
                var stateProvinceDao = MockRepository.GenerateStub<IStateProvinceDao>();
                var guestManager = new GuestManager() { StateProvinceDao = stateProvinceDao };
               
                guestManager.GetStateProvinceByCountry(countryId);

            }
コード例 #20
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CheckIfLengthOfContactNumberExceedsThrowsValidationException()
            {
                // Arrange
                var guest = new Guest
                {
                    BusinessId = 1,
                    Surname = "FieldValidationTest",
                    GuestPhones = new List<GuestPhone>
                    {
                        new GuestPhone { Number = "123456789012345678901234567890123456789023"}
                    },
                    CountryId = 227
                };

                var guestManager = new GuestManager();

                try
                {
                    // Act
                    guestManager.Create(guest);
                    Assert.Fail("An exception SRVEX30034 of type ValidationException should have been thrown");
                }
                catch (ValidationException ex)
                {
                    //Assert
                    Assert.AreEqual("SRVEX30034", ex.Code,
                                    "The Validation exception is not returning the right error code");
                }
            }
コード例 #21
0
ファイル: GuestManagerTest.cs プロジェクト: ognjenm/egle
            public void CheckIfLengthOfNotesExceedsThrowsValidationException()
            {
                // Arrange
                Guest guest = new Guest();
                guest.BusinessId = 1;
                guest.Surname = "FieldValidationTest";
                guest.Notes = "CheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationExceptionCheckIfLengthOfAllStringFieldsExceedsThrowsValidationException";
                guest.CountryId = 227;

                GuestManager GuestManager = new GuestManager();

                try
                {
                    // Act
                    GuestManager.Create(guest);
                    Assert.Fail("An exception SRVEX30034 of type ValidationException should have been thrown");
                }
                catch (ValidationException ex)
                {
                    //Assert
                    Assert.AreEqual("SRVEX30034", ex.Code,
                                    "The Validation exception is not returning the right error code");
                }
            }
コード例 #22
0
ファイル: OrderDaoTest.cs プロジェクト: ognjenm/egle
            public void CreateWithValidInfoIsSuccessful()
            {
                // arrange
                GuestManager guestManager = new GuestManager();
                Guest guest = new Guest
                {
                    BusinessId = BUSINESS_ID,
                    DefaultCultureCode = "en-GB",
                    AddressLine1 = "AL1",
                    City = "City",
                    Forename = "Bob",
                    Surname = "Smith"
                };
                guestManager.Create(guest);

                var mockOrder = new Order
                {
                    IntegrationType = IntegrationTypeEnum.Myweb,
                    OfflineSourceEnum = OfflineSourceEnum.Web,
                    CustomerCurrencyCode = "GBP",
                    OrderSourceCode = SourceType.Online.GetCode(),
                    LeadGuest = guest,
                    LeadGuestId = guest.Id.Value
                };

                // ACT
                orderDao.CreateOrder(BUSINESS_ID, mockOrder);

                // Assert
                Assert.IsTrue(mockOrder.Id.HasValue, "test order was not created");
            }