Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save colltoaction/3261337 to your computer and use it in GitHub Desktop.
Save colltoaction/3261337 to your computer and use it in GitHub Desktop.
Liskov - step 1
// ******* NO COMPILÉ ESTE ARCHIVO **********
abstract class MailMessageBuilder
{
private MailMessage mailMessage = new MailMessage();
public MailMessageBuilder WithTo(string to)
{
mailMessage.To.Add(to);
return this;
}
public MailMessageBuilder WithSubject(string subject)
{
mailMessage.Subject = subject;
return this;
}
public MailMessageBuilder WithFrom(string from)
{
mailMessage.From = new MailAddress(from);
return this;
}
public MailMessage BuildMessage()
{
mailMessage.Body = body.ToString();
return mailMessage;
}
private void AddBodyLine(String line, params object[] args)
{
body.AppendLine(String.Format(line, args));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment