コード例 #1
0
        public static void Run()
        {
            var versionHistoryRegistry = VersionHistoryRegistry.Resolve();

            versionHistoryRegistry.Init(new List <IVersionHistoryConfig>()
            {
                new VersionHistoryConfig()
            });

            Console.WriteLine("show VersionHistoryRegistry:");
            var nbJsonSerialize = NbJsonSerialize.Resolve();
            var serialize       = nbJsonSerialize.Serialize(versionHistoryRegistry);

            Console.WriteLine(serialize);
        }
コード例 #2
0
        public void CheckChanged_Serialize_Should_OK()
        {
            var nbJsonSerialize = NbJsonSerialize.Resolve();
            var httpGetJson     = nbJsonSerialize.Serialize(_hashModel);

            AssertHelper.WriteLine("--httpGetJson--");
            httpGetJson.Log();

            var vo = nbJsonSerialize.Deserialize <HashDictionary>(httpGetJson);

            vo["A"] = new MockTraceItem()
            {
                Name = "Foo"
            };
            vo.CheckChanged("A").ShouldTrue("A Reset Foo");

            vo.GetCurrentVersion().ShouldNotNull("GetCurrentVersion").Log();
            vo.GetHashValues()["B"].Version.ShouldNotNull("B NotRest hash Version").Log();

            vo.CheckChanged("B").ShouldFalse("B NotRest");

            vo["C"] = new MockTraceItem();
            vo.CheckChanged("C").ShouldFalse("C Rest Same");

            vo["D"] = new MockTraceItem();
            vo.GetHashValues()["D"].LogProperties();
            vo.GetCurrentVersion().Log();
            vo.CheckChanged("D").ShouldTrue("Add NEW D");

            var httpPostJson = nbJsonSerialize.Serialize(vo);

            AssertHelper.WriteLine("--httpPostJson--");
            httpPostJson.Log();

            var serverGetVo     = nbJsonSerialize.Deserialize <HashDictionary>(httpPostJson);
            var serverGetVoJson = nbJsonSerialize.Serialize(serverGetVo);

            AssertHelper.WriteLine("--serverGetVoJson--");
            serverGetVoJson.Log();

            serverGetVo.CheckChanged("A").ShouldTrue("A Reset Foo");
            serverGetVo.CheckChanged("B").ShouldFalse("B NotRest");
            serverGetVo.CheckChanged("C").ShouldFalse("C Rest Same");
            serverGetVo.CheckChanged("D").ShouldTrue("Add NEW D");
        }
コード例 #3
0
        public static void Run()
        {
            Console.WriteLine("save FeatureSupportRegistry:");
            var supportRegistry = new FeatureSupportRegistry();

            supportRegistry.Features.Add(new Feature()
            {
                Code = "FeatureA", SinceVersion = "1.0.0", DeadVersion = null
            });
            supportRegistry.Features.Add(new Feature()
            {
                Code = "FeatureB", SinceVersion = "1.1.0", DeadVersion = null
            });
            FeatureSupportRegistry.SaveToInitData(supportRegistry);

            Console.WriteLine("load FeatureSupportRegistry:");
            var featureSupportRegistry = FeatureSupportRegistry.LoadFromInitData();

            Console.WriteLine("show FeatureSupportRegistry:");
            var nbJsonSerialize = NbJsonSerialize.Resolve();
            var serialize       = nbJsonSerialize.Serialize(featureSupportRegistry);

            Console.WriteLine(serialize);
        }
コード例 #4
0
 private INbJsonSerialize ResolveSerialize()
 {
     return(NbJsonSerialize.Resolve());
 }