Beispiel #1
0
        public void TestAppIsInvalidWithNoSensors()
        {
            IConfigurationManager configManager = GetConfigurationManager();
            WeatherApp            app           = new WeatherApp();

            TestInvalidApp(app, "There are no sources of weather data currently installed. Please add an IO Resource which can supply weather data.");
        }
        public JsonResult GetWeather(string sentence)
        {
            var app    = new WeatherApp();
            var report = app.Query(sentence);

            return(Json(report, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public void TestAppIsValidWithSensors()
        {
            IConfigurationManager configManager = GetConfigurationManager();
            Mock <IWeatherSensor> sensor        = new Mock <IWeatherSensor>(MockBehavior.Strict);

            sensor.Setup(s => s.IsValid).Returns(true);
            AddComponentToConfigurationManager(sensor.Object);

            WeatherApp app = new WeatherApp();

            app.Initialize(configManager);

            Assert.AreEqual(true, app.IsValid);
        }