Beispiel #1
0
            public void CanRegisterEventArgsRoute()
            {
                OutComponent  outComponent = new OutComponent();
                InComponent   inComponent  = new InComponent();
                TestEventArgs e            = new TestEventArgs("RouteOut", 100);

                EventToPropertyRoute route = EventToPropertyRoute.Create(outComponent, "TestEventOut", inComponent, x => inComponent.TestEventArgsInProperty);

                route.RegisterRoute();

                if (!route.IsRegistered)
                {
                    Assert.Fail("Route not registered.");
                }

                outComponent.RaiseTestEventOut(e);
                route.UnregisterRoute();

                Assert.AreEqual(inComponent.TestEventArgsInProperty.EventInteger, e.EventInteger);
            }
Beispiel #2
0
            public void CanRegisterEventArgsRouteWithReferenceConverter()
            {
                OutComponent  outComponent = new OutComponent();
                InComponent   inComponent  = new InComponent();
                TestEventArgs e            = new TestEventArgs("RouteOut", 100);
                TestEventArgsToStringRouteConverter converter = new TestEventArgsToStringRouteConverter();

                EventToPropertyRoute route = EventToPropertyRoute.Create(outComponent, "TestEventOut", inComponent, x => inComponent.StringInProperty, converter);

                route.RegisterRoute();

                if (!route.IsRegistered)
                {
                    Assert.Fail("Route not registered.");
                }

                outComponent.RaiseTestEventOut(e);
                route.UnregisterRoute();

                Assert.IsTrue(string.Compare(e.EventString, inComponent.StringInProperty, false) == 0);
            }