コード例 #1
0
        public void BodyAsReturnsNilTest()
        {
            IADeSerialization deSerialization = new IADeSerialization();

            deSerialization.SetBodyWith("-");
            IAModelWithIntProperty actual = deSerialization.BodyAs <IAModelWithIntProperty>();

            Assert.AreEqual(null, actual);
        }
コード例 #2
0
        public void SetBodyWithWithAnIAModelWithIntPropertyTest()
        {
            IAModelWithIntProperty model = new IAModelWithIntProperty();

            model.Number = 50;
            IADeSerialization deSerialization = new IADeSerialization();

            deSerialization.SetBodyWith(model);
            Assert.AreEqual("{\"Number\":50}", deSerialization.BodyAsString());
        }
コード例 #3
0
 public void BodyAsIAModelReferenceTest()
 {
     IAModelWithIntProperty model = new IAModelWithIntProperty();
     model.Number = 50;
     IAModelReference expected = new IAModelReference();
     expected.Number = model;
     IADeSerialization deSerialization = new IADeSerialization();
     deSerialization.SetBodyWith(expected);
     IAModelReference actual = deSerialization.BodyAs<IAModelReference>();
     Assert.AreEqual(expected, actual);
 }
コード例 #4
0
        public void BodyAsIAModelWithIntPropertyTest()
        {
            IAModelWithIntProperty expected = new IAModelWithIntProperty();

            expected.Number = 50;
            IADeSerialization deSerialization = new IADeSerialization();

            deSerialization.SetBodyWith(expected);
            IAModelWithIntProperty actual = deSerialization.BodyAs <IAModelWithIntProperty>();

            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void SetBodyWithWithAnIAModelReferenceTest()
        {
            IAModelWithIntProperty intprop = new IAModelWithIntProperty();

            intprop.Number = 50;
            IAModelReference model = new IAModelReference();

            model.Number = intprop;
            IADeSerialization deSerialization = new IADeSerialization();

            deSerialization.SetBodyWith(model);
            Assert.AreEqual("{\"Number\":{\"Number\":50}}", deSerialization.BodyAsString());
        }
コード例 #6
0
        public void BodyAsIAModelReferenceTest()
        {
            IAModelWithIntProperty model = new IAModelWithIntProperty();

            model.Number = 50;
            IAModelReference expected = new IAModelReference();

            expected.Number = model;
            IADeSerialization deSerialization = new IADeSerialization();

            deSerialization.SetBodyWith(expected);
            IAModelReference actual = deSerialization.BodyAs <IAModelReference>();

            Assert.AreEqual(expected, actual);
        }
コード例 #7
0
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            if (obj == null || (obj as IAModelWithIntProperty) == null)
            {
                return(false);
            }

            IAModelWithIntProperty model = (IAModelWithIntProperty)obj;

            return(this.Number == model.Number);
        }
コード例 #8
0
 public void SetBodyWithWithAnIAModelWithIntPropertyTest()
 {
     IAModelWithIntProperty model = new IAModelWithIntProperty();
     model.Number = 50;
     IADeSerialization deSerialization = new IADeSerialization();
     deSerialization.SetBodyWith(model);
     Assert.AreEqual("{\"Number\":50}", deSerialization.BodyAsString());
 }
コード例 #9
0
 public void SetBodyWithWithAnIAModelReferenceTest()
 {
     IAModelWithIntProperty intprop = new IAModelWithIntProperty();
     intprop.Number = 50;
     IAModelReference model = new IAModelReference();
     model.Number = intprop;
     IADeSerialization deSerialization = new IADeSerialization();
     deSerialization.SetBodyWith(model);
     Assert.AreEqual("{\"Number\":{\"Number\":50}}", deSerialization.BodyAsString());
 }
コード例 #10
0
 public void BodyAsIAModelWithIntPropertyTest()
 {
     IAModelWithIntProperty expected = new IAModelWithIntProperty();
     expected.Number = 50;
     IADeSerialization deSerialization = new IADeSerialization();
     deSerialization.SetBodyWith(expected);
     IAModelWithIntProperty actual = deSerialization.BodyAs<IAModelWithIntProperty>();
     Assert.AreEqual(expected, actual);
 }