public void ShouldResponseToNewMailEvent() { var mailManager = new MailManager(); new Fax(mailManager); mailManager.SimulateNewMail("Nick", "Carry", "Hello World"); }
public void ShouldNotResponseToNewMailEventWhenUnregistered() { var mailManager = new MailManager(); var fax = new Fax(mailManager); mailManager.SimulateNewMail("Nick", "Carry", "Hello World"); fax.Unregister(mailManager); mailManager.SimulateNewMail("Nancy", "James", "Good Morning"); }
static void Main(string[] args) { var mailManager = new MailManager(); mailManager.NewMail += MailManagerNewMail; var sms = new SMS(mailManager); Console.Write("Введите ваше имя:"); var sender = Console.ReadLine(); Console.Write("С кем вы хотите связаться?"); var target = Console.ReadLine(); Console.Write("Напишите ваше сообщение:"); var message = Console.ReadLine(); mailManager.SimulateNewMail(sender, target, message); Console.ReadLine(); }
private void Unregister(MailManager mailManager) { mailManager.NewMail -= OnMailManagerNewMail; }
public Printer(MailManager mailManager) { mailManager.NewMail += OnMailManagerNewMail; }
public SMS(MailManager mm) { mm.NewMail += Mm_NewMail; }