예제 #1
0
		public async Task SearchPolls()
		{
			// Arrange
			var viewModel = GetViewModel();
			
			var expectedQueryType = PollSearchResultsQueryType.MostPopular;

			viewModel.SelectedSearchOption = new PollSearchOptionViewModel
			{
				QueryType = expectedQueryType
			};

			var expectedSearchResults = new PollSearchResultsMock();

			PollSearchResultsQueryType? actualQueryType = null;
			ObjectFactory.FetchAsyncWithCriteriaDelegate = (criteria) =>
				{
					actualQueryType = (PollSearchResultsQueryType)criteria;
					return expectedSearchResults;
				};

			// Act
			await viewModel.SearchPollsAsync();

			// Assert
			Assert.AreSame(expectedSearchResults, viewModel.PollSearchResults, "PollSearchResults");
			Assert.AreEqual(expectedQueryType, actualQueryType, "Query Type");
		}
예제 #2
0
		public void PollSearchResults()
		{
			// Arrange
			var viewModel = GetViewModel();

			var expectedSearchResults = new PollSearchResultsMock();

			// Act
			viewModel.PropertyChanged += OnPropertyChanged;
			viewModel.PollSearchResults = expectedSearchResults;
			viewModel.PropertyChanged -= OnPropertyChanged;

			// Assert
			Assert.AreSame(expectedSearchResults, viewModel.PollSearchResults, "Poll Search Results");
			Assert.IsTrue(PropertiesChanged.Contains("PollSearchResults"), "Property Changed");
		}