コード例 #1
0
        public void NewAndInheritedPropertiesAppearOnlyOnce()
        {
            var valAsDerived = new DerivedWithOverrides
            {
                PropA = "A",
                PropB = "B",
                PropC = "C",
                PropD = "D"
            };

            var valAsBase = (BaseWithProps)valAsDerived;

            valAsBase.PropA = "BA";

            var pv = (StructureValue)_converter.CreatePropertyValue(valAsDerived, true);

            Assert.Equal(4, pv.Properties.Count);
            Assert.Equal("A", pv.Properties.Single(pp => pp.Name == "PropA").Value.LiteralValue());
            Assert.Equal("B", pv.Properties.Single(pp => pp.Name == "PropB").Value.LiteralValue());
        }
コード例 #2
0
        public void NewAndInheritedPropertiesAppearOnlyOnce()
        {
            var valAsDerived = new DerivedWithOverrides
            {
                PropA = "A",
                PropB = "B",
                PropC = "C",
                PropD = "D"
            };

            var valAsBase = (BaseWithProps)valAsDerived;
            valAsBase.PropA = "BA";

            var pv = (StructureValue) _converter.CreatePropertyValue(valAsDerived, true);

            Assert.AreEqual(4, pv.Properties.Count);
            Assert.AreEqual("A", pv.Properties.Single(pp => pp.Name == "PropA").Value.LiteralValue());
            Assert.AreEqual("B", pv.Properties.Single(pp => pp.Name == "PropB").Value.LiteralValue());
        }