The windows registry store can now enumerate non-existing categories, too

git-svn-id: file:///srv/devel/repo-conversion/nusu@323 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2014-07-22 22:04:16 +00:00
parent f74f1d0c6c
commit 52401a43ac
3 changed files with 15 additions and 2 deletions

View File

@ -319,7 +319,7 @@ namespace Nuclex.Support.Settings {
}
/// <summary>
/// Verifies that it's possible to assign an empty value to an option
/// Verifies that options are removed from the configuration file correctly
/// </summary>
[Test]
public void RemovingOptionShiftsFollowingOptionsUp() {
@ -355,7 +355,7 @@ namespace Nuclex.Support.Settings {
}
/// <summary>
/// Verifies that it's not an error to remove a non-existing option
/// Verifies that the configuration file store can identify various types of values
/// </summary>
[
Test,

View File

@ -180,6 +180,16 @@ namespace Nuclex.Support.Settings {
}
}
/// <summary>
/// Verifies that it's possible to enumerate a category that doesn't exist
/// </summary>
[Test]
public void NonExistingCategoryCanBeEnumerated() {
using(var context = new TestContext()) {
Assert.That(context.Store.EnumerateOptions("doesn't exist"), Is.Empty);
}
}
/// <summary>Verifies that byte arrays can be stored in the registry</summary>
[Test]
public void ByteArraysCanBeStored() {

View File

@ -82,6 +82,9 @@ namespace Nuclex.Support.Settings {
}
} else {
using(RegistryKey categoryKey = this.rootKey.OpenSubKey(category, this.writable)) {
if(categoryKey == null) {
yield break;
}
string[] valueNames = categoryKey.GetValueNames();
for(int index = 0; index < valueNames.Length; ++index) {
yield return new OptionInfo() {