public void TestGetAirTicketsCountReturnsCorrectValues()
 {
     ITicketRepository repository = new TicketRepository();
     repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "Varna", airline: "Bulgaria Air", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 130.50M);
     repository.AddAirTicket(flightNumber: "FX407", from: "Varna", to: "Sofia", airline: "Bulgaria Air", dateTime: new DateTime(2015, 2, 2, 7, 45, 00), price: 135.00M);
     Assert.AreEqual(2, repository.GetTicketsCount(TicketType.Flight));
 }
 public void TestGetTicketsCountEmptyReturns0()
 {
     ITicketRepository repository = new TicketRepository();
     Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Flight));
     Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Bus));
     Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Train));
 }
        public void TestFindTicketsCheckDeletedTickets()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 211.00M, airline: "New Air", flightNumber: "SV1234");
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet");
            string cmdResult = repository.FindTicketsInInterval(
                startDateTime: new DateTime(1980, 1, 1, 0, 0, 0),
                endDateTime: new DateTime(2050, 2, 1, 0, 0, 0));
            string expectedCmdResult =
                "[28.01.2015 07:45|train|26.00] " +
                "[29.01.2015 07:40|bus|25.00] " +
                "[29.01.2015 07:40|flight|211.00]";
            Assert.AreEqual(expectedCmdResult, cmdResult);

            repository.DeleteAirTicket(flightNumber: "SV1234");
            repository.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00));
            repository.DeleteBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), travelCompany: "Biomet");
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Flight));
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Train));
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Bus));
            string cmdResultFind = repository.FindTicketsInInterval(
                startDateTime: new DateTime(1980, 1, 1, 0, 0, 0),
                endDateTime: new DateTime(2050, 2, 1, 0, 0, 0));
            Assert.AreEqual("No matches", cmdResultFind);
        }
 public void TestGetTrainTicketsCountReturnsCorrectValues()
 {
     ITicketRepository repository = new TicketRepository();
     repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 26.00M, studentPrice: 16.30M);
     repository.AddTrainTicket(from: "Sofia", to: "Pleven", dateTime: new DateTime(2015, 1, 26, 8, 56, 00), price: 14.00M, studentPrice: 8.30M);
     Assert.AreEqual(2, repository.GetTicketsCount(TicketType.Train));
 }
 public RequestBillController()
 {
     db = DB.Entities;
     _checkoutRepository = new CheckoutRepository(db);
     _deptRepository = new DeptRepository(db);
     _checkoutDetailRepository = new CheckoutDetailsRepository(db);
     _ticketRepository = new TicketRepository(db);
 }
 public void Take_Gets_Correct_Data(TicketRepository sut)
 {
     var db = Database.Open();
     db.Tickets.Insert(TestData.AllTickets);
     var results = sut.Take(TestData.TenLessThanTotalNumberOfTickets).ToList();
     
     results.ShouldAllBeEquivalentTo(TestData.AllTickets.Take(10));
 }
        public void All_Returns_Correct_Result(
            TicketRepository sut, IEnumerable<Ticket> data)
        {
            Database.Open().Tickets.Insert(data);

            var result = sut.All();
            result.ShouldAllBeEquivalentTo(data);
        }
예제 #8
0
 public TicketController()
 {
     db = DB.Entities;
     _ticketRepository = new TicketRepository(db);
     _deptRepository = new DeptRepository(db);
     _ticketDetailRepository = new TicketDetailRepository(db);
     _ticketUserRepository = new TicketUserRepository(db);
 }
 public void TestGetBusTicketsCountReturnsCorrectValues()
 {
     ITicketRepository repository = new TicketRepository();
     repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 50, 00), price: 25.00M, travelCompany: "Biomet");
     repository.AddBusTicket(from: "Sofia", to: "Pleven", dateTime: new DateTime(2015, 1, 29, 8, 00, 00), price: 12.00M, travelCompany: "Pleven Trans");
     repository.AddBusTicket(from: "Varna", to: "Rousse", dateTime: new DateTime(2015, 1, 29, 7, 00, 00), price: 17.00M, travelCompany: "Etap");
     Assert.AreEqual(3, repository.GetTicketsCount(TicketType.Bus));
 }
        public void TestAddTrainTicketReturnsTrainCreated()
        {
            ITicketRepository repository = new TicketRepository();

            string cmdResult = repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);

            Assert.AreEqual("Train created", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Train));
        }
        public void TestAddAirTicketReturnsFlightCreated()
        {
            ITicketRepository repository = new TicketRepository();
            
            string cmdResult = repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "Varna", airline: "Bulgaria Air", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 130.50M);

            Assert.AreEqual("Flight created", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Flight));
        }
        public void TestAddBusTicketReturnsBusCreated()
        {
            ITicketRepository repository = new TicketRepository();

            string cmdResult = repository.AddBusTicket(from: "Sofia", to: "Varna", travelCompany: "BusExpress", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M);

            Assert.AreEqual("Bus created", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Bus));
        }
        public void TestAddAirTicketDuplicates()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "Varna", airline: "Bulgaria Air", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 130.50M);
            
            string cmdResult = repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "London", airline: "Wizz Air", dateTime: new DateTime(2015, 1, 22, 06, 15, 00), price: 730.55M);

            Assert.AreEqual("Duplicated flight", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Flight));
        }
예제 #14
0
        public void TestFindSingleTicket()
        {
            ITicketRepository repository = new TicketRepository();

            repository.AddBusTicket("Sofia", "Varna", "Etap Address", new DateTime(2015, 1, 30, 12, 55, 00), 25m);

            string actualOutput   = repository.FindTickets("Sofia", "Varna");
            string expectedOutput = "[30.01.2015 12:55|bus|25.00]";

            Assert.AreEqual(expectedOutput, actualOutput);
        }
        public void TestDeleteDeletedTrainTicketReturnsTraindDoesNotExist()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);
            repository.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            string cmdResult = repository.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            Assert.AreEqual("Train does not exist", cmdResult);
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Train));
        }
        public void TestDeleteNotExistingBusTicketReturntsBusDoesNotExist()
        {
            ITicketRepository repository = new TicketRepository();

            repository.AddBusTicket("Sofia", "Varna", "BusExpress", new DateTime(2015, 1, 30, 12, 55, 00), 26.00M);

            string cmdResult = repository.DeleteBusTicket("Plovdiv", "Varna", "BusExpress", new DateTime(2015, 1, 30, 12, 55, 00));

            Assert.AreEqual("Bus does not exist", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Bus));
        }
        public void Delete_Removes_Correct_Data(
            TicketRepository sut, IEnumerable<Ticket> data)
        {
            var db = Database.Open();
            db.Tickets.Insert(data);
            var countBefore = data.Count();

            sut.Delete(data.First());
            var countAfter = (int)db.Tickets.GetCount();
            countAfter.Should().Be(countBefore - 1);
        }
예제 #18
0
        public void TestAddAirTicketDuplicates()
        {
            ITicketRepository repository = new TicketRepository();

            repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "Varna", airline: "Bulgaria Air", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 130.50M);

            string cmdResult = repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "London", airline: "Wizz Air", dateTime: new DateTime(2015, 1, 22, 06, 15, 00), price: 730.55M);

            Assert.AreEqual("Duplicated flight", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Flight));
        }
예제 #19
0
        public virtual bool OrderAllTicketShowMobile(Order order)
        {
            if (order.OrderLines == null)
            {
                return(false);
            }

            return(order.OrderLines.Select(orderLine =>
                                           TicketRepository.GetSingle(x => x.Id.Equals(orderLine.TicketId.Value)))
                   .All(ticket => ticket == null || ticket.HasMobile));
        }
예제 #20
0
        public void TestDeleteTrainTicketReturnsTrainDeleted()
        {
            ITicketRepository repository = new TicketRepository();

            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);

            string cmdResult = repository.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            Assert.AreEqual("Train deleted", cmdResult);
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Train));
        }
        public void TestDeleteDeletedBusTicketReturnsBusdDoesNotExist()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddBusTicket(from: "Sofia", to: "Varna", travelCompany: "BusExpress", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M);
            repository.DeleteBusTicket(from: "Sofia", to: "Varna", travelCompany: "BusExpress", dateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            string cmdResult = repository.DeleteBusTicket(from: "Sofia", to: "Varna", travelCompany: "BusExpress", dateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            Assert.AreEqual("Bus does not exist", cmdResult);
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Bus));
        }
        public void TestDeleteDeletedAirTicketReturnsFlightDoesNotExist()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "Varna", airline: "Bulgaria Air", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 130.50M);
            repository.DeleteAirTicket(flightNumber: "FX215");

            string cmdResult = repository.DeleteAirTicket(flightNumber: "FX215");

            Assert.AreEqual("Flight does not exist", cmdResult);
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Flight));
        }
예제 #23
0
        public Ticket GetById(int ticketId)
        {
            var ticket = TicketRepository.GetById(ticketId);

            if (ticket == null)
            {
                throw new BadRequestException(ErrorMessages.TicketNoEncontrado);
            }

            return(ticket);
        }
예제 #24
0
        public void TestDeleteAirTicketReturnsFlightDoesNotExist()
        {
            ITicketRepository repository = new TicketRepository();

            repository.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "Varna", airline: "Bulgaria Air", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 130.50M);

            string cmdResult = repository.DeleteAirTicket(flightNumber: "FX217");

            Assert.AreEqual("Flight does not exist", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Flight));
        }
예제 #25
0
        public EventFactory()
        {
            Entities entities = new Entities();

            eventRepository             = new EventRepository(entities);
            reviewEventRepository       = new ReviewEventRepository(entities);
            ticketRepository            = new TicketRepository(entities);
            ticketReservationRepository = new TicketReservationRepository(entities);
            creditCardRepository        = new CreditCardRepository(entities);
            messageRepository           = new MessageRepository(entities);
        }
예제 #26
0
        public void GetTicketbyId()
        {
            EmptyLists();

            ticketRepository = new TicketRepository(context);
            Ticket ticket = new Ticket(1, Klasse.TweedeKlasse, new Station(1, "naam", new Positie(1, 23, 42), true), new Station(2, "naam", new Positie(1, 53, 42), true), new Persoon("Henk", "van der Den", "email"), DateTime.Today);

            Assert.Equal(ticket.Id, ticketRepository.GetTicketbyId(1).Id);
            Assert.Equal(ticket.Persoon.Voornaam, ticketRepository.GetTicketbyId(1).Persoon.Voornaam);
            Assert.Equal(ticket.Datum, ticketRepository.GetTicketbyId(1).Datum);
        }
예제 #27
0
        public void TestAddTrainTicketDuplicates()
        {
            ITicketRepository repository = new TicketRepository();

            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);

            string cmdResult = repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 28.00M, studentPrice: 17.70M);

            Assert.AreEqual("Duplicated train", cmdResult);
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Train));
        }
예제 #28
0
        public void GenerateTickets(int paymentID, int beneficiaryID, decimal amount, decimal exchangeRate, string name)
        {
            D.Tickets tickets   = new D.Tickets();
            int       iteration = TicketCalculator.Count(amount, exchangeRate);

            for (int i = 0; i < iteration; i++)
            {
                tickets.Add(new D.Ticket(paymentID, beneficiaryID, i, name));
            }
            TicketRepository.Add(tickets);
        }
예제 #29
0
        public ActionResult Delete(DeleteTicketViewModel model)
        {
            TicketRepository repository = new TicketRepository();

            if (model.Id.ToString() != String.Empty)
            {
                repository.Delete(model.Id);
            }


            return(RedirectToAction("Index"));
        }
예제 #30
0
 public PlanetsController()
 {
     context              = new ApplicationDbContext();
     planetRepository     = new PlanetRepository(context);
     flightPathRepository = new FlightPathRepository(context);
     filePathRepository   = new FilePathRepository(context);
     flightRepository     = new FlightRepository(context);
     ticketRepository     = new TicketRepository(context);
     orderRepository      = new OrderRepository(context);
     fileManager          = new FileManager(HostingEnvironment.MapPath("~/App_Assets/"));
     unitOfWork           = new UnitOfWork(context);
 }
예제 #31
0
 public RepositoryService()
 {
     customerRepository   = new CustomerRepository();
     hallRepository       = new HallRepository();
     movieRepository      = new MovieRepository();
     seanceRepository     = new SeanceRepository();
     seatRepository       = new SeatRepository();
     ticketRepository     = new TicketRepository();
     ticketSeatRepository = new TicketSeatRepository();
     userRepository       = new UserRepository();
     roleRepository       = new RoleRepository();
 }
예제 #32
0
 public void SetupRepositories()
 {
     addressRepository     = new AddressRepository(context);
     appointmentRepository = new AppointmentRepository(context);
     buyerRepository       = new BuyerRepository(context);
     eventRepository       = new EventRepository(context);
     listingRepository     = new ListingRepository(context);
     photoRepository       = new PhotoRepository(context);
     saleRepository        = new SaleRepository(context);
     serviceRepository     = new ServiceRepository(context);
     ticketRepository      = new TicketRepository(context);
 }
        public CheckoutPageViewModel(CheckoutPage view, TicketRepository repository, Showtime showtime,
                                     List <AuditoriumSeat> seats)
        {
            this.repository = repository;
            this.showtime   = showtime;
            this.seats      = seats;
            this.view       = view;

            Total = showtime.Price * seats.Count;

            ArrowAnimatedBrush = new SolidColorBrush();
        }
예제 #34
0
        public OSTicketInstance(string connectionString, IOSTicketOfficalApi osTicketOfficalApi)
        {
            var optionsBuilder = new DbContextOptionsBuilder <OSTicketContext>();

            optionsBuilder.UseMySQL(connectionString);
            var osticketContext = new OSTicketContext(optionsBuilder.Options);

            OSTicketOfficalApi = osTicketOfficalApi;
            Tickets            = new TicketRepository(osticketContext);
            Users      = new UserRepository(osticketContext);
            HelpTopics = new HelpTopicsRepository(osticketContext);
        }
예제 #35
0
        public OSTicketInstance(string databaseServer, string databaseUsername, string databasePassword, string databaseName, IOSTicketOfficalApi osTicketOfficalApi, int portNumber = 3306)
        {
            var optionsBuilder = new DbContextOptionsBuilder <OSTicketContext>();

            optionsBuilder.UseMySQL($"server={databaseServer};uid={databaseUsername};pwd={databasePassword};database={databaseName};port={portNumber};Convert Zero Datetime=True;");
            var osticketContext = new OSTicketContext(new DbContextOptions <OSTicketContext>());

            OSTicketOfficalApi = osTicketOfficalApi;
            Tickets            = new TicketRepository(osticketContext);
            Users      = new UserRepository(osticketContext);
            HelpTopics = new HelpTopicsRepository(osticketContext);
        }
예제 #36
0
        public IEnumerable <TicketSearchResult> TicketSearch(string criteria)
        {
            var criteriaToLower = criteria.ToLower();

            return(TicketRepository.Where(t => t.IsLastDetail && t.Title.ToLower().Contains(criteriaToLower) || t.TicketNumber.ToString().ToLower().Contains(criteriaToLower)).Select(
                       r => new TicketSearchResult()
            {
                Title = r.Title,
                TicketNumber = r.TicketNumber.Value
            }
                       ));
        }
예제 #37
0
 public UnitOfWork(ApplicationContext context)
 {
     _context       = context;
     Users          = new UserRepository(context);
     Performances   = new PerformanceRepository(context);
     Purchases      = new PurchaseRepository(context);
     Tickets        = new TicketRepository(context);
     Vouchers       = new VoucherRepository(context);
     Orders         = new OrderRepository(context);
     Products       = new ProductRepository(context);
     OrdersProducts = new OrderProductRepository(context);
 }
 public UnitOfWork(QueueContext context, IEventBus eventBus, IHubContext <EmpireQueueHub> empireQueueHub)
 {
     _hub               = empireQueueHub;
     _context           = context;
     _eventBus          = eventBus;
     EmpireQueues       = new QueueRepository(context);
     Tickets            = new TicketRepository(context);
     TicketCategories   = new TicketCategoryRepository(context);
     TerminalCategories = new TerminalCategoryRepository(context);
     TerminalTickets    = new TerminalTicketRepository(context);
     Terminals          = new TerminalRepository(context);
 }
예제 #39
0
        public void TicketRepository_GetTickets_ShouldReturnOneTicket()
        {
            var list = new List <Ticket>()
            {
                new Ticket()
            };
            var ticketRepository = new TicketRepository(list);
            var test             = ticketRepository.GetTickets().ToList();

            Assert.IsNotNull(test);
            Assert.AreEqual(1, test.Count);
        }
예제 #40
0
        public void TestDeleteDeletedBusTicketReturnsBusdDoesNotExist()
        {
            ITicketRepository repository = new TicketRepository();

            repository.AddBusTicket(from: "Sofia", to: "Varna", travelCompany: "BusExpress", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M);
            repository.DeleteBusTicket(from: "Sofia", to: "Varna", travelCompany: "BusExpress", dateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            string cmdResult = repository.DeleteBusTicket(from: "Sofia", to: "Varna", travelCompany: "BusExpress", dateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            Assert.AreEqual("Bus does not exist", cmdResult);
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Bus));
        }
예제 #41
0
 public HomeController(IConfiguration configuration)
 {
     ticketContext    = new MSSQLTicketContext(configuration.GetConnectionString("DefaultConnection"));
     ticketRepo       = new TicketRepository(ticketContext);
     ticketConverter  = new TicketViewModelConverter();
     stationContext   = new MSSQLStationContext(configuration.GetConnectionString("DefaultConnection"));
     stationRepo      = new StationRepository(stationContext);
     stationConverter = new StationViewModelConverter();
     trajectContext   = new MSSQLTrajectContext(configuration.GetConnectionString("DefaultConnection"));
     trajectRepo      = new TrajectRepository(trajectContext);
     trajectConverter = new TrajectViewModelConverter();
 }
예제 #42
0
 public UnitOfWork(ApiContext apiContext)
 {
     _apiContext        = apiContext;
     User               = new UserRepository(_apiContext);
     Station            = new StationRepository(_apiContext);
     DestinationOffered = new DestinationOfferedRepository(_apiContext);
     VehicleDeparture   = new VehicleDepartureRepository(_apiContext);
     Company            = new CompanyRepository(_apiContext);
     Vehicle            = new VehicleRepository(_apiContext);
     Ticket             = new TicketRepository(_apiContext);
     Search             = new SearchRepository(_apiContext, DestinationOffered, VehicleDeparture);
 }
        public void TestDeleteExistingBusTicketReturnsBusDeleted()
        {
            ITicketRepository repository = new TicketRepository();
            string            cmdResult  = repository.AddBusTicket("Sofia", "Varna", "BusExpress", new DateTime(2015, 1, 30, 12, 55, 00), 26.00M);

            string cmdResultDeleted = repository.DeleteBusTicket("Sofia", "Varna", "BusExpress", new DateTime(2015, 1, 30, 12, 55, 00));


            Assert.AreEqual("Bus deleted", cmdResultDeleted);
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Bus));
            Assert.AreNotEqual(cmdResult, cmdResultDeleted);
        }
        public override void OnAllRulesSatisfied()
        {
            var ticket = StateBag.Item;

            TicketRepository.UpdateTicket("background", ticket);
            TicketRepository.AddHistory("background", new TicketHistory()
            {
                TicketId  = ticket.TicketId,
                StaffId   = ticket.AssignedToId,
                CreatedOn = DateTime.Now,
                Comment   = "The ticket has been automatically reassigned according to overdue ticket escalation policy"
            });
        }
예제 #45
0
        // GET: Ticket
        public ActionResult Index()
        {
            TicketRepository repository = new TicketRepository();

            List <Ticket> ticket = repository.GetAll();

            TicketsListViewModel model = new TicketsListViewModel();

            model.Tickets = ticket;


            return(View(model));
        }
예제 #46
0
        public void Service_ReturnFalse_When_InputNoExistingObjectId()
        {
            var context = new Mock <AirportContext>();

            context.Setup(x => x.Tickets).Returns(mockSet.Object);
            var rep = new TicketRepository(context.Object);

            mockUoW.Setup(x => x.Tickets).Returns(rep);
            var result = service.DeleteObjectAsync(0).Result;

            //Assert
            Assert.True(result == false);
        }
예제 #47
0
        public void Service_Should_ReturnFalse_When_UpdateNoExistingObject()
        {
            var context = new Mock <AirportContext>();

            context.Setup(x => x.Tickets).Returns(mockSet.Object);
            var rep = new TicketRepository(context.Object);

            mockUoW.Setup(x => x.Tickets).Returns(rep);
            var result = service.UpdateObjectAsync(0, new TicketDTO()).Result;

            //Assert
            Assert.True(result == false);
        }
        public void TestFindTicketsReturnsNoMatches()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 24.00M, airline: "Bulgaria Air", flightNumber: "SV453");
            repository.AddBusTicket(from: "Varna", to: "Sofia", dateTime: new DateTime(2015, 1, 30, 11, 35, 00), price: 25.00M, travelCompany: "Biomet");
            repository.AddTrainTicket(from: "SOFIA", to: "VARNA", dateTime: new DateTime(2015, 1, 23, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddAirTicket(from: "sofia", to: "varna", dateTime: new DateTime(2015, 1, 24, 7, 40, 00), price: 24.00M, airline: "Bulgaria Air", flightNumber: "SV7023");
            repository.AddBusTicket(from: "Varna2", to: "Sofia2", dateTime: new DateTime(2015, 1, 25, 11, 35, 00), price: 25.00M, travelCompany: "Biomet");

            string cmdResult = repository.FindTickets(from: "Sofia", to: "Istanbul");

            Assert.AreEqual("No matches", cmdResult);
        }
예제 #49
0
 public MainViewModel(Page page)
 {
     this.page = page;
     username = string.Empty;
     password = string.Empty;
     storage = new Storage();
     client = new HelperClient();
     history = new History();
     history.Items = new List<Ticket>();
     Repository = new TicketRepository();
     tryGetCredentials();
     getTicketRepository();
     getUser();
     getHistory();
 }
        public void TestFindTicketsInIntervalReturnsNoMatches()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 24, 7, 40, 00), price: 24.00M, airline: "Bulgaria Air", flightNumber: "SV7023");
            repository.AddAirTicket(from: "Sofia", to: "Plovdiv", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 24.00M, airline: "Bulgaria Air", flightNumber: "SV453");
            repository.AddBusTicket(from: "Varna", to: "Pleven", dateTime: new DateTime(2015, 1, 30, 11, 35, 00), price: 25.00M, travelCompany: "Biomet");
            repository.AddTrainTicket(from: "Sofia", to: "Veliko Tarnovo", dateTime: new DateTime(2015, 1, 23, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddBusTicket(from: "Varna", to: "Sofia", dateTime: new DateTime(2015, 1, 25, 11, 35, 00), price: 25.00M, travelCompany: "Biomet");

            string cmdResult = repository.FindTicketsInInterval(
                startDateTime: new DateTime(2015, 1, 29, 7, 40, 01),
                endDateTime: new DateTime(2015, 1, 30, 11, 34, 59));

            Assert.AreEqual("No matches", cmdResult);
        }
        public void TestGetTicketsCountForDeletedTicketsReturnsZero()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 211.00M, airline: "New Air", flightNumber: "SV1234");
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet");
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Flight));
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Train));
            Assert.AreEqual(1, repository.GetTicketsCount(TicketType.Bus));

            repository.DeleteAirTicket(flightNumber: "SV1234");
            repository.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00));
            repository.DeleteBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), travelCompany: "Biomet");
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Flight));
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Train));
            Assert.AreEqual(0, repository.GetTicketsCount(TicketType.Bus));
        }
        public void TestFindTicketsInIntervalReturnsTickets()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 24, 7, 40, 00), price: 24.00M, airline: "Bulgaria Air", flightNumber: "SV7023");
            repository.AddAirTicket(from: "Sofia", to: "Plovdiv", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 24.00M, airline: "Bulgaria Air", flightNumber: "SV453");
            repository.AddBusTicket(from: "Varna", to: "Pleven", dateTime: new DateTime(2015, 1, 30, 11, 35, 00), price: 25.00M, travelCompany: "Biomet");
            repository.AddTrainTicket(from: "Sofia", to: "Veliko Tarnovo", dateTime: new DateTime(2015, 1, 23, 12, 55, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddBusTicket(from: "Varna", to: "Sofia", dateTime: new DateTime(2015, 1, 25, 11, 35, 00), price: 25.00M, travelCompany: "Biomet");

            string cmdResult = repository.FindTicketsInInterval(
                startDateTime: new DateTime(2015, 1, 29, 7, 40, 00),
                endDateTime: new DateTime(2015, 1, 30, 12, 55, 00));

            string expectedCmdResult =
                "[29.01.2015 07:40|flight|24.00] [30.01.2015 11:35|bus|25.00] [30.01.2015 12:55|train|26.00]";
            Assert.AreEqual(expectedCmdResult, cmdResult);
        }
        public void TestFindTicketsCheckCorrectSortingOrder()
        {
            ITicketRepository repository = new TicketRepository();
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 224.00M, airline: "Bulgaria Air", flightNumber: "SV453");
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 224.00M, airline: "Bulgaria Air", flightNumber: "SV453-2");
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 211.00M, airline: "New Air", flightNumber: "SV1234");
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 40, 00), price: 224.00M, airline: "Air BG", flightNumber: "S9473");
            repository.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 1224.00M, airline: "Air Travel Corp.", flightNumber: "V245X");

            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 26, 7, 40, 00), price: 24.00M, studentPrice: 16.30M);
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00), price: 26.00M, studentPrice: 16.30M);
            repository.AddTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 24, 7, 40, 00), price: 426.55M, studentPrice: 16.30M);

            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet");
            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet2");
            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 28.00M, travelCompany: "Etap");
            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 27, 7, 40, 00), price: 25.00M, travelCompany: "New Bus Corp.");
            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 5.72M, travelCompany: "Sofia Bus Ltd.");
            repository.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 1235.72M, travelCompany: "Varna Bus Travel Ltd.");

            string cmdResult = repository.FindTicketsInInterval(
                startDateTime: new DateTime(1980, 1, 1, 0, 0, 0),
                endDateTime: new DateTime(2050, 2, 1, 0, 0, 0));

            string expectedCmdResult =
                "[24.01.2015 07:40|train|426.55] " +
                "[26.01.2015 07:40|train|24.00] " +
                "[27.01.2015 07:40|bus|25.00] " +
                "[28.01.2015 07:40|flight|224.00] " +
                "[28.01.2015 07:45|train|26.00] " +
                "[29.01.2015 07:40|bus|5.72] " +
                "[29.01.2015 07:40|bus|25.00] " +
                "[29.01.2015 07:40|bus|25.00] " +
                "[29.01.2015 07:40|bus|28.00] " +
                "[29.01.2015 07:40|bus|1235.72] " +
                "[29.01.2015 07:40|flight|211.00] " +
                "[29.01.2015 07:40|flight|224.00] " +
                "[29.01.2015 07:40|flight|224.00] " +
                "[29.01.2015 07:40|flight|1224.00] " +
                "[29.01.2015 07:40|train|26.00]";
            Assert.AreEqual(expectedCmdResult, cmdResult);
        }
 public void TestInitialization()
 {
     this.repository = new TicketRepository();
 }
예제 #55
0
 public static ICRUDRepository<Ticket> GetTicketRepository()
 {
     if(TicketRepo == null)
     {
         TicketRepo = new TicketRepository();
     }
     return TicketRepo;
 }