public void Test_Add() { var svd = new SaveDataContainer (); var key = "Item0"; var value = new MyStruct (1, 2f, "3"); svd.Add (key, value); Assert.AreEqual (1, svd.ItemCount); Assert.AreEqual (1, svd.Items.Count ()); }
public void Test_LoadOrCreate() { var svd1 = new SaveDataContainer (); svd1.Path = "./savedata2/"; // 存在しない svd1.LoadOrCreate ("TestSaveDataContainer-004.txt"); svd1.Add ("Item", 1); svd1.Save ("TestSaveDataContainer-004.txt"); var svd2 = new SaveDataContainer (); svd2.Path = "./savedata2/"; svd2.Load ("TestSaveDataContainer-004.txt"); Assert.AreEqual (1, svd2.ItemCount); }
public void Test_Save_and_Load_with_Encryption() { var svd1 = new SaveDataContainer (); svd1.Encryption = true; svd1.Add ("Item", new MyStruct (1, 2f, "3")); svd1.Save ("TestSaveDataContainer-002.txt"); var svd2 = new SaveDataContainer (); svd2.Encryption = true; svd2.Load ("TestSaveDataContainer-002.txt"); Assert.AreEqual (1, svd2.ItemCount); Assert.AreEqual (new MyStruct (1, 2f, "3"), svd2.Get ("Item")); }