public void LoadItemsCommand_ServicesReternsLocationWeather_AddReternedByServicesToLocationWeatherList()
        {
            var locationWeather = new LocationWeather
            {
                Location       = _locationKyiv,
                CurrentWeather = _weather
            };

            _locationSearchServiceMoc
            .Setup(service => service.GetLocationList())
            .Returns(new List <Location>
            {
                _locationKyiv
            });

            _weatherServiceMoc
            .Setup(service => service.GetCurrentWeatherByLocationAsync(It.IsAny <string>()))
            .ReturnsAsync(new List <Weather>
            {
                _weather
            });


            var locationWeatherListViewModel = new LocationWeatherListViewModel(_weatherServiceMoc.Object, _locationSearchServiceMoc.Object);

            locationWeatherListViewModel.LoadItemsCommand.Execute(null);
            var locationWeatherListResult = locationWeatherListViewModel.LocationWeatherList;

            Assert.AreEqual(locationWeather.Location, locationWeatherListResult.FirstOrDefault()?.Location);
            Assert.AreEqual(locationWeather.CurrentWeather, locationWeatherListResult.FirstOrDefault()?.CurrentWeather);
        }
        public void RemoveItemCommand_ServicesReternsLocationWeather_RemoveLocationWeatherList()
        {
            _locationSearchServiceMoc
            .Setup(service => service.GetLocationList())
            .Returns(null as IEnumerable <Location>);

            _locationSearchServiceMoc
            .Setup(service => service.DeleteLocationAsync(It.IsAny <string>()))
            .ReturnsAsync(true);

            _weatherServiceMoc
            .Setup(service => service.GetCurrentWeatherByLocationAsync(It.IsAny <string>()))
            .ReturnsAsync(null as IList <Weather>);

            var locationWeatherListViewModel = new LocationWeatherListViewModel(_weatherServiceMoc.Object, _locationSearchServiceMoc.Object);

            locationWeatherListViewModel.LoadItemsCommand.Execute(null);
            locationWeatherListViewModel.RemoveItemCommand.Execute(_locationKyiv.Key);

            var locationWeatherListResult = locationWeatherListViewModel.LocationWeatherList;

            Assert.AreEqual(null, locationWeatherListResult.FirstOrDefault());
        }
 public LocationWeatherListPage()
 {
     InitializeComponent();
     BindingContext = viewModel = App.Container.Resolve <LocationWeatherListViewModel>();
 }