public void Tester() { var airport = new Airport(); var airplane = new LightAirplane(); var trip = new Trip("Yambol", "Sofia", airplane); for (int i = 0; i <= 5; i++) { var current = new Passenger("Passenger" + i); trip.Airplane.AddPassenger(current); airport.AddPassenger(current); } var passenger = airport.GetPassenger("Passenger1"); var bag = new Bag(passenger, new IItem[] { new Colombian() }); passenger.Bags.Add(bag); var completedTrip = new Trip("a", "b", new MediumAirplane()); completedTrip.Complete(); airport.AddTrip(trip); airport.AddTrip(completedTrip); var flightController = new FlightController(airport); var actualResult = flightController.TakeOff(); var expectedResult = "YambolSofia1:\r\nOverbooked! Ejected Passenger1\r\nConfiscated 1 bags ($50000)\r\nSuccessfully transported 5 passengers from Yambol to Sofia.\r\nConfiscated bags: 1 (1 items) => $50000"; Assert.That(trip.IsCompleted, Is.True); Assert.That(actualResult, Is.EqualTo(expectedResult)); }
public void SuccessfulTrip() { var passengers = new[] { new Passenger("Pesho1"), new Passenger("Pesho2"), new Passenger("Pesho3"), new Passenger("Pesho4"), new Passenger("Pesho5"), new Passenger("Pesho6"), }; var airplane = new LightAirplane(); foreach (var passenger in passengers) { airplane.AddPassenger(passenger); } var trip = new Trip("Sofia", "London", airplane); var airport = new Airport(); airport.AddTrip(trip); var flightController = new FlightController(airport); var bag = new Bag(passengers[1], new[] { new Colombian() }); passengers[1].Bags.Add(bag); var completedTrip = new Trip("Sofia", "Varna", new LightAirplane()); completedTrip.Complete(); airport.AddTrip(completedTrip); var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("SofiaLondon1:"); stringBuilder.AppendLine("Overbooked! Ejected Pesho2"); stringBuilder.AppendLine("Confiscated 1 bags ($50000)"); stringBuilder.AppendLine("Successfully transported 5 passengers from Sofia to London."); stringBuilder.AppendLine("Confiscated bags: 1 (1 items) => $50000"); var expectedResult = stringBuilder.ToString().TrimEnd(); var actualResult = flightController.TakeOff(); Assert.AreEqual(expectedResult, actualResult); Assert.IsTrue(trip.IsCompleted); }
public void TestWithTrips() { var ivan = new Passenger("Ivan"); var pesho = new Passenger("Pesho"); var maria = new Passenger("Maria"); var mario = new Passenger("Mario"); var emil = new Passenger("Emil"); var elena = new Passenger("Elena"); var bag = new Bag(pesho, new IItem[] { new Toothbrush(), new Laptop() }); pesho.Bags.Add(bag); var bagValue = bag.Items.Sum(x => x.Value); var airplane = new LightAirplane(); airplane.AddPassenger(ivan); airplane.AddPassenger(pesho); airplane.AddPassenger(maria); airplane.AddPassenger(mario); airplane.AddPassenger(emil); airplane.AddPassenger(elena); var trip1 = new Trip("Sofia", "London", airplane); var airport = new Airport(); airport.AddTrip(trip1); var trip2 = new Trip("Sofia", "Mascow", new LightAirplane()); trip2.Complete(); airport.AddTrip(trip2); var fc = new FlightController(airport); var sb = new StringBuilder(); sb.AppendLine("SofiaLondon1:"); sb.AppendLine($"Overbooked! Ejected Pesho"); sb.AppendLine($"Confiscated 1 bags (${bagValue})"); sb.AppendLine("Successfully transported 5 passengers from Sofia to London."); sb.AppendLine($"Confiscated bags: 1 (2 items) => ${bagValue}"); var actual = fc.TakeOff(); var expected = sb.ToString().TrimEnd(); Assert.That(actual, Is.EqualTo(expected)); Assert.That(trip1.IsCompleted, Is.True); }
// to test the TakeOff() method I need: // Airport // Trips // Airplane // Passenger // Bags -> items // trip.IsCompleted // if AppendLine trip.Id string is appended correctly // LoadCarryOnBaggage(trip) method // if airplane is overbooked - ejected message and the data // if trip is completed public void Test_IfTakeOffMethod_WorksProperly() { //test if completed var airport = new Airport(); // test if plane is overbooked //test load carry on baggage var plane = new LigthAirplane(); var passengers = new Passenger[10]; for (int i = 0; i < passengers.Length; i++) { passengers[i] = new Passenger("Gosho" + i); plane.AddPassenger(passengers[i]); } for (int i = 0; i < 5; i++) { if (i % 2 == 0) { var bag = new Bag(passengers[i], new Item[] { new Colombian() }); passengers[i].Bags.Add(bag); } else { var bag = new Bag(passengers[i], new Item[] { new Toothbrush() }); passengers[i].Bags.Add(bag); } } var trip = new Trip("Tuk", "Tam", plane); airport.AddTrip(trip); FlightController flightController = new FlightController(airport); var completedTrip = new Trip("tam", "tuk", new MediumAirplane()); //test isCompleted completedTrip.Complete(); airport.AddTrip(completedTrip); var actualResult = flightController.TakeOff(); var expectedResult = actualResult = "TukTam1:\r\nOverbooked! Ejected Gosho1, Gosho0, Gosho3, Gosho7, Gosho8\r\nConfiscated 3 bags ($50006)\r\nSuccessfully transported 5 passengers from Tuk to Tam.\r\nConfiscated bags: 3 (3 items) => $50006"; Assert.AreEqual(actualResult, expectedResult); Assert.AreEqual(trip.IsCompleted, true); }
public void SuccessfulTrip() { var passengers = new[] { new Passenger("Pesho1"), new Passenger("Pesho2"), new Passenger("Pesho3"), new Passenger("Pesho4"), new Passenger("Pesho5"), new Passenger("Pesho6"), }; var airplane = new LightAirplane(); foreach (var passenger in passengers) { airplane.AddPassenger(passenger); } var trip = new Trip("Sofia", "London", airplane); var airport = new Airport(); airport.AddTrip(trip); var flightController = new FlightController(airport); var bag = new Bag(passengers[1], new[] { new Colombian() }); passengers[1].Bags.Add(bag); var completedTrip = new Trip("Sofia", "Varna", new LightAirplane()); completedTrip.Complete(); airport.AddTrip(completedTrip); var actualResult = flightController.TakeOff(); var expectedResult = @"SofiaLondon1: Overbooked! Ejected Pesho2 Confiscated 1 bags ($50000) Successfully transported 5 passengers from Sofia to London. Confiscated bags: 1 (1 items) => $50000"; Assert.That(actualResult, Is.EqualTo(expectedResult).NoClip); Assert.That(trip.IsCompleted, Is.True); }
public void TestSuccessfulTakeOff() { IAirport airport = new Airport(); IAirplane airplane = new LightAirplane(); IPassenger passenger = new Passenger("Pesho"); IItem item = new Toothbrush(); IItem item2 = new Jewelery(); List <IItem> items = new List <IItem>(); items.Add(item); items.Add(item2); IBag bag = new Bag(passenger, items); airplane.AddPassenger(passenger); ITrip trip = new Trip("Sofia", "London", airplane); airport.AddTrip(trip); FlightController flight = new FlightController(airport); var actualResult = flight.TakeOff(); StringBuilder sb = new StringBuilder(); sb.AppendLine("SofiaLondon1:") .AppendLine("Successfully transported 1 passengers from Sofia to London.") .AppendLine("Confiscated bags: 0 (0 items) => $0"); var expectedResult = sb.ToString().Trim(); Assert.AreEqual(expectedResult, actualResult); }
public void TestLoadCarryOnBaggage() { IAirport airport = new Airport(); IAirplane airplane = new LightAirplane(); IPassenger[] passengers = new Passenger[10]; for (int i = 0; i < 10; i++) { passengers[i] = new Passenger("Pesho" + i); airplane.AddPassenger(passengers[i]); if (i % 2 == 0) { IBag bag = new Bag(passengers[i], new Item[] { new Colombian() }); passengers[i].Bags.Add(bag); } } ITrip trip = new Trip("Tuk", "Tam", airplane); airport.AddTrip(trip); IFlightController flightController = new FlightController(airport); string expectedResult = "TukTam3:\r\nOverbooked! Ejected Pesho1, Pesho0, Pesho3, Pesho7, Pesho8\r\nConfiscated 2 bags ($100000)\r\nSuccessfully transported 5 passengers from Tuk to Tam.\r\nConfiscated bags: 2 (2 items) => $100000"; string actualResult = flightController.TakeOff(); Assert.AreEqual(actualResult, expectedResult); }
public void Test4() { var passenger1 = new Passenger("Pesho"); var passenger2 = new Passenger("Gosho"); var passenger3 = new Passenger("CHefo"); var passenger4 = new Passenger("Aleksandar"); var passenger5 = new Passenger("Vankata"); var passenger6 = new Passenger("Niki"); var airport = new Airport(); var airplane = new LightAirplane(); airplane.AddPassenger(passenger1); airplane.AddPassenger(passenger2); airplane.AddPassenger(passenger3); airplane.AddPassenger(passenger4); airplane.AddPassenger(passenger5); airplane.AddPassenger(passenger6); var trip = new Trip("Peshtera", "Sofia", airplane); airport.AddTrip(trip); var flightController = new FlightController(airport); var output = flightController.TakeOff(); Assert.AreEqual("PeshteraSofia1:\r\nOverbooked! Ejected Gosho\r\nConfiscated 0 bags ($0)\r\nSuccessfully transported 5 passengers from Peshtera to Sofia.\r\nConfiscated bags: 0 (0 items) => $0", output); }
public void Test1() { IPassenger passenger1 = new Passenger("Pesho"); IBag bag1 = new Bag(passenger1, new IItem[] { new Toothbrush(), new Jewelery() }); IBag bag2 = new Bag(passenger1, new IItem[] { new CellPhone(), new Laptop() }); IAirplane airplane = new LightAirplane(); ITrip trip = new Trip("Sofia", "London", airplane); trip.Airplane.AddPassenger(passenger1); trip.Airplane.LoadBag(bag1); trip.Airplane.LoadBag(bag2); IAirport airport = new Airport(); airport.AddTrip(trip); airport.AddPassenger(passenger1); airport.AddCheckedBag(bag1); FlightController flightController = new FlightController(airport); string result = flightController.TakeOff(); string expectedResult = "SofiaLondon1:\r\n" + "Successfully transported 1 passengers from Sofia to London.\r\n" + "Confiscated bags: 0 (0 items) => $0"; Assert.That(result, Is.EqualTo(expectedResult)); }
public void TestIf_AirplaneIs_Overbooked() { //Arrange var airport = new Airport(); var plane = new LigthAirplane(); var trip = new Trip("Tuk", "Tam", plane); FlightController flightController = new FlightController(airport); //Act var passengers = new Passenger[10]; for (int i = 0; i < passengers.Length; i++) { passengers[i] = new Passenger("Gosho" + i); plane.AddPassenger(passengers[i]); } airport.AddTrip(trip); var expected = flightController.TakeOff(); var actual = "TukTam1:\r\nOverbooked! Ejected Gosho1, Gosho0, Gosho3, Gosho7, Gosho8\r\nConfiscated 0 bags ($0)\r\nSuccessfully transported 5 passengers from Tuk to Tam.\r\nConfiscated bags: 0 (0 items) => $0"; //Assert Assert.AreEqual(expected, actual); Assert.AreEqual(trip.IsCompleted, true); }
public void Test5() { var passenger1 = new Passenger("Pesho"); var passenger2 = new Passenger("Gosho"); var passenger3 = new Passenger("CHefo"); var passenger4 = new Passenger("Aleksandar"); var passenger5 = new Passenger("Vankata"); var passenger6 = new Passenger("Niki"); var airport = new Airport(); var airplane = new LightAirplane(); airplane.AddPassenger(passenger1); airplane.AddPassenger(passenger2); airplane.AddPassenger(passenger3); airplane.AddPassenger(passenger4); airplane.AddPassenger(passenger5); airplane.AddPassenger(passenger6); var trip = new Trip("Peshtera", "Sofia", airplane); airport.AddTrip(trip); var flightController = new FlightController(airport); flightController.TakeOff(); Assert.AreEqual(trip.IsCompleted, true); }
public void Test8() { var passenger1 = new Passenger("Pesho"); var passenger2 = new Passenger("Gosho"); var passenger3 = new Passenger("CHefo"); var passenger4 = new Passenger("Aleksandar"); var passenger5 = new Passenger("Vankata"); var passenger6 = new Passenger("Niki"); var airport = new Airport(); var airplane = new LightAirplane(); airplane.AddPassenger(passenger1); airplane.AddPassenger(passenger2); airplane.AddPassenger(passenger3); airplane.AddPassenger(passenger4); airplane.AddPassenger(passenger5); airplane.AddPassenger(passenger6); var item = new Jewelery(); var items = new List <Item>(); items.Add(item); var bag = new Bag(passenger1, items); passenger1.Bags.Add(bag); airport.AddConfiscatedBag(bag); var trip = new Trip("Peshtera", "Sofia", airplane); airport.AddTrip(trip); var flightController = new FlightController(airport); flightController.TakeOff(); Assert.AreEqual(airport.ConfiscatedBags.Count, 1); }
public void CheckTakeOffCompletesTrip(string source, string destination, int passagersCount) { IAirport airport = new Airport(); FlightController fcTest = new FlightController(airport); IAirplane mediumAirplane = new MediumAirplane(); IPassenger passenger = new Passenger("traveler11"); for (int i = 0; i < passagersCount; i++) { mediumAirplane.AddPassenger(passenger); } ITrip trip = new Trip(source, destination, mediumAirplane); airport.AddTrip(trip); Assert.IsFalse(trip.IsCompleted, "Initially trip is set to completed instead of not completed!"); string actualResultMessage = fcTest.TakeOff(); string expectedMessage = $"{trip.Id}:\r\nSuccessfully transported {passagersCount} passengers from {source} to {destination}.\r\nConfiscated bags: 0 (0 items) => $0"; Assert.AreEqual(expectedMessage, actualResultMessage); Assert.IsTrue(trip.IsCompleted, "TakeOff does not complete trip"); }
public void TestIfAirplaneIsOverbooked() { var airport = new Airport(); var airplane = new LightAirplane(); var flightController = new FlightController(airport); List <Passenger> passengers = new List <Passenger>(); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); passengers.Add(new Passenger("Gsoho")); foreach (var item in passengers) { airplane.AddPassenger(item); } Trip trip = new Trip("Tuk", "tam", airplane); airport.AddTrip(trip); var actualResult = flightController.TakeOff(); var expectedResult = "Tuktam3:\r\nOverbooked! Ejected Gsoho, Gsoho, Gsoho, Gsoho, Gsoho\r\nConfiscated 0 bags ($0)\r\nSuccessfully transported 5 passengers from Tuk to tam.\r\nConfiscated bags: 0 (0 items) => $0"; Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(trip.IsCompleted, true); }
public void Test2() { IAirport airport = new Airport(); Trip trip = new Trip("Sofia", "Honolulu", new LightAirplane()); Trip trip2 = new Trip("SampleTown", "SampleTown2", new MediumAirplane()); trip2.Complete(); Passenger passenger6 = new Passenger("Dani3"); passenger6.Bags.Add(new Bag(passenger6, new IItem[] { new CellPhone() })); Passenger passenger7 = new Passenger("Dani3"); passenger7.Bags.Add(new Bag(passenger7, new IItem[] { new CellPhone() })); Passenger passenger8 = new Passenger("Dani3"); passenger8.Bags.Add(new Bag(passenger8, new IItem[] { new CellPhone() })); Passenger passenger9 = new Passenger("Dani3"); passenger9.Bags.Add(new Bag(passenger9, new IItem[] { new CellPhone() })); Passenger passenger10 = new Passenger("Dani3"); passenger10.Bags.Add(new Bag(passenger10, new IItem[] { new CellPhone() })); Passenger passenger11 = new Passenger("Dani3"); passenger11.Bags.Add(new Bag(passenger11, new IItem[] { new CellPhone() })); trip.Airplane.AddPassenger(passenger6); trip.Airplane.AddPassenger(passenger7); trip.Airplane.AddPassenger(passenger8); trip.Airplane.AddPassenger(passenger9); trip.Airplane.AddPassenger(passenger10); trip.Airplane.AddPassenger(passenger11); airport.AddTrip(trip); airport.AddTrip(trip2); FlightController flightController = new FlightController(airport); string actualResult = flightController.TakeOff(); string expectedResult = "SofiaHonolulu3:\r\nOverbooked! Ejected Dani3\r\nConfiscated 1 bags ($700)\r\nSuccessfully transported 5 passengers from Sofia to Honolulu.\r\nConfiscated bags: 1 (1 items) => $700"; Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(trip.Airplane.Passengers.Count, 5); Assert.AreEqual(trip.IsCompleted, true); }
public void SuccessfulTrip() { var passengers = new[] { new Passenger("Westside1"), new Passenger("Westside2"), new Passenger("Westside3"), new Passenger("Westside4"), new Passenger("Westside5"), new Passenger("Westside6") }; Airplane airplane = new LightAirplane(); foreach (var passenger in passengers) { airplane.AddPassenger(passenger); } Trip trip = new Trip("Sofia", "London", airplane); Airport airport = new Airport(); airport.AddTrip(trip); var bag = new Bag(passengers[1], new[] { new Colombian() }); passengers[1].Bags.Add(bag); var completedTrip = new Trip("Sofia", "Manchester", airplane); completedTrip.Complete(); airport.AddTrip(completedTrip); var flightController = new FlightController(airport); var actualResult = flightController.TakeOff(); var expectedResult = @"SofiaLondon1: Overbooked! Ejected Westside2 Confiscated 1 bags ($50000) Successfully transported 5 passengers from Sofia to London. Confiscated bags: 1 (1 items) => $50000"; Assert.AreEqual(expectedResult, actualResult); Assert.That(trip.IsCompleted, Is.True); }
public void ValidateTakeoffMethod() { var airport = new Airport(); var airplane = new LightAirplane(); var passengers = new Passenger[10]; for (int i = 0; i < passengers.Length; i++) { passengers[i] = new Passenger("Todor" + i); airplane.AddPassenger(passengers[i]); } for (int i = 0; i < 5; i++) { if (i % 2 == 0) { var bag = new Bag(passengers[i], new Item[] { new Colombian() }); passengers[i].Bags.Add(bag); } else { var bag = new Bag(passengers[i], new Item[] { new Toothbrush() }); passengers[i].Bags.Add(bag); } } var trip = new Trip("Sofiq", "Varna", airplane); airport.AddTrip(trip); var complatedTrip = new Trip("Varna", "Sofiq", new MediumAirplane()); complatedTrip.Complete(); airport.AddTrip(complatedTrip); FlightController flightController = new FlightController(airport); var actualResult = flightController.TakeOff(); var expectedResult = "SofiqVarna1:\r\nOverbooked! Ejected Todor1, Todor0, Todor3, Todor7, Todor8\r\nConfiscated 3 bags ($50006)\r\nSuccessfully transported 5 passengers from Sofiq to Varna.\r\nConfiscated bags: 3 (3 items) => $50006"; Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(trip.IsCompleted, true); }
public void SetUp() { airport = new Airport(); flightController = new FlightController(airport); this.airplane = new LightAirplane(); this.trip = new Trip("Sofia", "Plovdiv", airplane); airport.AddTrip(trip); }
public void SuccesfullFlight() { var airport = new Airport(); var flightController = new FlightController(airport); var airplane = new LightAirplane(); var trip = new Trip("Plovdiv", "Las Vegas", airplane); List <Passenger> passengers = new List <Passenger>() { new Passenger("Pesho"), new Passenger("Gosho"), new Passenger("Ivan"), new Passenger("Maria"), new Passenger("Stamat"), new Passenger("Kiro") }; passengers.ForEach(p => airplane.AddPassenger(p)); var bag = new Bag(passengers[1], new[] { new Colombian() }); passengers[1].Bags.Add(bag); airport.AddTrip(trip); var completedTrip = new Trip("LA", "Sofia", new LightAirplane()); completedTrip.Complete(); airport.AddTrip(completedTrip); var actualResult = flightController.TakeOff(); var expectedResult = @"PlovdivLas Vegas1: Overbooked! Ejected Gosho Confiscated 1 bags ($50000) Successfully transported 5 passengers from Plovdiv to Las Vegas. Confiscated bags: 1 (1 items) => $50000"; Assert.That(actualResult, Is.EqualTo(expectedResult).NoClip); Assert.That(trip.IsCompleted, Is.True); }
public void SuccessfulTrip() { IPassenger[] passengers = new IPassenger[10]; for (int i = 0; i < passengers.Length;) { passengers[i] = new Passenger($"Passenger{++i}"); } var airplane = new LightAirplane(); foreach (var passenger in passengers) { airplane.AddPassenger(passenger); } var trip = new Trip("Sofia", "London", airplane); var airport = new Airport(); airport.AddTrip(trip); var flightController = new FlightController(airport); var bag = new Bag(passengers[1], new[] { new Colombian() }); passengers[1].Bags.Add(bag); var completedTrip = new Trip("Sofia", "Varna", new LightAirplane()); completedTrip.Complete(); airport.AddTrip(completedTrip); var actualResult = flightController.TakeOff(); var expectedResult = "SofiaLondon1:\r\nOverbooked! Ejected Passenger2, Passenger1, Passenger4, Passenger8, Passenger9\r\nConfiscated 1 bags ($50000)\r\nSuccessfully transported 5 passengers from Sofia to London.\r\nConfiscated bags: 1 (1 items) => $50000"; Assert.That(actualResult, Is.EqualTo(expectedResult)); Assert.That(trip.IsCompleted, Is.True); }
public void CheckIfTripIsCompleted() { var airplane = new LightAirplane(); Trip trip = new Trip("Tuk", "Tam", airplane); var passenger = new Passenger("Gosho"); var bag = new Bag(passenger, new Item[] { new Toothbrush() }); passenger.Bags.Add(bag); airport.AddTrip(trip); trip.Complete(); var flightController = new FlightController(airport); var expectedResult = flightController.TakeOff(); var actualResult = "Confiscated bags: 0 (0 items) => $0"; Assert.AreEqual(expectedResult, actualResult); }
public void ShouldNotTryToCompleteCompletedTrip() { trip.Complete(); airplane.AddPassenger(new Passenger("Name")); airport.AddTrip(new Trip("Sofia", "Plovdiv", airplane)); string result = flightController.TakeOff(); string expectedResult = "SofiaPlovdiv3:\r\nSuccessfully transported 1 passengers from Sofia to Plovdiv.\r\nConfiscated bags: 0 (0 items) => $0"; Assert.AreEqual(expectedResult, result); }
public void TakeOfReturnsCorrectString() { IAirport airport = new Airport(); airport.AddTrip(new Trip("source", "Destination", new LightAirplane())); airport.AddPassenger(new Passenger("az")); airport.AddPassenger(new Passenger("ti")); IFlightController flightController = new FlightController(airport); string result = flightController.TakeOff(); Assert.That(result, Is.EqualTo("sourceDestination2:\r\nSuccessfully transported 0 passengers from source to Destination.\r\nConfiscated bags: 0 (0 items) => $0")); }
public void Test3() { var airport = new Airport(); var airplane = new LightAirplane(); var trip = new Trip("Peshtera", "Sofia", airplane); airport.AddTrip(trip); var flightController = new FlightController(airport); var output = flightController.TakeOff(); Assert.AreEqual("PeshteraSofia1:\r\nSuccessfully transported 0 passengers from Peshtera to Sofia.\r\nConfiscated bags: 0 (0 items) => $0", output); }
public void Test1() { IAirport airport = new Airport(); Trip trip = new Trip("Sofia", "Honolulu", new LightAirplane()); Trip trip2 = new Trip("SampleTown", "SampleTown2", new MediumAirplane()); trip2.Complete(); Passenger passenger1 = new Passenger("Dani"); passenger1.Bags.Add(new Bag(passenger1, new IItem[] { new Toothbrush(), new CellPhone() })); trip.Airplane.AddPassenger(passenger1); airport.AddTrip(trip); airport.AddTrip(trip2); FlightController flightController = new FlightController(airport); string actualResult = flightController.TakeOff(); string expectedResult = "SofiaHonolulu1:\r\n" + "Successfully transported 1 passengers from Sofia to Honolulu.\r\n" + "Confiscated bags: 0 (0 items) => $0"; Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(1, airport.Trips.First().Airplane.BaggageCompartment.Count); }
public void Test2() { var airport = new Airport(); var airplane = new LightAirplane(); var trip = new Trip("Peshtera", "Sofia", airplane); trip.Complete(); airport.AddTrip(trip); var flightController = new FlightController(airport); var output = flightController.TakeOff(); Assert.AreEqual("Confiscated bags: 0 (0 items) => $0", output); }
public void Test1() { IAirplane plane = new LightAirplane(); IPassenger pasenger = new Passenger("Pesho2"); plane.AddPassenger(new Passenger("Pesho1")); plane.AddPassenger(pasenger); plane.AddPassenger(new Passenger("Pesho3")); plane.AddPassenger(new Passenger("Pesho4")); plane.AddPassenger(new Passenger("Pesho5")); plane.AddPassenger(new Passenger("Pesho6")); ITrip trip = new Trip("Sofia", "London", plane); IAirport airport = new Airport(); airport.AddTrip(trip); IFlightController flightController = new FlightController(airport); IBag bag = new Bag(pasenger, new IItem[] { new Colombian() }); pasenger.Bags.Add(bag); ITrip completedTrip = new Trip("London", "Sofia", new LightAirplane()); completedTrip.Complete(); airport.AddTrip(completedTrip); string actual = flightController.TakeOff(); string expected = "SofiaLondon1:\r\nOverbooked! Ejected Pesho2\r\nConfiscated 1 bags ($50000)\r\nSuccessfully transported 5 passengers from Sofia to London.\r\nConfiscated bags: 1 (1 items) => $50000"; Assert.That(actual, Is.EqualTo(expected)); Assert.That(trip.IsCompleted, Is.True); }
public void CheckIfTripIsCompleted() { IAirport airport = new Airport(); IAirplane airplane = new LightAirplane(); ITrip trip = new Trip("Tuk", "Tam", airplane); airplane.AddPassenger(new Passenger("Pesho1")); airport.AddTrip(trip); trip.Complete(); IFlightController flightController = new FlightController(airport); string expectedResult = "Confiscated bags: 0 (0 items) => $0"; string actualResult = flightController.TakeOff(); Assert.AreEqual(expectedResult, actualResult); }
public void TestController() { var airplaneFactory = new AirplaneFactory(); var trip = new Trip("Sofia", "London", airplaneFactory.CreateAirplane("LightAirplane")); var airport = new Airport(); airport.AddTrip(trip); var flightController = new FlightController(airport); var result = flightController.TakeOff(); var expectedResult = "SofiaLondon1"; Assert.AreEqual(result, expectedResult); }
public void CheckTakeOffCompletedFlightsNotMatter(string source, string destination) { IAirport airport = new Airport(); FlightController fcTest = new FlightController(airport); IAirplane mediumAirplane = new MediumAirplane(); ITrip trip = new Trip(source, destination, mediumAirplane); airport.AddTrip(trip); trip.Complete(); string actualResult = fcTest.TakeOff(); string expectedMessage = "Confiscated bags: 0 (0 items) => $0"; Assert.AreEqual(expectedMessage, actualResult); }