public void LoadCategoriesCalled_CategoriesPropertyChangedCalled() { //Arrange: Quiz quiz1 = new Quiz(); quiz1.Category = "Category 1"; Quiz quiz2 = new Quiz(); quiz2.Category = "Category 2"; Quiz quiz3 = new Quiz(); quiz3.Category = "Category 3"; Quiz quiz4 = new Quiz(); quiz4.Category = "Category 4"; Quiz quiz5 = new Quiz(); quiz5.Category = "Category 5"; List <Quiz> fakedQuizList = new List <Quiz>() { quiz1, quiz2, quiz3, quiz4, quiz5 }; uut_.PropertyChanged += (o, arg) => { eventsReceived++; }; fakeService_.GetAllQuizzesAsync().ReturnsForAnyArgs(fakedQuizList); //Act: uut_.LoadCategories(); //Assert: Assert.That(eventsReceived, Is.EqualTo(1)); }
public SearchQuizPageSelectCategory(SearchQuizViewModel viewModel = null) { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); viewModel_ = viewModel; if (viewModel_ == null) { viewModel_ = new SearchQuizViewModel("Vælg Kategori", new QuizDBServices()); } BindingContext = viewModel_; viewModel_.IsBusy = false; viewModel_.LoadCategories(); LViewCategories.ItemSelected += listCategorySelected; LViewCategories.ItemTapped += (sender, args) => LViewCategories.SelectedItem = null; }