public void ValidOptions() { var testOptions = new TestOptions(); var userOptionsOntestOptions = new SolutionUserOptions(testOptions); List <SolutionUserOptions> options = new List <SolutionUserOptions> { userOptionsOntestOptions, new SolutionUserOptions(new TestOptionsValid2()), }; List <string> expectedResults = new List <string> { "google_string_1", "google_string_2", "google_string_3", "google_string_4", }; List <string> optionKeys = new List <string>(); foreach (var key in options.SelectMany(setting => setting.Keys)) { optionKeys.Add(key); } CollectionAssert.AreEqual(expectedResults, optionKeys); string testKey = "google_string_1"; Assert.AreEqual("string option 1", userOptionsOntestOptions.Read(testKey)); string newValue = "string opiton new value"; userOptionsOntestOptions.Set(testKey, newValue); Assert.AreEqual(newValue, userOptionsOntestOptions.Read(testKey)); }
protected override void OnSaveOptions(string key, Stream stream) { SolutionUserOptions userSettings = s_userSettings.FirstOrDefault(x => x.Contains(key)); if (userSettings == null) { return; } var value = userSettings.Read(key); WriteOptionStream(stream, value ?? NoneValue); }
protected override void OnLoadOptions(string key, Stream stream) { SolutionUserOptions userSettings = s_userSettings.FirstOrDefault(x => x.Contains(key)); if (userSettings != null) { userSettings.Set(key, ReadOptionStream(stream)); } else { base.OnLoadOptions(key, stream); } }
public void TestOptionsDuplicatekey() { var options = new SolutionUserOptions(new TestOptionsDuplicatekey()); }
public void TestOptionsPrivateGet() { var options = new SolutionUserOptions(new TestOptionsPrivateGet()); }
public void TestOptionsNonStringType() { var options = new SolutionUserOptions(new TestOptionsNonStringType()); }