Exemplo n.º 1
0
        public static void When_Calling_GetStarships_Twelve_Expect_xWing()
        {
            ShipApi shipApi = new ShipApi();

            Task <Starship> xWing = shipApi.GetStarships("12/");

            Assert.Equal("X-wing", xWing.Result.Name);
        }
Exemplo n.º 2
0
        private static void Main()
        {
            var parking  = new ParkingActions();
            var leave    = new LeaveParkingActions();
            var payment  = new PaymentActions();
            var starship = new ShipApi();

            var running = true;

            while (running)
            {
                StandardMessages.StartMessage();
                var selectedOption = Menu.ShowMenu("SpacePark Menu", new[]
                {
                    "Park Ship",
                    "Leave SpacePark",
                    "Show Receipts",
                    "Exit Menu"
                });
                switch (selectedOption)
                {
                case 0:
                    if (Occupation.AllParksOccupied())
                    {
                        break;
                    }
                    var ship = starship.SelectShip();
                    if (ship == null)
                    {
                        break;
                    }
                    parking.Park(ship);
                    break;

                case 1:
                    leave.LeavePark();
                    break;

                case 2:
                    payment.Receipts();
                    break;

                case 3:
                    running = false;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public static void When_Calling_GetShipNumber_Expect_KeyList()
        {
            ShipApi shipApi = new ShipApi();
            IEnumerable <string> inputList = new List <string>
            {
                "http://swapi.dev/api/starships/12/",
                "http://swapi.dev/api/starships/22/"
            };

            IEnumerable <string> outputList = shipApi.GetShipNumber(inputList);
            IEnumerable <string> keyList    = new List <string> {
                "12/", "22/"
            };

            Assert.Equal(keyList, outputList);
        }