Esempio n. 1
0
        public void ReceiveInputedValue_Must_Return_1()
        {
            //Arrange
            var useCaseStarshipResupply = new StarshipResupplyRequired();
            var console = new TestConsoleVirtual();

            //Act
            var inputedValue = useCaseStarshipResupply.ReceiveInputedValue(console);

            // Assert
            Assert.Equal(1, inputedValue);
        }
Esempio n. 2
0
        public void ValidateInputedValue_Must_Return_False()
        {
            //Arrange
            var useCaseStarshipResupply = new StarshipResupplyRequired();
            var console = new TestConsoleVirtual();

            //Act
            var validatedInputedValue = useCaseStarshipResupply.ValidateInputedValue("AAA", console);

            // Assert
            Assert.False(validatedInputedValue);
        }
Esempio n. 3
0
        static async Task Main(string[] args)
        {
            try
            {
                var httpClient              = new HttpClient();
                var service                 = new StarWarsApiService(httpClient);
                var consoleVirtual          = new ConsoleVirtual();
                var useCaseStarshipResupply = new StarshipResupplyRequired();

                var inputedDistanceMGLT = useCaseStarshipResupply.ReceiveInputedValue(consoleVirtual);

                Console.WriteLine("Please wait, loading...");

                var listOfStarships = await useCaseStarshipResupply.LoadStarships(service);

                useCaseStarshipResupply.CalculateResupplyRequired(listOfStarships, inputedDistanceMGLT, consoleVirtual);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
            }
        }