コード例 #1
0
ファイル: ScribeTest.cs プロジェクト: LokiMidgard/Zelos
        public void SerelizePropertysPublic()
        {
            var s = new ScripePropertysOnly()
            {
                Secret = "Secret", ShouldBeSerelized = 1, ShouldNotBeSerelized = 2
            };
            var c = new ScruptureCollection();

            var s2 = Transfare(c, s);

            Assert.AreEqual(s.ShouldBeSerelized, s2.ShouldBeSerelized);
            Assert.AreEqual(default(string), s2.Secret);
            Assert.AreEqual(default(int), s2.ShouldNotBeSerelized);
            Assert.IsTrue(s2.IsFrozen);

            Assert.IsTrue(AbstractScripture.Equals(s, s2, ComparisionKind.UsePropertysExcludingSecret));
            Assert.IsFalse(AbstractScripture.Equals(s, s2, ComparisionKind.UsePropertysIncludingSecret));
        }
コード例 #2
0
ファイル: ScribeTest.cs プロジェクト: LokiMidgard/Zelos
        public void SerelizeSingelSub()
        {
            var sub = new ScripePropertysOnly()
            {
                Secret = "Secret", ShouldBeSerelized = 1, ShouldNotBeSerelized = 2
            };
            var parent = new ScrupeWithSingelSub()
            {
                Child = sub
            };
            var c       = new ScruptureCollection();
            var parent2 = Transfare(c, parent);

            Assert.AreEqual(sub.ShouldBeSerelized, (parent2.Child as ScripePropertysOnly).ShouldBeSerelized);
            Assert.AreEqual(default(int), (parent2.Child as ScripePropertysOnly).ShouldNotBeSerelized);
            Assert.AreEqual(default(string), (parent2.Child as ScripePropertysOnly).Secret);
            Assert.IsTrue(parent2.IsFrozen);
            Assert.IsTrue(parent2.Child.IsFrozen);
        }
コード例 #3
0
ファイル: ScribeTest.cs プロジェクト: LokiMidgard/Zelos
        public void SerelizeMultipleSub()
        {
            var sub1 = new ScripePropertysOnly()
            {
                Secret = "Secret", ShouldBeSerelized = 1, ShouldNotBeSerelized = 2
            };
            var sub2   = new ScripeEmpty();
            var parent = new ScrupeWithCollectionSub();

            parent.Childs.Add(sub1);
            parent.Childs.Add(sub2);
            var c       = new ScruptureCollection();
            var parent2 = Transfare(c, parent);

            Assert.IsTrue(parent2.Childs.Count == 2);
            Assert.IsTrue(parent2.Childs[0] is ScripePropertysOnly);
            Assert.IsTrue(parent2.Childs[1] is ScripeEmpty);
            Assert.AreEqual(sub1.ShouldBeSerelized, (parent2.Childs[0] as ScripePropertysOnly).ShouldBeSerelized);
            Assert.AreEqual(default(int), (parent2.Childs[0] as ScripePropertysOnly).ShouldNotBeSerelized);
            Assert.AreEqual(default(string), (parent2.Childs[0] as ScripePropertysOnly).Secret);
            Assert.IsTrue(parent2.IsFrozen);
            Assert.IsTrue(parent2.Childs.All(x => x.IsFrozen));
        }