public void CreateNewTicketsRepositoryOperationTestExpectRepository() { var repository = new TicketRepository(); repository.AddAirTicket("AirBus", "NY", "NYC", "AirPesho", "27.01.2015 21:20", "120.60"); repository.AddBusTicket("Pavlikeni", "Razgrad", "TransAll", DateTime.Parse("27.01.2015 21:20"), 12.60M); repository.AddTrainTicket("Pavlikeni", "Razgrad", "27.01.2015 21:20", "21.10", "12.60"); Assert.IsNotNull(repository.TrainTicketsCount); Assert.IsNotNull(repository.AirTicketsCount); Assert.IsNotNull(repository.BusTicketsCount); repository.DeleteBusTicket("Pavlikeni", "Razgrad", "TransAll", DateTime.Parse("27.01.2015 21:20")); repository.DeleteTrainTicket("Pavlikeni", "Razgrad", DateTime.Parse("27.01.2015 21:20")); repository.DeleteAirTicket(repository.FindTickets("NY", "NYC")); Assert.AreEqual(0, repository.TrainTicketsCount); Assert.AreEqual(1, repository.AirTicketsCount); Assert.AreEqual(0, repository.BusTicketsCount); repository.FindTicketsInInterval(DateTime.Parse("25.01.2015 21:20"), DateTime.Parse("28.01.2015 21:20")); repository.AddAirTicket("AirBus", "NY", "NYC", "AirPesho", DateTime.Parse("27.01.2015 21:20"), 120.60M); repository.AddTrainTicket("Pavlikeni", "Razgrad", DateTime.Parse("27.01.2015 21:20"), 21.10M, 12.60M); repository.GetTicketsCount(TicketType.Bus); repository.GetTicketsCount(TicketType.Flight); repository.GetTicketsCount(TicketType.Train); }
public static void Main() { var ticketRepository = new TicketRepository(); while (true) { var line = Console.ReadLine(); if (line == null) { break; } line = line.Trim(); var commandResult = ticketRepository.ExecuteCommand(line); if (commandResult != null) { Console.WriteLine(commandResult); } } }