public void Poco_Serialize() { var expectedSerialization = @"{ 'LastName': 'Torres', 'FirstName': 'Frederic', 'BirthDate': '1964-12-11T00:00:00', 'USCitizen': false, 'Height': 1.8, 'SSN': null }".Replace("'", @""""); var poco1 = new Poco1() { LastName = LASTNAME, FirstName = FIRSTNAME, BirthDate = BIRTHDATE, USCitizen = US_CITIZEN, Height = HEIGHT, SSN = SSN, }; Assert.AreEqual(expectedSerialization, poco1.Serialize()); Assert.AreEqual(expectedSerialization, System.JSON.JSonObject.Serialize(poco1)); }
public void Deserialize() { var poco1 = new Poco1() { LastName = LASTNAME, FirstName = FIRSTNAME, BirthDate = BIRTHDATE, USCitizen = US_CITIZEN, Height = HEIGHT, SSN = SSN, }; var s = poco1.Serialize(); var poco2 = System.JSON.JSonObject.Deserialize <Poco1>(s); Assert.AreEqual(s, poco2.Serialize()); var poco3 = Poco1.Deserialize <Poco1>(s); Assert.AreEqual(s, poco3.Serialize()); }