Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 2.06 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.    [TestFixture]
  2.     public class When_the_selection_manager_has_its_search_results_updated2
  3.     {
  4.         private FakeSearchService searchService;
  5.         private SelectionManager selectionManager;
  6.  
  7.         private const string ItemPresentInBothLists = "One";
  8.         private const string ItemOnlyPresentInSearchResults = "Two";
  9.         private const string AlreadySelectedItem = "Four";
  10.         private const string UnselectedItem = "Five";
  11.  
  12.         [TestFixtureSetUp]
  13.         public void ArrangeAndAct()
  14.         {
  15.             searchService = new FakeSearchServiceBuilder()
  16.                 .WithUnselectedItem(ItemPresentInBothLists)
  17.                 .WithUnselectedItem(ItemOnlyPresentInSearchResults)
  18.                 .Get();
  19.  
  20.             selectionManager = new SelectionManagerBuilder()
  21.                 .UsingSearchService(searchService)
  22.                 .WithSelectedItem(ItemPresentInBothLists)
  23.                 .WithSelectedItem(AlreadySelectedItem)
  24.                 .WithUnselectedItem(UnselectedItem)
  25.                 .Get();
  26.  
  27.             selectionManager.PerformAdditionalSearch("searchTerm");
  28.         }
  29.  
  30.         [Test]
  31.         public void Items_which_are_selected_in_both_lists_are_selected_in_the_merged_output()
  32.         {
  33.             Assert.That(selectionManager.HasSelectedItemWithId(ItemPresentInBothLists));
  34.         }
  35.  
  36.         [Test]
  37.         public void Items_only_present_in_the_search_results_appear_unselected_in_the_merged_output()
  38.         {
  39.             Assert.That(selectionManager.HasUnselectedItemWithId(ItemOnlyPresentInSearchResults));
  40.         }
  41.  
  42.         [Test]
  43.         public void Items_which_are_selected_in_the_current_list_without_being_present_in_the_returned_list_are_kept_selected_in_the_current_list()
  44.         {
  45.             Assert.That(selectionManager.HasSelectedItemWithId(AlreadySelectedItem));
  46.         }
  47.  
  48.         [Test]
  49.         public void Items_which_are_not_selected_in_the_current_list_without_being_present_in_the_returned_list_are_removed_from_the_current_list()
  50.         {
  51.             Assert.That(selectionManager.DoesNotHaveItemWithId(UnselectedItem));
  52.         }
  53.     }