public void GivenServiceTypeNamesMatchTerm_WhenAutoCompletePartnerName_ThenJsonResultContainsMatchingServiceTypeNames() { var expected = new[] { "Yellow", "Yeppers" }; MockProviderLogicManager.Expect(m => m.SearchProviderNames("Y")).Return(Enumerable.Empty <string>()); MockProgramLogicManager.Expect(m => m.SearchProgramNames("Y")).Return(Enumerable.Empty <string>()); MockServiceTypeManager.Expect(m => m.SearchNames("Y")).Return(expected); var result = Target.AutocompletePartnerName("Y") as JsonResult; IEnumerable <string> actual = result.AssertGetData <IEnumerable <string> >(); CollectionAssert.AreEqual(expected.ToList(), actual.ToList()); }
public void GivenProviderNamesMatchTerm_AndProgramNamesMatchTerm_AndServiceTypesMatchTerm_WhenAutoCompletePartnerName_ThenJsonResultContainsMatchingProviderNames_AndMatchingProgramNames() { var expectedProviderMatches = new[] { "Yellow", "YMCA" }; var expectedProgramMatches = new[] { "Playground Activities" }; var expectedServiceTypeMatches = new[] { "Service Type" }; var expected = new[] { "Playground Activities", "Service Type", "Yellow", "YMCA" }; MockProviderLogicManager.Expect(m => m.SearchProviderNames("Y")).Return(expectedProviderMatches); MockProgramLogicManager.Expect(m => m.SearchProgramNames("Y")).Return(expectedProgramMatches); MockServiceTypeManager.Expect(m => m.SearchNames("Y")).Return(expectedServiceTypeMatches); var result = Target.AutocompletePartnerName("Y") as JsonResult; IEnumerable <string> actual = result.AssertGetData <IEnumerable <string> >(); CollectionAssert.AreEqual(expected.ToList(), actual.ToList()); }