Skip to content

Commit d8f22a5

Browse files
committed
Added a handful of global usings that most test projects utilize. Some individual aliases were required for CLI command names or TemplateEngine classes. Removed global usings that didn't apply to certain projects. Removed unused usings for dotnet-new.Tests as that project errors on unused usings.
1 parent 866b93c commit d8f22a5

File tree

62 files changed

+116
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+116
-162
lines changed

src/Tests/ArgumentsReflector/ArgumentsReflector.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,17 @@
1212
</Content>
1313
</ItemGroup>
1414

15+
<!-- Global usings removal -->
16+
<!-- See: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#using -->
17+
<ItemGroup>
18+
<Using Remove="FluentAssertions" />
19+
<Using Remove="Microsoft.NET.TestFramework" />
20+
<Using Remove="Microsoft.NET.TestFramework.Assertions" />
21+
<Using Remove="Microsoft.NET.TestFramework.Commands" />
22+
<Using Remove="Microsoft.NET.TestFramework.ProjectConstruction" />
23+
<Using Remove="Microsoft.NET.TestFramework.Utilities" />
24+
<Using Remove="Xunit" />
25+
<Using Remove="Xunit.Abstractions" />
26+
</ItemGroup>
27+
1528
</Project>

src/Tests/Common/Program.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
5-
using System.Collections.Generic;
6-
using System.IO;
7-
using System.Linq;
8-
using Microsoft.NET.TestFramework;
9-
using Microsoft.NET.TestFramework.Commands;
10-
114
#pragma warning disable SA1205 // Partial elements should declare access
125
partial class Program
136
#pragma warning restore SA1205 // Partial elements should declare access

src/Tests/Directory.Build.props

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@
2525
<IncludeSymbols>false</IncludeSymbols>
2626
</PropertyGroup>
2727

28+
<!-- Global usings -->
29+
<!-- See: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#using -->
30+
<ItemGroup>
31+
<Using Include="FluentAssertions" />
32+
<Using Include="Microsoft.NET.TestFramework" />
33+
<Using Include="Microsoft.NET.TestFramework.Assertions" />
34+
<Using Include="Microsoft.NET.TestFramework.Commands" />
35+
<Using Include="Microsoft.NET.TestFramework.ProjectConstruction" />
36+
<Using Include="Microsoft.NET.TestFramework.Utilities" />
37+
<Using Include="Xunit" />
38+
<Using Include="Xunit.Abstractions" />
39+
</ItemGroup>
40+
2841
</Project>

src/Tests/HelixTasks/HelixTasks.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,17 @@
1414
<PackageReference Include="NuGet.ProjectModel" Version="$(NuGetProjectModelVersion)" />
1515
</ItemGroup>
1616

17+
<!-- Global usings removal -->
18+
<!-- See: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#using -->
19+
<ItemGroup>
20+
<Using Remove="FluentAssertions" />
21+
<Using Remove="Microsoft.NET.TestFramework" />
22+
<Using Remove="Microsoft.NET.TestFramework.Assertions" />
23+
<Using Remove="Microsoft.NET.TestFramework.Commands" />
24+
<Using Remove="Microsoft.NET.TestFramework.ProjectConstruction" />
25+
<Using Remove="Microsoft.NET.TestFramework.Utilities" />
26+
<Using Remove="Xunit" />
27+
<Using Remove="Xunit.Abstractions" />
28+
</ItemGroup>
29+
1730
</Project>

src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/AliasAssignmentTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.CommandLine;
55
using FakeItEasy;
6-
using FluentAssertions;
76
using Microsoft.TemplateEngine.Abstractions;
87
using Microsoft.TemplateEngine.Cli.Commands;
98
using Microsoft.TemplateEngine.Edge;

src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/BaseTest.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using Microsoft.NET.TestFramework;
5-
64
namespace Microsoft.TemplateEngine.Cli.UnitTests
75
{
86
public abstract class BaseTest

src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/CliTestHostFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using Microsoft.TemplateEngine.Abstractions;
77
using Microsoft.TemplateEngine.Abstractions.PhysicalFileSystem;
88
using Microsoft.TemplateEngine.Edge;
9-
using Microsoft.TemplateEngine.TestHelper;
109
using Microsoft.TemplateEngine.Utils;
10+
using TETestLoggerFactory = Microsoft.TemplateEngine.TestHelper.TestLoggerFactory;
1111

1212
namespace Microsoft.TemplateEngine.Cli.UnitTests
1313
{
@@ -69,7 +69,7 @@ internal CliTestHost(
6969
HostParamDefaults = new Dictionary<string, string>();
7070
FileSystem = fileSystem ?? new PhysicalFileSystem();
7171

72-
_loggerFactory = new TestLoggerFactory();
72+
_loggerFactory = new TETestLoggerFactory();
7373
addLoggerProviders?.ToList().ForEach(_loggerFactory.AddProvider);
7474
_logger = _loggerFactory.CreateLogger("Cli Test Host");
7575
_fallbackNames = fallbackNames ?? new[] { "dotnetcli" };

src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/HelpTests.Resolution.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.CommandLine;
55
using FakeItEasy;
6-
using Microsoft.NET.TestFramework.Utilities;
76
using Microsoft.TemplateEngine.Abstractions;
87
using Microsoft.TemplateEngine.Cli.Commands;
98
using Microsoft.TemplateEngine.Edge;

src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.Subcommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.CommandLine;
55
using FakeItEasy;
6-
using FluentAssertions;
76
using Microsoft.TemplateEngine.Abstractions;
87
using Microsoft.TemplateEngine.Cli.Commands;
98
using Microsoft.TemplateEngine.Edge;

src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/TabCompletionTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.CommandLine;
55
using System.CommandLine.Completions;
66
using FakeItEasy;
7-
using Microsoft.NET.TestFramework;
87
using Microsoft.TemplateEngine.Abstractions;
98
using Microsoft.TemplateEngine.Abstractions.Constraints;
109
using Microsoft.TemplateEngine.Cli.Commands;

0 commit comments

Comments
 (0)