Ejemplo n.º 1
0
        public void ExactValueReflectionTest()
        {
            var dispatcher = new CInstanceSpecificValueHandlers
            {
                Step = 2
            };

            var disc = new MessageHandlerDiscovery(dispatcher);

            disc.RegisterInstanceHandlers(dispatcher);

            dispatcher.Post(EShapes.Circle);
            dispatcher.Post(EShapes.Circle);

            Assert.AreEqual(0, dispatcher.Squares, "Squares 1");
            Assert.AreEqual(4, dispatcher.Circles, "Circles 1");
            Assert.AreEqual(0, dispatcher.Shapes, "Shapes 1");

            dispatcher.Step = 3;
            dispatcher.Post(EShapes.Shape);
            dispatcher.Post(EShapes.Square);
            dispatcher.Post(EShapes.Square);
            dispatcher.Post(EShapes.Square);

            Assert.AreEqual(9, dispatcher.Squares, "Squares 1");
            Assert.AreEqual(4, dispatcher.Circles, "Circles 1");
            Assert.AreEqual(3, dispatcher.Shapes, "Shapes 1");
        }
Ejemplo n.º 2
0
 public void AShape(MessageHandler _eh, object _event, CInstanceSpecificValueHandlers _dispatcher)
 {
     _dispatcher.Shapes += _dispatcher.Step;
     Assert.AreEqual(this, _dispatcher, "Dispatcher Instance Mismatch");
 }