Esempio n. 1
0
		public SerializationTestClass()
		{
			NumValue = ulong.MaxValue / 3;
			NumValue2 = 123;
			FloatValue = 4.565e+25m;
			FloatValue2 = double.MaxValue / 5;
			EnumField = SerializationEnumTest.Ok3 | SerializationEnumTest.Ok1;
			TimeField = DateTime.UtcNow;

			TestHash2 = new HashSet<object>();
			TestHash2.Add(new object());
			TestHash2.Add(3);
			TestHash2.Add(5);
			TestHash2.Add(SerializationEnumTest.Ok2);

			TestHash = new HashSet<float>();
			TestHash.Add(1);
			TestHash.Add(2);
			TestHash.Add(3);

			TestDic = new Dictionary<int, string>();
			TestDic[1] = "one";
			TestDic[2] = "two";
			TestDic[3] = "three";

			m_nullPointer = null;
			m_circlePoiter = this;

			BackingProperty = "this is a property";

			SerializeType = typeof(DateTime);
		}
Esempio n. 2
0
        public static void CustomClassSerializationTest()
        {
            //TODO: Ask Pedro

            /*SerializationServices.AssemblyLoader = assemblyLoader;
             *          SerializationServices.InstanceFactory = factory;*/

            var value = new SerializationTestClass();

            var serializer = new JSONSerializer();
            var json       = serializer.SerializeToJson(value);

            json.Write(Console.Out, true);
            var other = serializer.DeserializeFromJson <SerializationTestClass>(json);

            Assert.IsNull(other.VolatileField);
        }