Exemplo n.º 1
0
        public QuestionPageViewModelTests()
        {
            Question    = new Question();
            NetworkApi  = new StubINetworkApi();
            Application = new StubIApplicationViewModel();
            Subject     = new QuestionPageViewModel(Question.QuestionId, Application, NetworkApi);

            Application.CurrentSite_Get(() => "test_site");
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
 }