コード例 #1
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());
        }
コード例 #2
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);
        }
コード例 #3
0
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }

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

            IAModelReference model = (IAModelReference)obj;

            return((this.Number == model.Number) || (this.Number != null && this.Number.Equals(model.Number)));
        }
コード例 #4
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());
 }
コード例 #5
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);
 }