예제 #1
0
 public CounterMediator(CounterA counterA, CounterB counterB)
 {
     _counterA = counterA;
     _counterA.SetMediator(this);
     _counterB = counterB;
     _counterB.SetMediator(this);
 }
예제 #2
0
        public void CounterAShouldReceiveMessage()
        {
            var counterA = new CounterA();
            var counterB = new CounterB();

            new CounterMediator(counterA, counterB);

            string message          = "Hi Counter A";
            var    counterAReceived = counterB.Send(message);

            Assert.AreEqual(counterAReceived, $"Counter A received message: {message}");
        }