示例#1
0
        public void LaterOverridesOverrideEarlierOverrides()
        {
            var metadata = such_metadata;

            metadata["x_netkan_override"] = JArray.Parse(@"[
                {
                    ""version"": ""1.01"",
                    ""before"": ""$all"",
                    ""override"": {
                        ""name"": ""EARLY""
                    }
                },
                {
                    ""version"": ""1.01"",
                    ""after"": ""$all"",
                    ""override"": {
                        ""name"": ""LATE""
                    }
                }
            ]");

            var earlyTransformer = new VersionedOverrideTransformer(new[] { "$all" }, new[] { "$none" });
            var lateTransformer  = new VersionedOverrideTransformer(new[] { "$none" }, new[] { "$all" });

            var transformedMetadata1 = earlyTransformer.Transform(new Metadata(metadata), opts).First().Json();
            var transformedMetadata2 = lateTransformer.Transform(new Metadata(transformedMetadata1), opts).First();

            Assert.AreEqual((string)transformedMetadata2.Json()["name"], "LATE");
        }
示例#2
0
        /// <summary>
        /// Process overrides (if present)
        /// </summary>
        private JObject ProcessOverrides(JObject metadata)
        {
            var transformer = new VersionedOverrideTransformer(
                before: new string[] { null },
                after: new string[] { null }
                );

            return(transformer.Transform(new Metadata(metadata), opts).First().Json());
        }
示例#3
0
        /// <summary>
        /// Process overrides (if present)
        /// </summary>
        private JObject ProcessOverrides(JObject metadata)
        {
            var transformer = new VersionedOverrideTransformer();

            return(transformer.Transform(new Metadata(metadata)).Json());
        }