Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            WriteHeader();
            var input = Console.ReadLine();

            while (input != "q")
            {
                Console.Clear();
                ulong distance = ulong.TryParse(input, out distance) ? distance : 1000000;

                Console.WriteLine("------------------------------------------------");
                Console.WriteLine($"Calculating Starships stops to: {distance} MGLT");
                Console.WriteLine("------------------------------------------------");
                List <StarshipModel> calculatedStops = StarshipBusiness.GetStarshipStops(distance);
                Console.Clear();

                Console.WriteLine("------------------------------------------------");
                Console.WriteLine($"Calculated Starships stops to: {distance} MGLT");
                Console.WriteLine("------------------------------------------------");
                calculatedStops.Where(x => x.stops > 0).ToList().ForEach(x => Console.WriteLine($"{x.name}: {x.stops}"));

                Console.WriteLine("-----------------------------------------------------------------");
                Console.WriteLine("\nThe Starships below do not have enough information to calculate:");
                Console.WriteLine("-----------------------------------------------------------------");
                calculatedStops.Where(x => x.stops == 0).ToList().ForEach(x => Console.WriteLine($"{x.name}: {x.stops}"));

                WriteHeader();
                input = Console.ReadLine();
            }

            Console.Clear();
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("Thank you, I hope you enjoyed!");
            Console.WriteLine("------------------------------------------");
        }
Exemplo n.º 2
0
        public void Should_GetStarshipStops_Bring_Results()
        {
            System.Collections.Generic.List <Models.StarshipModel> returnValue = StarshipBusiness.GetStarshipStops(200);

            Assert.IsNotNull(returnValue);
            Assert.Pass("OK for GetStarshipStops Should Bring Results test");
        }
Exemplo n.º 3
0
        public void Should_GetStarshipStop_Rebel_Transport_Stops_11_Times()
        {
            System.Collections.Generic.List <Models.StarshipModel> returnValue = StarshipBusiness.GetStarshipStops(1000000);
            Assert.IsNotNull(returnValue);

            Models.StarshipModel ywing = returnValue.FirstOrDefault(x => x.name.ToLower() == "rebel transport");

            Assert.IsNotNull(ywing);
            Assert.AreEqual(ywing.stops, 11);
            Assert.Pass("OK for GetStarshipStops Rebel Transport stops 11 times test");
        }
Exemplo n.º 4
0
        public void Should_GetStarshipStops_Millennium_Falcon_Stops_9_Times()
        {
            System.Collections.Generic.List <Models.StarshipModel> returnValue = StarshipBusiness.GetStarshipStops(1000000);
            Assert.IsNotNull(returnValue);

            Models.StarshipModel ywing = returnValue.FirstOrDefault(x => x.name.ToLower() == "millennium falcon");

            Assert.IsNotNull(ywing);
            Assert.AreEqual(ywing.stops, 9);
            Assert.Pass("OK for GetStarshipStops Millennium Falcon stops 9 times test");
        }
Exemplo n.º 5
0
        public void Should_GetStarshipStops_Ywing_Stops_74_Times()
        {
            System.Collections.Generic.List <Models.StarshipModel> returnValue = StarshipBusiness.GetStarshipStops(1000000);
            Assert.IsNotNull(returnValue);

            Models.StarshipModel ywing = returnValue.FirstOrDefault(x => x.name.ToLower() == "y-wing");

            Assert.IsNotNull(ywing);
            Assert.AreEqual(ywing.stops, 74);
            Assert.Pass("OK for GetStarshipStops Y-wing stops 74 times test");
        }