Exemple #1
0
            public void CanRegisterPropertyRoute()
            {
                OutComponent outComponent = new OutComponent();
                InComponent  inComponent  = new InComponent();

                PropertyToPropertyRoute route = PropertyToPropertyRoute.Create(outComponent, x => outComponent.IntOutProperty, inComponent, x => inComponent.IntInProperty);

                route.RegisterRoute();

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

                outComponent.IntOutProperty = 100;
                route.UnregisterRoute();

                Assert.AreEqual(outComponent.IntOutProperty, inComponent.IntInProperty);
            }
Exemple #2
0
            public void CanRegisterPropertyRouteWithValueConverter()
            {
                OutComponent outComponent           = new OutComponent();
                InComponent  inComponent            = new InComponent();
                StringToIntRouteConverter converter = new StringToIntRouteConverter();

                PropertyToPropertyRoute route = PropertyToPropertyRoute.Create <int>(outComponent, "StringOutProperty", inComponent, x => inComponent.IntInProperty, converter);

                route.RegisterRoute();

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

                outComponent.StringOutProperty = "100";
                route.UnregisterRoute();

                Assert.AreEqual(100, inComponent.IntInProperty);
            }
Exemple #3
0
            public void CanRegisterPropertyRouteWithReferenceConverter()
            {
                OutComponent outComponent           = new OutComponent();
                InComponent  inComponent            = new InComponent();
                IntToStringRouteConverter converter = new IntToStringRouteConverter();

                PropertyToPropertyRoute route = PropertyToPropertyRoute.Create <string>(outComponent, "IntOutProperty", inComponent, x => inComponent.StringInProperty, converter);

                route.RegisterRoute();

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

                outComponent.IntOutProperty = 100;
                route.UnregisterRoute();

                Assert.IsTrue(string.Compare(outComponent.IntOutProperty.ToString(), inComponent.StringInProperty, false) == 0);
            }