Example #1
0
        public void AddingSimplePropertyWithJsonAttributeReturnsIdAndName()
        {
            var obj = new NamedDomainObjectWithPropertyIncluded { Name = "TestName" };

            obj.SetIdTo(42);

            var result = JsonConvert.SerializeObject(obj);

            const string jsonString = "{\"Name\":\"TestName\",\"Id\":42}";

            Assert.AreEqual(jsonString, result);
        }
Example #2
0
        public void AddingSimplePropertyWithJsonAttributeReturnsIdAndName()
        {
            var obj = new NamedDomainObjectWithPropertyIncluded {
                Name = "TestName"
            };

            obj.SetIdTo(42);

            var result = JsonConvert.SerializeObject(obj);

            const string jsonString = "{\"Name\":\"TestName\",\"Id\":42}";

            Assert.AreEqual(jsonString, result);
        }