public void GivenProgramNamesMatchTerm_WhenAutocompleteServiceTypeProviderOrProgram_ThenJsonResultContainsMatchingProgramNames() { var expected = new[] { "Yellow", "YMCA" }; MockServiceTypeManager.Expect(m => m.SearchNames("Y")).Return(Enumerable.Empty <string>()); MockProviderManager.Expect(m => m.SearchProviderNames("Y")).Return(Enumerable.Empty <string>()); MockProgramManager.Expect(m => m.SearchProgramNames("Y")).Return(expected); var result = Target.AutocompleteServiceTypeProviderOrProgram("Y") as JsonResult; IEnumerable <string> actual = result.AssertGetData <IEnumerable <string> >(); CollectionAssert.AreEqual(expected.ToList(), actual.ToList()); }
public void GivenServiceTypeMatchesTerm_AndProviderMatchesTerm_AndProgramMatchesTerm_WhenAutocompleteServiceTypeProviderOrProgram_ThenJsonResultContainsMatchingServiceTypeNames_AndMatchingProviderNames_AndMatchingProgramNames() { var expectedServiceTypeMatches = new[] { "Your Service" }; var expectedProviderMatches = new[] { "Yellow", "YMCA" }; var expectedProgramMatches = new[] { "Playground Activities" }; var expected = new[] { "Playground Activities", "Yellow", "YMCA", "Your Service" }; MockServiceTypeManager.Expect(m => m.SearchNames("Y")).Return(expectedServiceTypeMatches); MockProviderManager.Expect(m => m.SearchProviderNames("Y")).Return(expectedProviderMatches); MockProgramManager.Expect(m => m.SearchProgramNames("Y")).Return(expectedProgramMatches); var result = Target.AutocompleteServiceTypeProviderOrProgram("Y") as JsonResult; IEnumerable <string> actual = result.AssertGetData <IEnumerable <string> >(); CollectionAssert.AreEqual(expected.ToList(), actual.ToList()); }