コード例 #1
0
        public void happyCase()
        {
            string ywing      = "Y-wing";
            string millenium  = "Millennium Falcon";
            string rebel      = "Rebel Transport";
            var    mock       = new RequestClientMock();
            var    calculator = new TravelResupplyCalculator(1000000, mock);
            var    results    = calculator.CalculateAllStops();

            Assert.NotNull(results);
            Assert.NotEmpty(results);
            Assert.True(mock.StarShips.Count == results.Count);
            foreach (StopNeeded info in results)
            {
                if (info.starship.name == ywing)
                {
                    Assert.True(info.numberOfStop == 74);
                }
                else if (info.starship.name == millenium)
                {
                    Assert.True(info.numberOfStop == 9);
                }
                else if (info.starship.name == rebel)
                {
                    Assert.True(info.numberOfStop == 11);
                }
            }
        }
コード例 #2
0
        public void unknowValue()
        {
            var mock = new RequestClientMock();

            mock.StarShips.Add(new Starship
            {
                name        = "DeathStar III",
                MGLT        = Starship.UNKNOWN_STAT,
                consumables = Starship.UNKNOWN_STAT
            });

            var calculator = new TravelResupplyCalculator(1000000, mock);
            var results    = calculator.CalculateAllStops();

            Assert.NotNull(results);
            Assert.NotEmpty(results);
            Assert.True(mock.StarShips.Count == results.Count);

            bool unknowFound = false;

            foreach (StopNeeded info in results)
            {
                if (info.starship.isUnknow)
                {
                    unknowFound = true;
                    Assert.Null(info.numberOfStop);
                }
            }

            Assert.True(unknowFound);
        }
コード例 #3
0
        public void testUsingRealData()
        {
            var calculator = new TravelResupplyCalculator(1000000, new RequestClient());
            var result     = calculator.CalculateAllStops();

            Assert.NotNull(result);
            Assert.NotEmpty(result);
        }