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); }
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); }
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); }
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); }