2 using System.Collections.Generic;
9 namespace Bovender.UnitTests.UserSettings
15 public void WriteSettings()
19 string yaml = File.ReadAllText(
UserSettings.SettingsFileName);
20 Assert.IsTrue(yaml.Contains(
"LastVersionSeen:"));
24 public void LoadSettings()
27 string yaml =
"# Comment\nLastVersionSeen:\n Major: 3\n Minor: 2\n Patch: 1\n";
28 File.WriteAllText(fn, yaml);
32 Assert.AreEqual(
"3.2.1", o.LastVersionSeen.ToString());
36 public void LoadCorruptedSettings()
39 string yaml =
"LastVersionSeen:\n Major: this_should_be_a_number\n Minor: 2\n Patch: 1\n";
40 File.WriteAllText(fn, yaml);
43 Assert.IsInstanceOf<YamlDotNet.Core.YamlException>(o.
Exception);
void Save()
Saves the user settings to a file.
bool WasFromFile
Is true if the options store was initially loaded from a YAML file.
Exception Exception
Gets the last IOException, if any occurred.