private (TestMessageWriter, ConcreteColleague) CreateConcreteColleague(string name) { var messageWriter = new TestMessageWriter(); var concreateColleague = new ConcreteColleague(name, messageWriter); return(messageWriter, concreateColleague); }
static void Main(string[] args) { ConcreteMediator mediator = new ConcreteMediator(); ConcreteColleague colleague = new ConcreteColleague(mediator); mediator.Register(colleague); mediator.Operation(); Console.ReadKey(); }
public static void EX1() { Mediator.Exemplo1.Mediator mediator = new Exemplo1.Mediator(); ConcreteColleague participant = new ConcreteColleague(mediator); ConcreteColleague2 participant2 = new ConcreteColleague2(mediator); mediator.AddParticipant(participant); mediator.AddParticipant(participant2); participant.Send("Message"); participant2.Send("Response of message"); participant.Send("OK"); participant2.Send("Bye"); }