Skip to content

Commit 50bea4c

Browse files
fix the floating issue with tests run in VerifySettingFixture..ctor (#29717)
1 parent c9d928a commit 50bea4c

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/Tests/dotnet-new.Tests/VerifySettingsFixture.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,21 @@ namespace Microsoft.DotNet.Cli.New.IntegrationTests
88
{
99
public class VerifySettingsFixture : IDisposable
1010
{
11-
private static bool _called;
12-
13-
public VerifySettingsFixture()
11+
private static readonly Lazy<bool> _called = new Lazy<bool>(() =>
1412
{
15-
if (_called)
16-
{
17-
return;
18-
}
19-
_called = true;
20-
Verifier.DerivePathInfo(
21-
(_, _, type, method) => new(
22-
directory: "Approvals",
23-
typeName: type.Name,
24-
methodName: method.Name));
13+
DerivePathInfo(
14+
(_, _, type, method) => new(
15+
directory: "Approvals",
16+
typeName: type.Name,
17+
methodName: method.Name));
2518

2619
// Customize diff output of verifier
2720
VerifyDiffPlex.Initialize(OutputType.Compact);
28-
}
21+
22+
return true;
23+
});
24+
25+
public VerifySettingsFixture() => _ = _called.Value;
2926

3027
public void Dispose() { }
3128
}

0 commit comments

Comments
 (0)