public void CreateAndReload() { const int TEST_VALUE = 12345; DummyEditorJsonSingleton jsonSingleton = DummyEditorJsonSingleton.GetOrCreateInstance(); jsonSingleton.SetValue(TEST_VALUE); jsonSingleton.SaveInEditor(); DummyEditorJsonSingleton.Close(); jsonSingleton = DummyEditorJsonSingleton.GetOrCreateInstance(); Assert.IsTrue(jsonSingleton.IsDeserialized()); Assert.AreEqual(TEST_VALUE, jsonSingleton.GetValue()); }
public void DeserializeManually() { const int TEST_VALUE = 45678; DummyEditorJsonSingleton jsonSingleton = DummyEditorJsonSingleton.GetOrCreateInstance(); Assert.IsFalse(jsonSingleton.IsDeserialized()); jsonSingleton.SetValue(TEST_VALUE); jsonSingleton.SaveInEditor(); string jsonPath = jsonSingleton.GetJsonPath(); DummyEditorJsonSingleton deserializedSingleton = FileUtility.DeserializeFromJson <DummyEditorJsonSingleton>(jsonPath); Assert.NotNull(deserializedSingleton); Assert.AreEqual(TEST_VALUE, deserializedSingleton.GetValue()); }