예제 #1
0
        /// <summary>
        /// Tests serializable properties used for inspection.
        /// </summary>
        static void UnitTest2_SerializableProperties()
        {
            SerializableObject obj = new SerializableObject(typeof(UT1_SerzCls), new UT1_SerzCls());

            SerializableProperty prop = obj.Fields[0].GetProperty();

            prop.SetValue(33);
            DebugUnit.Assert(prop.GetValue <int>() == 33);

            SerializableProperty prop2 = obj.Fields[2].GetProperty();

            UT1_SerzCls child = new UT1_SerzCls();

            child.anotherValue2 = "potato";
            prop2.SetValue <UT1_SerzCls>(child);

            DebugUnit.Assert(prop2.GetValue <UT1_SerzCls>() != null);
            DebugUnit.Assert(prop2.GetValue <UT1_SerzCls>().anotherValue2 == "potato");
        }
예제 #2
0
        /// <summary>
        /// Tests serializable properties used for inspection.
        /// </summary>
        static void UnitTest2_SerializableProperties()
        {
            SerializableObject obj = new SerializableObject(typeof(UT1_SerzCls), new UT1_SerzCls());

            SerializableProperty prop = obj.Fields[0].GetProperty();
            prop.SetValue(33);
            DebugUnit.Assert(prop.GetValue<int>() == 33);

            SerializableProperty prop2 = obj.Fields[2].GetProperty();

            UT1_SerzCls child = new UT1_SerzCls();
            child.anotherValue2 = "potato";
            prop2.SetValue<UT1_SerzCls>(child);

            DebugUnit.Assert(prop2.GetValue<UT1_SerzCls>() != null);
            DebugUnit.Assert(prop2.GetValue<UT1_SerzCls>().anotherValue2 == "potato");
        }