public void TestDeleteDeletedAirTicketReturnsTickedDoesNotExist()
        {
            ITicketCatalog catalog = new TicketCatalog();
            catalog.AddAirTicket(flightNumber: "FX215", from: "Sofia", to: "Varna", airline: "Bulgaria Air", dateTime: new DateTime(2015, 1, 30, 12, 55, 00), price: 130.50M);
            catalog.DeleteAirTicket(flightNumber: "FX215");

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

            Assert.AreEqual("Ticket does not exist", cmdResult);
            Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Air));
        }
        public void TestDeleteDeletedAirTicketReturnsTickedDoesNotExist()
        {
            ITicketCatalog catalog = new TicketCatalog();

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

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

            Assert.AreEqual("Ticket does not exist", cmdResult);
            Assert.AreEqual(0, catalog.GetTicketsCount(TicketType.Air));
        }
Ejemplo n.º 3
0
        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(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00), price: 26.00M, studentPrice: 16.30M);
            catalog.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet");
            string cmdResult = catalog.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; air; 211.00] " +
                "[29.01.2015 07:40; bus; 25.00]";

            Assert.AreEqual(expectedCmdResult, cmdResult);

            catalog.DeleteAirTicket(flightNumber: "SV1234");
            catalog.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00));
            catalog.DeleteBusTicket(from: "Sofia", to: "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));
            string cmdResultFind = catalog.FindTicketsInInterval(
                startDateTime: new DateTime(1980, 1, 1, 0, 0, 0),
                endDateTime: new DateTime(2050, 2, 1, 0, 0, 0));

            Assert.AreEqual("Not found", cmdResultFind);
        }
        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(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00), price: 26.00M, studentPrice: 16.30M);
            catalog.AddBusTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 29, 7, 40, 00), price: 25.00M, travelCompany: "Biomet");
            string cmdResult = catalog.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; air; 211.00] " +
                "[29.01.2015 07:40; bus; 25.00]";
            Assert.AreEqual(expectedCmdResult, cmdResult);

            catalog.DeleteAirTicket(flightNumber: "SV1234");
            catalog.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00));
            catalog.DeleteBusTicket(from: "Sofia", to: "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));
            string cmdResultFind = catalog.FindTicketsInInterval(
                startDateTime: new DateTime(1980, 1, 1, 0, 0, 0),
                endDateTime: new DateTime(2050, 2, 1, 0, 0, 0));
            Assert.AreEqual("Not found", cmdResultFind);
        }
        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(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00), price: 26.00M, studentPrice: 16.30M);
            catalog.AddBusTicket(from: "Sofia", to: "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(flightNumber: "SV1234");
            catalog.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00));
            catalog.DeleteBusTicket(from: "Sofia", to: "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 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(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00), price: 26.00M, studentPrice: 16.30M);
            catalog.AddBusTicket(from: "Sofia", to: "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(flightNumber: "SV1234");
            catalog.DeleteTrainTicket(from: "Sofia", to: "Varna", dateTime: new DateTime(2015, 1, 28, 7, 45, 00));
            catalog.DeleteBusTicket(from: "Sofia", to: "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));
        }
Ejemplo n.º 7
0
 public void DeleteAnAirTicketThatDoNotExistShouldReturnMessage()
 {
     var catalog = new TicketCatalog();
     var flightNumber = "LZ001";
     var origin = "Sofia";
     var destination = "Marocco";
     string airline = "Balkan";
     var departureDate = new DateTime(2012, 01, 20, 10, 10, 10);
     decimal price = 100m;
     var airTicket = catalog.AddAirTicket(flightNumber, origin, destination, airline, departureDate, price);
     Assert.AreEqual(1, catalog.GetTicketsCount(TicketType.Air));
     var actualMessage = catalog.DeleteAirTicket("MH1001");
     string expectedMessage = "Ticket does not exist";
     Assert.AreEqual(expectedMessage, actualMessage);
 }