public bool SaveSettings() { if (!IsSettingModifed()) { return(true); } if (string.IsNullOrEmpty(FilePath)) { return(false); } try { var serializer = new XmlFileSerializer <ConfigManager>(FilePath); serializer.Save(this); foreach (var item in Items) { item.IsModified = false; } return(true); } catch (Exception ex) { Log.Error(ex.ToString()); return(false); } }
public void Save_DirectoryNotFound_Throws() { Assert.Throws <DirectoryNotFoundException>(() => _serializer.Save(_fields, _parentFolder.Combine("notthere", "test.txt"), "x")); }