-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for configuration settings per environment #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: acraven <9272163+acraven@users.noreply.github.com>
Co-authored-by: acraven <9272163+acraven@users.noreply.github.com>
Co-authored-by: acraven <9272163+acraven@users.noreply.github.com>
acraven
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot looks good, I've made some comments
| private string _originalDirectory; | ||
|
|
||
| [SetUp] | ||
| public void SetUp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to setup_before_each_test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to setup_before_each_test in c6a9a4c
| } | ||
|
|
||
| [TearDown] | ||
| public void TearDown() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to teardown_before_each_test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to teardown_after_each_test in c6a9a4c
| { | ||
| // Get the application name prefix by creating a temporary host | ||
| // This is needed because the prefix is based on the application name with dots removed | ||
| var tempHost = new HostBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just name this host. But as with each other instance, can you use using var host instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use 'using var host' pattern throughout all tests in c6a9a4c
| [Test] | ||
| public void should_load_base_appsettings_json() | ||
| { | ||
| // Arrange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't usually name Arrange, Act and Assert blocks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed Arrange, Act, and Assert comments from all tests in c6a9a4c
|
|
||
| // Act | ||
| var host = new HostBuilder() | ||
| .UseDefaultBuilder(Array.Empty<string>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use empty array initializer instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use empty array initializer [] throughout in c6a9a4c
| public void should_load_environment_variables_with_app_prefix() | ||
| { | ||
| // Arrange | ||
| var appSettingsPath = Path.Combine(_testDirectory, "appsettings.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the appsettings.json file is relevant to the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the unnecessary appsettings.json file from the environment variable test in c6a9a4c
| } | ||
|
|
||
| [Test] | ||
| public void should_prioritize_configuration_sources_correctly() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is 2 separate tests; one to check env vars override appsettings and another to check command line args override env vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split into two separate tests: should_override_appsettings_with_environment_variables and should_override_environment_variables_with_command_line_arguments in c6a9a4c
… comments, split test Co-authored-by: acraven <9272163+acraven@users.noreply.github.com>
All feedback addressed in c6a9a4c:
All 347 tests passing. |
acraven
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.