public void Voyage_CalculateNumberOfStopsForStarship_DistanceTillRefuelHasValue_NumberOfStopsReturned() { // Arrange var distanceToTravel = 1000000; var starshipA = new Starship() { Consumables = "1 year", MegaLights = "75" }; var starshipB = new Starship() { Consumables = "8 weeks", MegaLights = "50" }; // Act var voyageA = new Voyage(starshipA); var voyageB = new Voyage(starshipB); // Assert Assert.AreEqual(1, voyageA.CalculateNumberOfStopsForStarship(distanceToTravel)); Assert.AreEqual(14, voyageB.CalculateNumberOfStopsForStarship(distanceToTravel)); }
public void Voyage_CalculateNumberOfStopsForStarship_DistanceTillRefuelIsZero_ZeroReturned() { // Arrange var distanceToTravel = 10000; var starship = new Starship() { Consumables = "1 unknown", MegaLights = "40" }; // Act var voyage = new Voyage(starship); // Assert Assert.AreEqual(0, voyage.CalculateNumberOfStopsForStarship(distanceToTravel)); }
public static void PrintStarships(int distanceToTravel) { // Create a new instance of the starships repository IRepository <Starship> starshipRepo = new Repository <Starship>(); // Get all the pages of the starships entities var starships = starshipRepo.GetEntities(1, 10); // For each of the given starships get the number of stops and print to the console foreach (var starship in starships) { var voyage = new Voyage(starship); Console.WriteLine(starship.Name + ": " + voyage.CalculateNumberOfStopsForStarship(distanceToTravel) + " stops."); } }