Skip to content

Instantly share code, notes, and snippets.

@stimms
Last active December 10, 2015 20:48
Show Gist options
  • Save stimms/4490742 to your computer and use it in GitHub Desktop.
Save stimms/4490742 to your computer and use it in GitHub Desktop.
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