public void Deserialize_DeserializeCorrectJson_NotEmptyVlues()
        {
            //arrange
            var forecastDeserializer = new ForecastDeserializer();
            var jsonString           = "{\"points\": [" +
                                       "{" +
                                       "\"ap\": 93089387.52," +
                                       "\"date\": \"01.07.2014\"," +
                                       "\"is_predict\": true" +
                                       "}," +
                                       "{" +
                                       "\"ap\": 93089387.25," +
                                       "\"date\": \"01.08.2014\"," +
                                       "\"is_predict\": false" +
                                       "}" +
                                       "]," +
                                       "\"consumption\": \"2329.00\"" +
                                       "}";

            //act
            var forecastData = forecastDeserializer.Deserialize(jsonString);

            //assert
            Assert.IsNotNull(forecastData);
        }
        protected override IGetSingleObjectRequest <ForecastBlock> GetForecastConnection()
        {
            var forecastDeserializer = new ForecastDeserializer();
            var forecastConnection   = new GetForecastBlock(forecastDeserializer, ForecastSize.ByYear);

            return(forecastConnection);
        }
示例#3
0
        public void ForecastConnection_ParseFile_NotEmptyData()
        {
            //arrange
            Session.Instance.ActiveForecastObjectId = 1;
            var parser     = new ForecastDeserializer();
            var connection = new GetForecastBlock(parser, ForecastSize.ByMonth, ServerUrl.ServerName);

            //act
            var forecastBlock = connection.GetDataFromServer();

            //assert
            Assert.That(forecastBlock, Is.Not.Null);
            Assert.That(forecastBlock.Forecasts, Is.Not.Null.And.Not.Empty);
        }