Пример #1
0
        public void TestUpdateMeteorologyAsync()
        {
            BoraNowSeeder.Seed();
            var mbo     = new MeteorologyBusinessObject();
            var resList = mbo.List();
            var item    = resList.Result.FirstOrDefault();

            var meteo = new Meteorology(10, 11, 50, 2, 7, DateTime.Now.AddDays(200));

            item.MaxTemperature = meteo.MaxTemperature;
            item.MinTemperature = meteo.MinTemperature;
            item.RainPercentage = meteo.RainPercentage;
            item.UvIndex        = meteo.UvIndex;
            item.WindIndex      = meteo.WindIndex;
            item.Date           = meteo.Date;

            var resUpdate = mbo.UpdateAsync(item).Result;

            resList = mbo.ListAsync().Result;

            Assert.IsTrue(resUpdate.Success && resList.Success &&
                          resList.Result.First().MaxTemperature == meteo.MaxTemperature && resList.Result.First().MinTemperature == meteo.MinTemperature &&
                          resList.Result.First().RainPercentage == meteo.RainPercentage && resList.Result.First().UvIndex == meteo.UvIndex &&
                          resList.Result.First().WindIndex == meteo.WindIndex && resList.Result.First().Date == meteo.Date);
        }
Пример #2
0
        public void TestListMeteorologyAsync()
        {
            BoraNowSeeder.Seed();
            var mbo     = new MeteorologyBusinessObject();
            var resList = mbo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Пример #3
0
        public void TestDeleteMeteorologyAsync()
        {
            BoraNowSeeder.Seed();
            var mbo       = new MeteorologyBusinessObject();
            var resList   = mbo.List();
            var resDelete = mbo.DeleteAsync(resList.Result.First().Id).Result;

            resList = mbo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }