public void Write_And_Read_MultipleData() { List <STestJson> listTestJson = new List <STestJson>(); List <STestJson> listTestJson2 = new List <STestJson>(); for (int i = 0; i < 3; i++) { STestJson pTestJson = new STestJson(); pTestJson.DoSetDataRandom(); listTestJson.Add(pTestJson); } JsonUtilityExtension.DoWriteJsonArray(const_strFolderPath, nameof(Write_And_Read_MultipleData), listTestJson.ToArray()); JsonUtilityExtension.DoReadJsonArray(const_strFolderPath, nameof(Write_And_Read_MultipleData), ref listTestJson2); for (int i = 0; i < 3; i++) { STestJson pTestJson = listTestJson[i]; STestJson pTestJson2 = listTestJson2[i]; Assert.IsTrue(pTestJson._int == pTestJson2._int); Assert.IsTrue(pTestJson._string == pTestJson2._string); Assert.IsTrue(pTestJson._vector3 == pTestJson2._vector3); } }
public void Write_And_Read_SingleData() { STestJson pTestJson = new STestJson(); STestJson pTestJson2 = new STestJson(); pTestJson.DoSetDataRandom(); Assert.IsFalse(pTestJson._int == pTestJson2._int); Assert.IsFalse(pTestJson._string == pTestJson2._string); Assert.IsFalse(pTestJson._vector3 == pTestJson2._vector3); JsonUtilityExtension.DoWriteJson(const_strFolderPath, nameof(Write_And_Read_SingleData), pTestJson); JsonUtilityExtension.DoReadJson(const_strFolderPath, nameof(Write_And_Read_SingleData), out pTestJson2); Assert.IsTrue(pTestJson._int == pTestJson2._int); Assert.IsTrue(pTestJson._string == pTestJson2._string); Assert.IsTrue(pTestJson._vector3 == pTestJson2._vector3); }