Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use resource string
  • Loading branch information
halter73 committed Jul 8, 2021
commit eb99621dbd4ead612d273994845b144890f544ff
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public string this[string key]
{
if (_providers.Count == 0)
{
throw new InvalidOperationException("A configuration source is not registered. Please register one before setting a value.");
throw new InvalidOperationException(SR.Error_NoSources);
}

foreach (var provider in _providers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,11 @@ public void SetValueThrowsExceptionNoSourceRegistered()

((IConfigurationBuilder)config).Sources.Clear();

var expectedMsg = "A configuration source is not registered. Please register one before setting a value.";

// Act
var ex = Assert.Throws<InvalidOperationException>(() => config["Title"] = "Welcome");

// Assert
Assert.Equal(expectedMsg, ex.Message);
Assert.Equal(SR.Error_NoSources, ex.Message);
}

[Fact]
Expand Down