public override void Send(string msg, Colleague colleague) { if (Customer == colleague) { Programmer.Notify(msg); } else if (Programmer == colleague) { Tester.Notify(msg); } else if (Tester == colleague) { Customer.Notify(msg); } }
public static void Test() { Colleague peter = new Colleague("Peter"); Colleague paul = new Colleague("Paul"); Colleague kate = new Colleague("Kate"); ConcreteMediator mediator = new ConcreteMediator(); mediator.RegisterColleague(peter); mediator.RegisterColleague(paul); mediator.RegisterColleague(kate); peter.Send("Paul", "WU"); //whats up? paul.Send("Peter", "aas"); //alive and smiling kate.Send("Paul", "diku"); //do I know you? paul.Send("Kate", "ydkm"); //you don't know me }
public abstract void Send(string msg, Colleague colleague);