예제 #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);
 }