コード例 #1
0
        public void SolarSystem_GetForecast_ReturnForecast()
        {
            var earth   = new Planet("Earth", 1000, 1);
            var mars    = new Planet("Mars", 2000, 3);
            var neptune = new Planet("Neptune", 3000, 5);
            var planets = new List <Planet>()
            {
                earth, mars, neptune
            };

            var solarSystem          = new Entities.SolarSystem.SolarSystem(planets);
            var weatherControlSystem = new WeatherControlSystem(solarSystem);
            var forecast             = weatherControlSystem.CalculateForecast(50);

            forecast.Count.Should().Be(50);
        }
コード例 #2
0
        public void RainySolarSystem_GetForecast_ReturnRainy()
        {
            var earth   = new Planet("Earth", 1000, 45);
            var mars    = new Planet("Mars", 2000, 135);
            var neptune = new Planet("Neptune", 3000, -90);
            var planets = new List <Planet>()
            {
                earth, mars, neptune
            };

            var solarSystem          = new Entities.SolarSystem.SolarSystem(planets);
            var weatherControlSystem = new WeatherControlSystem(solarSystem);
            var forecast             = weatherControlSystem.CalculateSingleForecast(1);

            forecast.Day.Should().Be(1);
            forecast.Weather.Should().Be(Weather.Rainy);
            forecast.RainfallIntensity.Should().BeGreaterThan(0);
        }