public void GetsSimpleValue() { // Given IConfiguration configuration = GetConfiguration(); ConfigurationMetadata metadata = new ConfigurationMetadata(configuration); // When bool result = metadata.TryGetRaw("key0", out object value); // Then result.ShouldBeTrue(); value.ShouldBe("value0"); }
public void GetsSectionValue() { // Given IConfiguration configuration = GetConfiguration(); ConfigurationMetadata metadata = new ConfigurationMetadata(configuration); // When bool result = metadata.TryGetRaw("section0", out object value); object value2 = null; bool result2 = (value as ConfigurationMetadata)?.TryGetRaw("key1", out value2) ?? false; // Then result.ShouldBeTrue(); value.ShouldBeOfType <ConfigurationMetadata>(); result2.ShouldBeTrue(); value2.ShouldBe("value1"); }