Last active
December 10, 2015 20:48
-
-
Save stimms/4490742 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddressTokenReplacer | |
{ | |
private IAddressRepository _addressRepository; | |
public AddressTokenReplacer(IAddressRepository addressRepository) | |
{ | |
_addressRepository = addressRepository; | |
} | |
public string Apply(string toHaveTokensReplaced, string token, int aggregateId) | |
{ | |
var address = Lazy(x => addressRepository.Load(aggreagetId)); | |
switch(token){ | |
case "Street": | |
toHaveTokensReplaced.Replace("$" + token, address.Value.Street; | |
break; | |
case "PostalCode": | |
toHaveTokensReplaced.Replace("$" + token, address.Value.PostalCode; | |
break; | |
case "City": | |
toHaveTokensReplaced.Replace("$" + token, address.Value.City; | |
break; | |
} | |
return toHaveTokensReplaced; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment