protected override void OnAppearing() { CitySitesListViewModel vm = new CitySitesListViewModel(Navigation); CitySiteRepository siteRepository = new CitySiteRepository(new Data.CityDBContext()); vm.SetCitySites(siteRepository.GetAllCitySites(), true); this.BindingContext = vm; }
public CitySitesListView() { InitializeComponent(); CitySitesListViewModel vm = new CitySitesListViewModel(Navigation); CitySiteRepository siteRepository = new CitySiteRepository(new Data.CityDBContext()); vm.SetCitySites(siteRepository.GetAllCitySites(), true); this.BindingContext = vm; }
public void TestChildFilterForViewModel() { // Test : Expected Number is 1 int ExpectedResult = 1; Mock <CitySiteRepository> mock = new Mock <CitySiteRepository>(null); mock.Setup(a => a.GetAllCitySites()).Returns(allSites); Mock <INavigation> mockNav = new Mock <INavigation>(); CitySitesListViewModel mylv = new CitySitesListViewModel(mockNav.Object); mylv.SetCitySites(mock.Object.GetAllCitySites(), true); mylv.SetChildFilter(mock.Object, true); int countafterset = mylv.allCitySites.Count(); Assert.IsTrue(countafterset == ExpectedResult); }