public void StarshipBusinessLogic_NumberOfJumps_When1000000YWing_Then74()
        {
            // Arrange
            var starShip = new Starship("Y-wing")
            {
                ConsumablesHours = 168,
                MGLT             = 80
            };
            //Act
            var jumps = starshipBusinessLogicUT.GetNumberOfJumps(starShip, 1000000);

            // Assert
            Assert.AreEqual(74, jumps);
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Which is the distance to jump?");
            var distance = Console.ReadLine();
            int travelDistance;

            if (int.TryParse(distance, out travelDistance))
            {
                var starshipBL = new StarshipBusinessLogic(new StarshipMapper(), new StarshipDataService(new HttpClientHandler(), new AppConfigurationManager()));
                var starships  = starshipBL.GetAll();

                foreach (var starship in starships)
                {
                    var numberOfJumps = starshipBL.GetNumberOfJumps(starship, travelDistance);
                    Console.WriteLine("Name:{0}.\tNumber of jumps:{1}", starship.Name, numberOfJumps);
                }
            }
            else
            {
                Console.WriteLine("The distance entered {0} is not a number", distance);
            }
            Console.WriteLine("Press any key to finish");
            Console.ReadKey();
        }