public void Test_GetOrCreate() { var svd = new SaveDataContainer (); var key = "Item0"; var value = new MyStruct (1, 2f, "3"); svd.GetOrCreate (key, value); Assert.AreEqual (1, svd.ItemCount); Assert.AreEqual (value, svd.Get (key)); Assert.AreEqual (value, svd[key]); }
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")); }