Exemplo n.º 1
0
        public async Task TestWriterStartingInfo()
        {
            starshipservice.GetStarships().Returns(new List <StarShip>
            {
                new StarShip()
            });

            Executer exc = new Executer(starshipservice, writer, calculator);
            await exc.Intialize();


            writer.Received().Info("Getting starships");
        }
Exemplo n.º 2
0
        public async Task TestWriterInvalidConsumptionDetail()
        {
            starshipservice.GetStarships().Returns(new List <StarShip>
            {
                new StarShip {
                    name = "Executor", consumables = ""
                }
            });

            Executer exc = new Executer(starshipservice, writer, calculator);
            await exc.Intialize();

            exc.Execute(1000000);

            writer.Received().Info("Starships with invalid data:");
            writer.Received().data("Executor");
            writer.Received().Info("Stops has been calculated successfully");
            writer.Received().Info("Enter new distance or \"Exit\" to quit");
        }
Exemplo n.º 3
0
        public async Task TestWriterCorrectData()
        {
            starshipservice.GetStarships().Returns(new List <StarShip>
            {
                new StarShip {
                    name = "Executor", consumables = "6 years", MGLT = "40"
                }
            });

            calculator = container.GetInstance <IStopsCalculator>();
            Executer exc = new Executer(starshipservice, writer, calculator);
            await exc.Intialize();

            var distance = 10000000;

            exc.Execute(distance);

            writer.Received().Info("Getting starships");
            writer.Received().data("Executor: 4");
            writer.Received().Info("Stops has been calculated successfully");
            writer.Received().Info("Enter new distance or \"Exit\" to quit");
        }