public void TestThatFlightHasCorrectBasePriceFor20DayFlight() { DateTime dateTestFlightLeaves = new DateTime(2011, 3, 18); DateTime dateTestFlightReturns = new DateTime(2011, 4, 7); var target = new Flight(dateTestFlightLeaves, dateTestFlightReturns, someMiles); Assert.AreEqual(600, target.getBasePrice()); }
public void TestThatFlightHasCorrectBasePriceForTwoDays() { DateTime start = new DateTime(2005, 9, 17); DateTime end = new DateTime(2005, 9, 19); var target = new Flight(start, end, 500); Assert.AreEqual(240, target.getBasePrice()); }
public void TestThatTwoFlightsAreEqual() { var flightOne = new Flight(StartTime, EndTime, miles); var flightTwo = new Flight(StartTime, EndTime, miles); Assert.True(flightOne.Equals(flightTwo)); }
public void TestThatFlightHasIncorrectBasePriceFor1DayFlight() { DateTime dateTestFlightLeaves = new DateTime(2011, 3, 18); DateTime dateTestFlightReturns = new DateTime(2011, 3, 19); var target = new Flight(dateTestFlightLeaves, dateTestFlightReturns, someMiles); Assert.AreNotEqual(230, target.getBasePrice()); }
public void TestThatAFlightDoesNotEqualAnotherObject() { var flight = new Flight(StartTime, EndTime, miles); var hotel = new Hotel(5); Assert.False(flight.Equals(hotel)); }
public void TestThatFlightsWithDifferentStartDatesAreNotEqual() { var f1 = new Flight(new DateTime(2014, 1, 1), ValidEndDate, ValidMiles); var f2 = new Flight(new DateTime(2014, 1, 2), ValidEndDate, ValidMiles); Assert.AreNotEqual(f1, f2); }
public void TestThatFlightsWithDifferentMilesAreNotEqual() { var f1 = new Flight(ValidStartDate, ValidEndDate, 1); var f2 = new Flight(ValidStartDate, ValidEndDate, 2); Assert.AreNotEqual(f1, f2); }
public void TestThatFlightHasCorrectBasePriceForTravelOnSameDay() { DateTime dateFlightLeaves = new DateTime(2012, 1, 1); DateTime dateFlightReturns = new DateTime(2012, 1, 1); var target = new Flight(dateFlightLeaves, dateFlightReturns, mileage); Assert.AreEqual(200, target.getBasePrice()); }
public void TesThatFlightHasCorrectBasePriceForOneDayFlight() { DateTime dateTestFlightLeaves = new DateTime(2010, 1, 18); DateTime dateTestFlightReturns = new DateTime(2010, 1, 19); var target = new Flight(dateTestFlightLeaves, dateTestFlightReturns, someMiles); Assert.AreEqual(220, target.getBasePrice()); }
public void TestThatFlightInitializes() { DateTime startDate = new DateTime(2012, 3, 4); DateTime endDate = new DateTime(2012, 3, 7); var target = new Flight(startDate, endDate, 5); Assert.IsNotNull(target); }
public void TestThatFlightBookingPriceCorrectZeroDayDifference() { DateTime startDate = new DateTime(2012, 3, 4); DateTime endDate = new DateTime(2012, 3, 4); var target = new Flight(startDate, endDate, 5); Assert.AreEqual(200, target.getBasePrice()); }
public void TestFlightNotEqualToOtherObject() { var f1 = new Flight(ValidStartDate, ValidEndDate, ValidMiles); var o2 = new Object(); Assert.AreNotEqual(f1, o2); }
public void TestEqualsMethodWithTwoDifferentFlights() { Flight flight1 = new Flight(startDate, endDate, 500); Flight flight2 = new Flight(startDate, endDate, 100); Assert.False(flight1.Equals(flight2)); }
public void TestEqualsMethodWithTwoEquivalentFlights() { Flight flight1 = new Flight(startDate, endDate, someMiles); Flight flight2 = new Flight(startDate, endDate, someMiles); Assert.True(flight1.Equals(flight2)); }
public void TestSameFlightsAreEqual() { var f1 = new Flight(ValidStartDate, ValidEndDate, ValidMiles); var f2 = new Flight(ValidStartDate, ValidEndDate, ValidMiles); Assert.AreEqual(f1, f2); }
public void TestFlightsInequalityDueToStartDate() { DateTime rDate = DateTime.Now.AddDays(10); var target1 = new Flight(DateTime.Now, rDate, 10); var target2 = new Flight(DateTime.Now, rDate, 10); Assert.IsFalse(target1.Equals(target2)); }
public void TestFlightsInequalityDueToEndDate() { DateTime sDate = DateTime.Now; var target1 = new Flight(sDate, DateTime.Now.AddDays(10), 10); var target2 = new Flight(sDate, DateTime.Now.AddDays(10), 10); Assert.IsFalse(target1.Equals(target2)); }
public void TestThatFlightInitializes() { DateTime StartDate = new DateTime(2009, 11, 1); DateTime EndDate = new DateTime(2009, 11, 1); var target = new Flight(StartDate, EndDate, 700); Assert.IsNotNull(target); }
private bool Equals(Flight obj) { bool l = obj.dateThatFlightLeaves.Equals(this.dateThatFlightLeaves); bool r = obj.dateThatFlightReturns.Equals(this.dateThatFlightReturns); bool m = obj.Miles.Equals(this.Miles); return l && r && m; }
public void TestThatFlightThrowsOnBadDistance() { var start = new DateTime(1999, 1, 1); var end = new DateTime(1999, 1, 2); int miles = -5; var target = new Flight(start, end, miles); }
public void TestThatFlightStoresMiles() { DateTime startDate = new DateTime(2012, 3, 4); DateTime endDate = new DateTime(2012, 3, 7); var target = new Flight(startDate, endDate, 5); Assert.AreEqual(5, target.Miles); }
public void TestFlightsInequalityDueToMiles() { DateTime sDate = DateTime.Now; DateTime rDate = DateTime.Now.AddDays(10); Flight target1 = new Flight(sDate, rDate, 10); Flight target2 = new Flight(sDate, rDate, 20); Assert.IsFalse(target1.Equals(target2)); }
public void TestFlightsEquality() { DateTime sDate = DateTime.Now; DateTime rDate = DateTime.Now.AddDays(10); Flight target1 = new Flight(sDate, rDate, 10); Flight target2 = new Flight(sDate, rDate, 10); Assert.IsTrue(target1.Equals(target2)); }
public void TestThatFlightHasCorrectBasePriceForTwoDayTrip() { var start = new DateTime(1999, 1, 1); var end = new DateTime(1999, 1, 3); int miles = 100; var target = new Flight(start, end, miles); Assert.AreEqual(240, target.getBasePrice()); }
public void TestThatFlightEqualsWorks() { var target = new Flight(System.DateTime.Today, System.DateTime.Parse("10/5/2012"), 100); var target2 = new Flight(System.DateTime.Today, System.DateTime.Parse("10/5/2012"), 100); var target3 = new Flight(System.DateTime.Today, System.DateTime.Parse("10/6/2012"), 100); Assert.True(target.Equals(target2)); Assert.False(target.Equals(target3)); }
public void TestFlightEqualsTrue() { DateTime StartDate = new DateTime(2009, 11, 1); DateTime EndDate = new DateTime(2009, 11, 1); var target = new Flight(StartDate, EndDate, 700); var target2 = new Flight(StartDate, EndDate, 700); Assert.True(target.Equals(target2)); }
public void TestEquals() { var target1 = new Flight(startDate, endDate, someMiles); var target2 = new Flight(startDate, endDate, someMiles); var target3 = new Flight(startDate, new DateTime(2011, 3, 26), someMiles); Assert.AreEqual(target1, target2); Assert.AreNotEqual(target1, target3); }
public void TestThatFlightlInitializes() { var start = new DateTime(1999, 1, 1); var end = new DateTime(1999, 2, 1); int miles = 100; var target = new Flight(start, end, miles); Assert.IsNotNull(target); }
public void TestThatServiceLocatorAvailableFlightsReturnsExpectedFlights() { var firstFlight = new Flight(DateTime.Today, DateTime.Today.AddDays(1), 500); var secondFlight = new Flight(DateTime.Today, DateTime.Today.AddDays(3), 200); var locator = new ServiceLocator(); locator.AddFlight(firstFlight); locator.AddFlight(secondFlight); Assert.AreSame(firstFlight, locator.AvailableFlights[0]); Assert.AreSame(secondFlight, locator.AvailableFlights[1]); Assert.AreEqual(2, locator.AvailableFlights.Count); }
public void TestThatUserDoesRemovveFlightFromServiceLocatorWhenBooked() { ServiceLocator serviceLocator = new ServiceLocator(); var flightToBook = new Flight(new DateTime(2009, 11, 1), new DateTime(2009, 11, 30), 750); var remainingFlight = new Flight(new DateTime(2009, 11, 2), new DateTime(2009, 11, 28), 500); serviceLocator.AddFlight(flightToBook); serviceLocator.AddFlight(remainingFlight); typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator); var target = new User("Bob"); target.book(flightToBook); Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count); Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]); }