Exemple #1
0
        public void GetOutputData_EmptyListStarShips()
        {
            IStarShipsOperations swAPI = GetNewFactoryStarWarsAPI();

            Assert.That(() => {
                swAPI.GetOutputData(new List <StarShip>(), 10).ToList();
            },
                        Throws.InstanceOf <StarShipException>());
        }
Exemple #2
0
        public void GetOutputData_ZeroMGLT()
        {
            IList <StarShip> listStarShip = new List <StarShip>()
            {
                new StarShip()
                {
                    name = "1", model = "M1", MGLT = "15"
                }
            };

            IStarShipsOperations swAPI = GetNewFactoryStarWarsAPI();

            Assert.Throws <StarShipException>(() => swAPI.GetOutputData(listStarShip, 0).ToList());
        }
Exemple #3
0
        public void GetOutputData_ExpectedOutput()
        {
            IList <StarShip> listStarShips = new List <StarShip>()
            {
                new StarShip()
                {
                    name = "1", model = "M1", MGLT = "15"
                },
                new StarShip()
                {
                    name = "2", model = "M2", MGLT = "10"
                }
            };

            IStarShipsOperations swAPI        = GetNewFactoryStarWarsAPI();
            IEnumerable <string> outputValues = swAPI.GetOutputData(listStarShips, 15);

            Assert.AreEqual(outputValues.First(), "1: 1");
            Assert.AreEqual(outputValues.Last(), "2: 2");
        }
Exemple #4
0
        public void GetOutputData_NullListStarShips()
        {
            IStarShipsOperations swAPI = GetNewFactoryStarWarsAPI();

            Assert.Throws <StarShipException>(() => swAPI.GetOutputData(null, 10).ToList());
        }