public void Can_Get_Empty_Values_With_Default() { var reader = new NullConfigReader(); reader.Get<string>("name", null).Should().BeNull(); reader.Get("name", String.Empty).Should().BeEmpty(); reader.Get("name", "default").Should().Be("default"); reader.Get("name", 0).Should().Be(0); reader.Get("name", 1).Should().Be(1); }
public void Cannot_Get_Empty_Values() { Action action; var reader = new NullConfigReader(); action = () => reader.Get<string>("name"); action.ShouldThrow<ConfigurationException>() .WithMessage("Configuration parameter 'name' is not found."); action = () => reader.Get<int>("name"); action.ShouldThrow<ConfigurationException>() .WithMessage("Configuration parameter 'name' is not found."); }