Beispiel #1
0
        public void isCyclingConditionsResponseGeneratesResponse()
        {
            //ARRANGE
            var jsonResponse = new CyclingConditionsResponse();

            var cyclableFakeWeatherData = new FakeWeatherData()
            {
                main = new Main()
                {
                    temp = 20
                },
                weather = new Weather[1] {
                    new Weather()
                    {
                        main = "Clear"
                    }
                },
                wind = new Wind()
                {
                    speed = 2, deg = 90
                }
            };

            //ACT
            var result = jsonResponse.Create(true, cyclableFakeWeatherData);

            //ASSERT
            Assert.IsNotNull(result);
            Assert.AreEqual(20, result.Value.temperature);
            Assert.AreEqual("Clear", result.Value.weatherCondition);
            Assert.AreEqual(2, result.Value.windSpeed);
            Assert.AreEqual(90, result.Value.windDirectionDeg);
        }
Beispiel #2
0
        public void cyclabilityIsValidating()
        {
            //ARRANGE
            var cyclability = new Cyclability();

            var cyclableFakeWeatherData = new FakeWeatherData()
            {
                main = new Main()
                {
                    temp = 20
                },
                weather = new Weather[1] {
                    new Weather()
                    {
                        id = 800
                    }
                },
                wind = new Wind()
                {
                    speed = 2
                }
            };

            var notCyclableFakeWeatherData = new FakeWeatherData()
            {
                main = new Main()
                {
                    temp = 35
                },
                weather = new Weather[1] {
                    new Weather()
                    {
                        id = 300
                    }
                },
                wind = new Wind()
                {
                    speed = 25
                }
            };

            //ACT

            var isCyclableGoodWeather = cyclability.Validate(cyclableFakeWeatherData);
            var isCyclableBadWeather  = cyclability.Validate(notCyclableFakeWeatherData);

            //ASSERT
            Assert.AreEqual(true, isCyclableGoodWeather);
            Assert.AreEqual(false, isCyclableBadWeather);
        }