public void CreateWithRedirectPath_MustProxThatPaths(Type type, string prefx)
        {
            var root  = ConfigHelper.CreateEmptyRoot();
            var prox  = ProxyUtil.CreateProx();
            var named = new Dictionary <PropertyIdentity, string>
            {
                [new PropertyIdentity(typeof(SomeBox), nameof(RedirectClass.Age))]   = "Age",
                [new PropertyIdentity(typeof(SomeBox), nameof(RedirectClass.Name))]  = prefx + "Name",
                [new PropertyIdentity(typeof(SomeBox), nameof(RedirectClass.Score))] = prefx + "Score",
            };
            var map     = new IdentityMapNameTransfer(named);
            var creator = new ProxyCreator(prox, type, map, IdentityNamedCreator.Instance, CompilePropertyVisitor.Instance);

            creator.Analysis();
            var x = (dynamic)creator.Build(root);

            x.Red.Age             = 123;
            x.Red.Name            = "456";
            x.Red.Score           = 789.123d;
            root["Age"]           = "123";
            root[prefx + "Name"]  = "456";
            root[prefx + "Score"] = "789.123";
            Assert.AreEqual("123", root["Age"]);
            Assert.AreEqual("456", root[prefx + "Name"]);
            Assert.AreEqual("789.123", root[prefx + "Score"]);
        }
示例#2
0
 public void CreateProxyComplex()
 {
     proxyCreator.Build(configuration);
 }