Ejemplo n.º 1
0
        private static acmemapper.Mapper CreateMapper(JObject rules)
        {
            var mapper = new acmemapper.Mapper(sourceSystem: systemA, destinationSystem: systemB, skipLoadingFromMaps: true);

            mapper.LoadMapping(rules);
            return(mapper);
        }
Ejemplo n.º 2
0
        public static void TestClassinitialize(TestContext context)
        {
            mapper = new acmemapper.Mapper();

            // load json schema files
            foreach (var schema in System.IO.Directory.GetFiles(@"schema", "*.json"))
            {
                var fileinfo = new System.IO.FileInfo(schema);
                schemas.Add(fileinfo.Name.Replace(fileinfo.Extension, String.Empty), JsonSchema4.FromFileAsync(schema).Result);
            }
        }
Ejemplo n.º 3
0
        public void MappingWithMethodInvokeNull()
        {
            var mapper = new acmemapper.Mapper(sourceSystem: "systemA", destinationSystem: "systemB", skipLoadingFromMaps: true);
            var rules  = new JObject(
                new JProperty("entity",
                              new JArray(new JObject(
                                             new JProperty("systemA",
                                                           new JObject(new JProperty("property", "sourceproperty"))),
                                             new JProperty("systemB",
                                                           new JObject(
                                                               new JProperty("property", "destinationproperty"),
                                                               new JProperty("invoke", "ToLowerInvariant")
                                                               ))
                                             )
                                         )));

            mapper.LoadMapping(rules);

            var output = mapper.Map <JObject, JObject>("entity", new JObject(new JProperty("sourceproperty", null)));

            // does this test, due to explicit cast of Value<int>() make sense ?
            Assert.AreEqual(output["destinationproperty"].Type, JTokenType.Null);
        }