コード例 #1
0
ファイル: TestsReflection.cs プロジェクト: Muraad/PetaJson
        public void ExcludeAttribute()
        {
            var m = new ModelExclude()
            {
                Field1 = "f1",
                Field2 = "f2",
                Field3 = "f3",
                Prop1 = "p1",
                Prop2 = "p2",
                Prop3 = "p3",
            };

            var json = Json.Format(m);

            Assert.Contains(json, "field1");
            Assert.Contains(json, "field2");
            Assert.DoesNotContain(json, "field3");
            Assert.Contains(json, "prop1");
            Assert.Contains(json, "prop2");
            Assert.DoesNotContain(json, "prop3");
        }
コード例 #2
0
ファイル: TestsReflection.cs プロジェクト: Rbartram/PetaJson
        public void ExcludeAttribute()
        {
            var m = new ModelExclude()
            {
                Field1 = "f1",
                Field2 = "f2",
                Field3 = "f3",
                Prop1  = "p1",
                Prop2  = "p2",
                Prop3  = "p3",
            };

            var json = Json.Format(m);

            Assert.Contains(json, "field1");
            Assert.Contains(json, "field2");
            Assert.DoesNotContain(json, "field3");
            Assert.Contains(json, "prop1");
            Assert.Contains(json, "prop2");
            Assert.DoesNotContain(json, "prop3");
        }