示例#1
0
        public void RoutingTest()
        {
            var factory = new PropertyFactory();
            var model   = (ClassProperty)factory.Create(typeof(Hoge), "Hoge");

            var xProp    = (IntProperty)model.Members.First(x => x.PropertyInfo.Name == "X");
            var fugaProp = (ClassProperty)model.Members.First(x => x.PropertyInfo.Name == "Fuga");
            var yProp    = (IntProperty)fugaProp.Members.First(x => x.PropertyInfo.Name == "Y");
            var fooProp  = (ClassProperty)fugaProp.Members.First(x => x.PropertyInfo.Name == "Foo");
            var zProp    = (IntProperty)fooProp.Members.First(x => x.PropertyInfo.Name == "Z");

            xProp.IntValue.Value = 16;
            yProp.IntValue.Value = 64;
            zProp.IntValue.Value = 256;

            var router = new ViewModelRouter(new ViewModelFactory(factory));

            Assert.AreEqual(xProp.IntValue.Value, router.GetIntProperty(model, "X").Value);
            Assert.AreEqual(yProp.IntValue.Value, router.GetIntProperty(model, "Fuga.Y").Value);
            Assert.AreEqual(zProp.IntValue.Value, router.GetIntProperty(model, "Fuga.Foo.Z").Value);
        }