Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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
        }
Beispiel #3
0
 public abstract void Send(string msg, Colleague colleague);