コード例 #1
0
        public void CreateTourTest()
        {
            ResetData();
            var               uow   = new Mock <UnitOfWork>();
            TourService       ts    = new TourService(uow.Object);
            OutputTourService ots   = new OutputTourService(uow.Object);
            int               numEx = ots.GetAllFilteredTours(null, null, null, false).Count + 1;

            TourDTO tour = new TourDTO()
            {
                Country = "Test", Hotel = "Test", Region = "Test", EndDate = DateTime.Now, StartDate = DateTime.Now
            };

            ts.CreateTour(tour);
            int numAc = ots.GetAllFilteredTours(null, null, null, false).Count;

            Assert.AreEqual(numEx, numAc);
        }
コード例 #2
0
        public void FindByIdTest()
        {
            ResetData();
            var               uow = new Mock <UnitOfWork>();
            TourService       ts  = new TourService(uow.Object);
            OutputTourService ots = new OutputTourService(uow.Object);

            TourDTO tour = ots.GetAllFilteredTours(null, null, null, false)[0];

            Assert.AreEqual(tour.Country, ts.FindById(tour.TourId).Country);
            Assert.AreEqual(tour.Region, ts.FindById(tour.TourId).Region);
            Assert.AreEqual(tour.Hotel, ts.FindById(tour.TourId).Hotel);
        }
コード例 #3
0
        public void FindByIdTest()
        {
            ResetData();
            var               uow = new Mock <UnitOfWork>();
            TourService       ts  = new TourService(uow.Object);
            OutputTourService ots = new OutputTourService(uow.Object);

            TourDTO tour = new TourDTO()
            {
                Country = "Ukraine", Region = "Kiev", Hotel = "Ukraine", EndDate = DateTime.Now, StartDate = DateTime.Now
            };

            ts.CreateTour(tour);

            List <TourDTO> tours = ots.GetAllFilteredTours(null, null, null, false);

            Assert.AreEqual(ts.FindById(tours[tours.Count - 1].TourId).Country, tour.Country);
        }
コード例 #4
0
        public void CreateOrderTest()
        {
            ResetData();
            var uow         = new Mock <UnitOfWork>();
            var identityUow = new Mock <IdentityUnitOfWork>();

            UserService       us  = new UserService();
            TourService       ts  = new TourService(uow.Object);
            OrderService      os  = new OrderService(uow.Object);
            OutputTourService ots = new OutputTourService(uow.Object);

            UserDTO user = new UserDTO()
            {
                Email = "123", Password = "******", Address = "Kiev", Name = "Andrey"
            };

            us.Create(user);
            us.Authenticate(user);

            TourDTO tour = new TourDTO()
            {
                Country = "Ukraine", Region = "Kiev", Hotel = "Ukraine", EndDate = DateTime.Now, StartDate = DateTime.Now
            };

            ts.CreateTour(tour);

            List <TourDTO> tours = ots.GetAllFilteredTours(null, null, null, false);
            OrderDTO       order = new OrderDTO()
            {
                Tour = tours[tours.Count - 1], TourId = tours[tours.Count - 1].TourId, ClientName = user.Email, Hotel = true, NumberOfPerson = 1, Transport = true
            };

            os.CreateOrder(order);

            Assert.AreEqual(os.GetAllOrders()[os.GetAllOrders().Count - 1].Tour.Country, tour.Country);
        }