void MainPage_Loaded(object sender, RoutedEventArgs e) { if (this.mainPage_ViewModel == null) this.mainPage_ViewModel = new MainPage_ViewModel(); this.mainPage_ViewModel.LoadCatalogDefaultData(); this.DataContext = mainPage_ViewModel; }
public void DataCatalogTitle_CatalogTitle_Test() { bool isEventChanged = false; MainPage_ViewModel currentViewModel = new MainPage_ViewModel(); currentViewModel.PropertyChanged += (x, se) => { if(currentViewModel.catalogTitle.Equals("newTitle")) isEventChanged=true; }; currentViewModel.CatalogTitle = "newTitle"; Assert.IsTrue(isEventChanged); }
public void DataColIsChanged_Test() { bool isPropertyChanged = false; MainPage_ViewModel currentViewModel = new MainPage_ViewModel(); currentViewModel.PropertyChanged += (x, se) => { if(currentViewModel.CatalogInfoCol.Count>0) isPropertyChanged = true; }; currentViewModel.CatalogInfoCol = new System.Collections.ObjectModel.ObservableCollection<CatalogInfo>() { new CatalogInfo(){CatalogName="ComplateTestChanged",CatalogComment="TestData"} }; Assert.IsTrue(isPropertyChanged); }