public void CanGetFiles() { var testSave = new SaveLoadTestObject() { testData = "SaveFileExists" }; var serializationMethod = GetSerializationMethod(SerializationMethodType.Binary); var filename = "TestSave.sav"; var folder = "TestFolder"; SaveLoadUtility.Save(testSave, serializationMethod, filename, folder); var files = SaveLoadUtility.GetSavedFiles(folder); Assert.IsTrue(files.Length == 1); //Files should contain a list of names that exactly match the file name used //omits the path of the file Assert.IsTrue(files[0] == filename); SaveLoadUtility.DeleteSavedFile(filename, folder); files = SaveLoadUtility.GetSavedFiles(); Assert.IsTrue(files.Length == 0); }
public void SaveLoadAndDelete([Values] SerializationMethodType method) { var testSave = new SaveLoadTestObject() { testData = "SaveFileExists" }; var serializationMethod = GetSerializationMethod(method); var filename = "TestSave.sav"; SaveLoadUtility.Save(testSave, serializationMethod, filename); Assert.IsTrue(SaveLoadUtility.Exists(filename)); var loadedSave = (SaveLoadTestObject)SaveLoadUtility.Load(typeof(SaveLoadTestObject), serializationMethod, filename); Assert.NotNull(loadedSave); Assert.IsTrue(loadedSave.testData == testSave.testData); SaveLoadUtility.DeleteSavedFile(filename); Assert.IsFalse(SaveLoadUtility.Exists(filename)); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { SaveLoadUtility.Save(_gameSession); }