public void BodyAsReturnsNilTest() { IADeSerialization deSerialization = new IADeSerialization(); deSerialization.SetBodyWith("-"); IAModelWithIntProperty actual = deSerialization.BodyAs <IAModelWithIntProperty>(); Assert.AreEqual(null, actual); }
public void SetBodyWithWithAnIAModelWithIntPropertyTest() { IAModelWithIntProperty model = new IAModelWithIntProperty(); model.Number = 50; IADeSerialization deSerialization = new IADeSerialization(); deSerialization.SetBodyWith(model); Assert.AreEqual("{\"Number\":50}", deSerialization.BodyAsString()); }
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); }
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); }
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()); }
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); }
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); }
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); }