public void ShouldReturnNullIfNoAddressesFound() { //Arrange List <PostalAddress> findResult = null; var postalAddressLookupProvider = new Mock <IPostalAddressLookupProvider>(); var serviceUnderTest = new PostalAddressSearchService(postalAddressLookupProvider.Object); postalAddressLookupProvider.Setup(m => m.GetValidatedPostalAddresses(It.IsAny <string>())) .Returns(findResult); //Act var result = serviceUnderTest.GetValidatedAddresses(It.IsAny <string>()); //Assert result.Should().BeNull(); }
public void ShouldReturnMultipleAddresses() { //Arrange var multipleResults = new Fixture().Build <PostalAddress>() .CreateMany().ToList(); var postalAddressLookupProvider = new Mock <IPostalAddressLookupProvider>(); var serviceUnderTest = new PostalAddressSearchService(postalAddressLookupProvider.Object); postalAddressLookupProvider.Setup(m => m.GetValidatedPostalAddresses(It.IsAny <string>())) .Returns(multipleResults); //Act var result = serviceUnderTest.GetValidatedAddresses(It.IsAny <string>()); //Assert Assert.AreEqual(result.Count(), multipleResults.Count); }