Пример #1
0
        public void SerializeReadOnlyPropertiesWithAccessModifiers()
        {
            IIonStruct serialized = StreamToIonValue(defaultSerializer.Serialize(TestObjects.objectWithReadonlyProperties));

            Assert.AreEqual("Public Value", serialized.GetField("publicProperty").StringValue);
            Assert.AreEqual("Protected Internal Value", serialized.GetField("protectedInternalProperty").StringValue);
            Assert.AreEqual("Internal Value", serialized.GetField("internalProperty").StringValue);
            Assert.IsFalse(serialized.ContainsField("protectedProperty"));
            Assert.IsFalse(serialized.ContainsField("privateProperty"));
            Assert.IsFalse(serialized.ContainsField("protectedPrivateProperty"));
        }
Пример #2
0
        public void SerializeMethodsWithAccessModifiers()
        {
            IIonStruct serialized = StreamToIonValue(defaultSerializer.Serialize(TestObjects.objectWithMethods));

            Assert.AreEqual("Public Value", serialized.GetField("public value").StringValue);
            Assert.AreEqual("Protected Value", serialized.GetField("protected value").StringValue);
            Assert.AreEqual("Protected Internal Value", serialized.GetField("protected internal value").StringValue);
            Assert.AreEqual("Internal Value", serialized.GetField("internal value").StringValue);
            Assert.AreEqual("Private Value", serialized.GetField("private value").StringValue);
            Assert.AreEqual("Private Protected Value", serialized.GetField("private protected value").StringValue);
        }
Пример #3
0
        public void SerializeIonPropertyNamesWithAccessModifiers()
        {
            IIonStruct serialized = StreamToIonValue(defaultSerializer.Serialize(TestObjects.objectWithIonPropertyNameAttributes));

            Assert.AreEqual("Public Value", serialized.GetField("Public Property").StringValue);
            Assert.AreEqual("Protected Internal Value", serialized.GetField("Protected Internal Property").StringValue);
            Assert.AreEqual("Internal Value", serialized.GetField("Internal Property").StringValue);
            Assert.AreEqual("Protected Value", serialized.GetField("Protected Property").StringValue);
            Assert.AreEqual("Private Value", serialized.GetField("Private Property").StringValue);
            Assert.AreEqual("Private Protected Value", serialized.GetField("Private Protected Property").StringValue);
        }