public QuestionPageViewModelTests() { Question = new Question(); NetworkApi = new StubINetworkApi(); Application = new StubIApplicationViewModel(); Subject = new QuestionPageViewModel(Question.QuestionId, Application, NetworkApi); Application.CurrentSite_Get(() => "test_site"); }
public QuestionsViewModelTests() { NetworkApi = new StubINetworkApi(); Search = new StubISearchViewModel(); Subject = new QuestionsViewModel(search: Search, networkApi: NetworkApi); Search.SelectedSite_Set(site => Site = site); Search.SelectedSite_Get(() => Site); Search.LoadSites_Get(() => LoadSites); }
public void Test_Refreshes_Questions_When_Site_Is_Changed_After_Activation() { NetworkApi.Questions((site, order, sort, page, pagesize, filter) => { Assert.Equal("othersite", site); return(Task.FromResult(new Response <Question>())); }); var api = new StubINetworkApi(); var search = new SearchViewModel(networkApi: api); Subject = new QuestionsViewModel(search: search, networkApi: NetworkApi); Subject.Questions.Add(new QuestionItemViewModel()); using (Subject.Activator.Activate()) { search.SelectedSite = new SiteViewModel(new Site() { ApiSiteParameter = "othersite" }); Assert.Empty(Subject.Questions); } }
public SearchViewModelTests() { NetworkApi = new StubINetworkApi(); Subject = new SearchViewModel(null, NetworkApi); }