Exemplo n.º 1
0
        public void IgnoreAttributes()
        {
            var i = new ignore {
                Age1 = 10, Age2 = 20, Name = "aa"
            };
            string s = JSON.ToJSON(i);

            Console.WriteLine(s);
            Assert.IsFalse(s.Contains("Age1"));
            i = new ignore1 {
                Age1 = 10, Age2 = 20, Name = "bb"
            };
            var j = new JSONParameters();

            j.IgnoreAttributes.Add(typeof(ignoreatt));
            s = JSON.ToJSON(i, j);
            Console.WriteLine(s);
            Assert.IsFalse(s.Contains("Age1"));
            Assert.IsFalse(s.Contains("Age2"));
        }
Exemplo n.º 2
0
        public void IgnoreAttributes()
        {
            var i = new ignore {
                Age1 = 10, Age2 = 20, Name = "aa"
            };
            var s = Json.ToJson(i);

            Console.WriteLine(s);
            Assert.IsFalse(s.Contains("Age1"));
            i = new ignore1 {
                Age1 = 10, Age2 = 20, Name = "bb"
            };
            var j = new SerializationManager();

            (j.ReflectionController as JsonReflectionController).IgnoreAttributes.Add(typeof(ignoreatt));
            s = Json.ToJson(i, j);
            Console.WriteLine(s);
            Assert.IsFalse(s.Contains("Age1"));
            Assert.IsFalse(s.Contains("Age2"));
        }
Exemplo n.º 3
0
        public static void IgnoreAttributes()
        {
            var i = new ignore {
                Age1 = 10, Age2 = 20, Name = "aa"
            };
            var s = fastBinaryJSON.BJSON.ToBJSON(i);
            var o = fastBinaryJSON.BJSON.ToObject <ignore>(s);

            Assert.AreEqual(0, o.Age1);
            i = new ignore1 {
                Age1 = 10, Age2 = 20, Name = "bb"
            };
            var j = new BJSONParameters();

            j.IgnoreAttributes.Add(typeof(ignoreatt));
            s = fastBinaryJSON.BJSON.ToBJSON(i, j);
            var oo = fastBinaryJSON.BJSON.ToObject <ignore1>(s);

            Assert.AreEqual(0, oo.Age1);
            Assert.AreEqual(0, oo.Age2);
        }
Exemplo n.º 4
0
 public static void IgnoreAttributes()
 {
     var i = new ignore { Age1 = 10, Age2 = 20, Name = "aa" };
     var s = fastBinaryJSON.BJSON.ToBJSON(i);
     var o = fastBinaryJSON.BJSON.ToObject<ignore>(s);
     Assert.AreEqual(0, o.Age1);
     i = new ignore1 { Age1 = 10, Age2 = 20, Name = "bb" };
     var j = new BJSONParameters();
     j.IgnoreAttributes.Add(typeof(ignoreatt));
     s = fastBinaryJSON.BJSON.ToBJSON(i, j);
     var oo = fastBinaryJSON.BJSON.ToObject<ignore1>(s);
     Assert.AreEqual(0, oo.Age1);
     Assert.AreEqual(0, oo.Age2);
 }
Exemplo n.º 5
0
 var(ignore, err)    = compileRegexOption("ignore", v["ignore"].value, err);