Skip to content
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

Added test to for ConfigurationContext #10535

Merged
merged 6 commits into from
Aug 26, 2024
Merged

Conversation

maridematte
Copy link
Contributor

Fixes #10291

Changes Made

Added test to see if Checks can access and use all configuration (custom and infra) available to them.

@MichalPavlik MichalPavlik merged commit f0a70a4 into dotnet:main Aug 26, 2024
10 checks passed
Copy link
Member

@surayya-MS surayya-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Added a few suggestions for you to consider

@@ -17,9 +17,19 @@ public sealed class Check1 : Check

public override IReadOnlyList<CheckRule> SupportedRules { get; } = new List<CheckRule>() { SupportedRule };

private string message = "Argument for the message format";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: message -> _message

using (var env = TestEnvironment.Create())
{
string checkCandidatePath = Path.Combine(TestAssetsRootPath, "CheckCandidate");
string message = ": An extra message for the analyzer";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ": An extra message for the check"

[Fact]
public void CheckHasAccessToAllConfigs()
{
using (var env = TestEnvironment.Create())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need env here and not the global _env?

// Can't use Transitive environment due to the need to dogfood local nuget packages.
AddCustomDataSourceToNugetConfig(checkCandidatePath);
string editorConfigName = Path.Combine(checkCandidatePath, EditorConfigFileName);
File.WriteAllText(editorConfigName, ReadEditorConfig(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i beleive you can use the existing ReadEditorConfig() method located in the same file EndToEndTests.cs in order to populate config

@maridematte maridematte deleted the 10291 branch October 22, 2024 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create tests for ConfigurationContext
4 participants