public void ReadFromFile_CorrectType_InitializedObject() { HomoSapien sapienOne = new HomoSapien { Age = 30, Name = "Charlie" }; HomoSapien sapienTwo = new HomoSapien(); sapienTwo = JSONDataHandler.ReadFromFile(typeof(HomoSapien), _testFilePath) as HomoSapien; Assert.AreEqual(sapienOne.Age, sapienTwo.Age); Assert.AreEqual(sapienOne.Name, sapienTwo.Name); }
public void DeserializeFromReadStream_CorrectType_InitializedObject() { HomoSapien sapienOne = new HomoSapien { Age = 30, Name = "Charlie" }; HomoSapien sapienTwo = new HomoSapien(); StreamReader _sReader = new StreamReader(_testFilePath); sapienTwo = JSONDataHandler.DeserializeFromReadStream(_sReader, typeof(HomoSapien)) as HomoSapien; Assert.AreEqual(sapienOne.Age, sapienTwo.Age); Assert.AreEqual(sapienOne.Name, sapienTwo.Name); }
public JSONDataHandler_spec() { HomoSapien homoSapien = new HomoSapien { Age = 30, Name = "Charlie" }; JSONDataHandler.WriteToFile(homoSapien, _testFilePath); }