Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KeesCBakker/e2b71fa26a55ef6afd863130348025f9 to your computer and use it in GitHub Desktop.
Save KeesCBakker/e2b71fa26a55ef6afd863130348025f9 to your computer and use it in GitHub Desktop.
public class DefaultMessageService : IMessageService
{
public string GetMessage() => "Hello world!";
}
public class HiddenMessageService : IMessageService
{
private readonly ISecretKey _key;
public HiddenMessageService(ISecretKey key)
{
_key = key;
}
public string GetMessage() =>
"The answer to life the universe and everything: " +
_key.GetKey();
}
public interface ISecretKey
{
public string GetKey();
}
public class SecretKey : ISecretKey
{
public string GetKey() => "42";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment