public void TestGetTicketsCountForDeletedTicketsReturnsZero() { ITicketCatalog catalog = new TicketCatalog(); catalog.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 211.00M, airline: "New Air", flightNumber: "SV1234"); catalog.AddTrainTicket("Sofia", "Varna", new DateTime(2015, 1, 28, 7, 45, 00), 26.00M, 16.30M); catalog.AddBusTicket("Sofia", "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet"); Assert.AreEqual(1, catalog.GetTicketsCount(TicketType.Air)); Assert.AreEqual(1, catalog.GetTicketsCount(TicketType.Train)); Assert.AreEqual(1, catalog.GetTicketsCount(TicketType.Bus)); catalog.DeleteAirTicket("SV1234"); catalog.DeleteTrainTicket("Sofia", "Varna", new DateTime(2015, 1, 28, 7, 45, 00)); catalog.DeleteBusTicket("Sofia", "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), travelCompany: "Biomet"); Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Air)); Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Train)); Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Bus)); }
public void TestFindTicketsCheckDeletedTickets() { ITicketCatalog catalog = new TicketCatalog(); catalog.AddAirTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 211.00M, airline: "New Air", flightNumber: "SV1234"); catalog.AddTrainTicket("Sofia", "Varna", new DateTime(2015, 1, 28, 7, 45, 00), 26.00M, 16.30M); catalog.AddBusTicket("Sofia", "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet"); var cmdResult = catalog.FindTicketsInInterval(new DateTime(1980, 1, 1, 0, 0, 0), new DateTime(2050, 2, 1, 0, 0, 0)); var expectedCmdResult = "[28.01.2015 07:45; train; 26.00] " + "[29.01.2015 07:40; air; 211.00] " + "[29.01.2015 07:40; bus; 25.00]"; Assert.AreEqual(expectedCmdResult, cmdResult); catalog.DeleteAirTicket("SV1234"); catalog.DeleteTrainTicket("Sofia", "Varna", new DateTime(2015, 1, 28, 7, 45, 00)); catalog.DeleteBusTicket("Sofia", "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), travelCompany: "Biomet"); Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Air)); Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Train)); Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Bus)); var cmdResultFind = catalog.FindTicketsInInterval(new DateTime(1980, 1, 1, 0, 0, 0), new DateTime(2050, 2, 1, 0, 0, 0)); Assert.AreEqual("Not found", cmdResultFind); }