예제 #1
0
        public void CheckDate()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            Assert.AreEqual(tourOrder.Date_Time, DefaultCreator.createDateTime());
        }
예제 #2
0
        public void ChangeAmmounOfPeopleToNonPositive()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            Assert.Throws <ArgumentException>(
                () => tourOrder.AmountPeople = -1
                );
        }
예제 #3
0
        public void ChangeAmountPeople()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            tourOrder.AmountPeople = 2;

            Assert.AreEqual(tourOrder.AmountPeople, 2);
        }
예제 #4
0
        public void CreateAccount()
        {
            var account = DefaultCreator.createAccount();

            Assert.IsNotNull(account);
            Assert.AreEqual(account.ID, 1);
            Assert.AreEqual(account.Login, @"test_login");
            Assert.AreEqual(account.Mail, @"*****@*****.**");
            Assert.AreEqual(account.PasswordHash, 12345);
        }
예제 #5
0
        public void CheckNotRegistratedTicket()
        {
            var airline = DefaultCreator.createAirline(0);
            var depart  = DefaultCreator.createDateTime(2000, 2, 2);
            var arrive  = DefaultCreator.createDateTime(2200, 2, 2);
            var ticket  = DefaultCreator.createTicket(depart, arrive);

            Assert.Throws <Exception>(
                () => airline.CheckTicket(ticket)
                );
        }
예제 #6
0
        public void CheckRegistratedTicket()
        {
            var airline = DefaultCreator.createAirline(0);
            var depart  = DefaultCreator.createDateTime(2000, 2, 2);
            var arrive  = DefaultCreator.createDateTime(2200, 2, 2);
            var ticket  = DefaultCreator.createTicket(depart, arrive);

            airline.AddTicket(ticket);

            Assert.False(airline.CheckTicket(ticket));
        }
예제 #7
0
        public void CheckAddHistory()
        {
            var account   = DefaultCreator.createAccount();
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            account.AddTourOrder(tourOrder);

            Assert.True(account.History.Contains(tourOrder));
        }
예제 #8
0
        public void AddingTourForRegistratedCustomer()
        {
            var customer  = DefaultCreator.createRegistrateCustomer();
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            customer.addTour(tourOrder);

            Assert.NotNull(customer.Account);
            Assert.IsTrue(customer.Account.History.Contains(tourOrder));
        }
예제 #9
0
        public void AddGuide()
        {
            var excursion =
                DefaultCreator.createExursion(DefaultCreator.createDateTime());

            var guide = DefaultCreator.createGuide();

            excursion.addGuide(guide);

            Assert.IsNotEmpty(excursion.getAvailableGuides());
            Assert.AreEqual(guide, excursion.getAvailableGuides()[0]);
        }
예제 #10
0
        public void ChangeDate()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            var date = DefaultCreator.createDateTime(2015, 5, 17);

            tourOrder.Date_Time = date;

            Assert.AreEqual(tourOrder.Date_Time, date);
        }
예제 #11
0
        public void CheckGetAvailableLanguages()
        {
            var excursion =
                DefaultCreator.createExursion(DefaultCreator.createDateTime());

            var language = @"Ukranian";

            var guide = DefaultCreator.createGuide(language);

            excursion.addGuide(guide);

            Assert.IsTrue(excursion.getAvailableLanguages().Contains(language));
        }
예제 #12
0
 public void EmptyNameFieldIsForbidden()
 {
     Assert.Throws <ArgumentNullException>(
         () =>
     {
         new TravelAgencyModel.Excursion(
             @""
             , 322
             , DefaultCreator.createDateTime()
             );
     }
         );
 }
예제 #13
0
        public void AddExcursion_AddOneExcursion()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            var excursion =
                DefaultCreator.createExursion(DefaultCreator.createDateTime());

            tourOrder.AddExcursion(excursion);

            Assert.IsTrue(tourOrder.GetExcursion().Contains(excursion));
        }
예제 #14
0
        public void AddExcursion_DateInTourLessThenDateOfExcursions()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            var excursion =
                DefaultCreator.createExursion(
                    DefaultCreator.createDateTime()
                    );

            tourOrder.AddExcursion(excursion);
        }
예제 #15
0
        public void SendingTour()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            var mockHandler = Substitute.For <EventHandler>();

            tourOrder.SendingTour += mockHandler;

            tourOrder.SendTourForOperator();

            mockHandler.Received(1).Invoke(tourOrder, EventArgs.Empty);
        }
예제 #16
0
        public void TwiceAddOneGuide()
        {
            var excursion =
                DefaultCreator.createExursion(DefaultCreator.createDateTime());

            var guide = DefaultCreator.createGuide();

            excursion.addGuide(guide);

            Assert.IsNotEmpty(excursion.getAvailableGuides());
            Assert.Throws <Exception>(
                () => excursion.addGuide(guide)
                );
        }
예제 #17
0
        public void AddExcursion_TwiceAddOneExcursion()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            Excursion excursion =
                DefaultCreator.createExursion(DefaultCreator.createDateTime());

            tourOrder.AddExcursion(excursion);

            Assert.Throws <ArgumentException>(
                () => tourOrder.AddExcursion(excursion)
                );
        }
예제 #18
0
        public void GetUnreservedTickets()
        {
            var airline = DefaultCreator.createAirline(0);
            var depart  = DefaultCreator.createDateTime(2000, 2, 2);
            var arrive  = DefaultCreator.createDateTime(2200, 2, 2);
            var ticket  = DefaultCreator.createTicket(depart, arrive);
            var ticket2 = DefaultCreator.createTicket(depart, arrive);

            ticket2.Reserved = true;

            airline.AddTicket(ticket);
            airline.AddTicket(ticket2);

            var unreservedTicketCollection = airline.GetAvailableTickets();

            Assert.True(unreservedTicketCollection.Count == 1);
            Assert.True(unreservedTicketCollection.Contains(ticket));
        }
예제 #19
0
        public void AddExcursion_AddFewExcursion()
        {
            var tourOrder = DefaultCreator.createTourOrder(
                DefaultCreator.createTour()
                , DefaultCreator.createCustomer());

            Excursion excursion1 =
                DefaultCreator.createExursion(DefaultCreator.createDateTime());

            Excursion excursion2 =
                DefaultCreator.createExursion(DefaultCreator.createDateTime());

            tourOrder.AddExcursion(excursion1);
            tourOrder.AddExcursion(excursion2);

            Assert.IsTrue(tourOrder.GetExcursion().Contains(excursion1));
            Assert.IsTrue(tourOrder.GetExcursion().Contains(excursion2));
        }
예제 #20
0
 public void SymbolAtMustBePresent()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createAccount(@"test_login", @"nameAtgmail.com")
         );
 }
예제 #21
0
 public void CheckDomen()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createAccount(@"test_login", @"name@gmailDotcom")
         );
 }
예제 #22
0
 public void RestrictionOnValidCharacters()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createAccount(@"test_login", @"na!#$%^&*()+=`~/\,?><|[email protected]")
         );
 }
예제 #23
0
        public void CreateAirline()
        {
            var airline = DefaultCreator.createAirline();

            Assert.AreEqual(airline.Name, @"test_airline");
        }
예제 #24
0
 public void LoginMustBeLessThen16Symbols()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createAccount(@"testTestTestTestTest")
         );
 }
예제 #25
0
 public void VerifyLoginHaveNonWhitespaceCharacter()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createAccount(@"lo gin")
         );
 }
예제 #26
0
 public void EmptySurnameFieldIsForbidden()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createCustomer(@"Test_John", @"")
         );
 }
예제 #27
0
        public void AccountInitAfterCustomerRegistrated()
        {
            var customer = DefaultCreator.createRegistrateCustomer();

            Assert.NotNull(customer.Account);
        }
예제 #28
0
        public void InitiallyAccountIsNotSet()
        {
            var customer = DefaultCreator.createCustomer();

            Assert.Null(customer.Account);
        }
예제 #29
0
 public void EmptyNameFieldIsForbidden()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createAirline(1, @"")
         );
 }
예제 #30
0
 public void LoginMustBeMoreThen3Symbols()
 {
     Assert.Throws <ArgumentException>(
         () => DefaultCreator.createAccount(@"tes")
         );
 }