Refactor tests that cause warnings in CI#51730
Conversation
| } | ||
|
|
||
| public static IEnumerable<object[]> AnalyzeMethodsInEnabledContextOnly_01_Data() | ||
| // AnalyzeMethodsInEnabledContextOnly_01_Data is splitted due to https://github.com/dotnet/roslyn/issues/50337 |
| { | ||
| public class NullableContextTests : CSharpTestBase | ||
| { | ||
| private static readonly NullableDirectives[] s_nullableDirectives = new[] |
There was a problem hiding this comment.
s_nullableDirectives [](start = 53, length = 20)
Consider moving this immediately before AnalyzeMethodsInEnabledContextOnly_01_Data1().
| [Theory] | ||
| [MemberData(nameof(AnalyzeMethodsInEnabledContextOnly_01_Data))] | ||
| [MemberData(nameof(AnalyzeMethodsInEnabledContextOnly_01_Data1))] | ||
| [MemberData(nameof(AnalyzeMethodsInEnabledContextOnly_01_Data2))] |
There was a problem hiding this comment.
Does this address the issue? Don't we still have the same number of test results per test?
There was a problem hiding this comment.
@cston I'm waiting for CI to check. But I think while it's the same number per test, it's not the same number per test case. The warning is about "subresults in test case". But CI will say its decision 😄
There was a problem hiding this comment.
If the same issue exists, consider having two tests that share a common helper in each case.
[MemberData(nameof(AnalyzeMethodsInEnabledContextOnly_01_Data1)]
public void AnalyzeMethodsInEnabledContextOnly_01A(NullableContextOptions? projectContext,
NullableDirectives classDirectives, NullableDirectives methodDirectives)
{
AnalyzeMethodsInEnabledContextOnly_01_Execute(projectContext, classDirectives, methodDirectives);
}
[MemberData(nameof(AnalyzeMethodsInEnabledContextOnly_01_Data2)]
public void AnalyzeMethodsInEnabledContextOnly_01B(NullableContextOptions? projectContext,
NullableDirectives classDirectives, NullableDirectives methodDirectives)
{
AnalyzeMethodsInEnabledContextOnly_01_Execute(projectContext, classDirectives, methodDirectives);
}
private void AnalyzeMethodsInEnabledContextOnly_01_Execute(NullableContextOptions? projectContext,
NullableDirectives classDirectives, NullableDirectives methodDirectives)
{
...
}In reply to: 589068480 [](ancestors = 589068480)
There was a problem hiding this comment.
@cston You're correct, the warnings are still there 😕
I don't have a good solution in mind. Duplicating the exact same test doesn't seem to be a good option. I'll close and let someone else come with a good solution.
There was a problem hiding this comment.
@cston Oh, I had the PR tab open and it didn't show your previous reply when I responded. I'll reopen and apply your change. Thanks.
|
Warnings are fixed 🎉 Thanks @cston |
|
Thanks @Youssef1313! |


Fixes #50337