Skip to content

Commit 649bc73

Browse files
committed
Rename test project. Switch to TUnit. Switch to AwesomeAssertions
1 parent 019c82e commit 649bc73

36 files changed

+346
-313
lines changed

CSharpier.slnx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
</Folder>
1919
<Folder Name="/Src/">
2020
<Project Path="Src/CSharpier.Benchmarks/CSharpier.Benchmarks.csproj" />
21-
<Project Path="Src/CSharpier.Cli.Tests/CSharpier.Cli.Tests.csproj" />
2221
<Project Path="Src/CSharpier.Cli/CSharpier.Cli.csproj" />
2322
<Project Path="Src/CSharpier.Core/CSharpier.Core.csproj" />
2423
<Project Path="Src/CSharpier.Generators/CSharpier.Generators.csproj" />
2524
<Project Path="Src/CSharpier.MsBuild/MsBuild.csproj" />
2625
<Project Path="Src/CSharpier.Playground/CSharpier.Playground.csproj" />
27-
<Project Path="Src/CSharpier.Tests.Generators/CSharpier.Tests.Generators.csproj" />
2826
<Project Path="Src/CSharpier.Tests/CSharpier.Tests.csproj" />
27+
<Project Path="Src/CSharpierProcess.Tests/CSharpierProcess.Tests.csproj" />
2928
<Project Path="Src/SyntaxFinder/SyntaxFinder.csproj" />
3029
<Project Path="Src/Website/Website.csproj" />
3130
</Folder>

Directory.Packages.props

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageVersion Include="BenchmarkDotNet.Annotations" Version="0.15.5" />
99
<PackageVersion Include="CliWrap" Version="3.9.0" />
1010
<PackageVersion Include="DiffEngine" Version="7.3.0" />
11-
<PackageVersion Include="FluentAssertions" Version="8.8.0" />
11+
<PackageVersion Include="AwesomeAssertions" Version="9.3.0" />
1212
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
1313
<PackageVersion Include="ini-parser-netstandard" Version="2.5.3" />
1414
<PackageVersion Include="LibGit2Sharp" Version="0.31.0" />
@@ -19,10 +19,8 @@
1919
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="4.14.0" />
2020
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
2121
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.10" />
22-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
2322
<PackageVersion Include="NReco.Logging.File" Version="1.2.2" />
24-
<PackageVersion Include="NUnit" Version="4.4.0" />
25-
<PackageVersion Include="NUnit3TestAdapter" Version="5.2.0" />
23+
<PackageVersion Include="TUnit" Version="1.5.80" />
2624
<PackageVersion Include="PolySharp" Version="1.15.0" />
2725
<PackageVersion Include="Scriban" Version="6.5.0" />
2826
<PackageVersion Include="Serilog.Extensions.Logging.File" Version="3.0.0" />

Src/CSharpier.Cli/CSharpier.Cli.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<_Parameter1>CSharpier.Tests, PublicKey=$(PublicKey)</_Parameter1>
4040
</AssemblyAttribute>
4141
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
42-
<_Parameter1>CSharpier.Cli.Tests, PublicKey=$(PublicKey)</_Parameter1>
42+
<_Parameter1>CSharpierProcess.Tests, PublicKey=$(PublicKey)</_Parameter1>
4343
</AssemblyAttribute>
4444
</ItemGroup>
4545
<ItemGroup>
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
#pragma warning disable CA1707
2+
using TUnit.Core;
23

3-
using NUnit.Framework;
4+
namespace CSharpier.Tests.FormattingTests;
45

5-
namespace CSharpier.Tests.FormattingTests
6+
public class FormattingTests_{{ FileExtension }} : BaseTest
67
{
7-
[TestFixture]
8-
[Parallelizable(ParallelScope.All)]
9-
public class FormattingTests_{{ FileExtension }} : BaseTest
8+
{{- for test in Tests }}
9+
[Test]
10+
public Task {{ test.Name }}()
1011
{
11-
{{- for test in Tests }}
12-
[Test]
13-
public Task {{ test.Name }}()
14-
{
15-
return this.RunTest("{{ test.Name }}", "{{ test.FileExtension }}"{{ if test.UseTabs }}, true{{ end }});
16-
}
17-
{{- end }}
12+
return this.RunTest("{{ test.Name }}", "{{ test.FileExtension }}"{{ if test.UseTabs }}, true{{ end }});
1813
}
14+
{{- end }}
1915
}

Src/CSharpier.Tests/CSharp/CSharpFormatterTests.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
using AwesomeAssertions;
12
using CSharpier.Core;
23
using CSharpier.Core.CSharp;
3-
using FluentAssertions;
44
using Microsoft.CodeAnalysis.CSharp;
5-
using NUnit.Framework;
65

76
namespace CSharpier.Tests.CSharp;
87

9-
[TestFixture]
10-
[Parallelizable(ParallelScope.All)]
118
internal sealed class CSharpFormatterTests
129
{
1310
[Test]
@@ -125,8 +122,9 @@ public void Format_Should_Format_Generated_Files()
125122
result.Code.Should().Be(code.Replace(" = ", " = "));
126123
}
127124

128-
[TestCase("\n")]
129-
[TestCase("\r\n")]
125+
[Test]
126+
[Arguments("\n")]
127+
[Arguments("\r\n")]
130128
public void Format_Should_Get_Line_Endings_With_SyntaxTree(string lineEnding)
131129
{
132130
var code = $"public class ClassName {{{lineEnding}}}";

Src/CSharpier.Tests/CSharp/DisabledTextComparerTests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1+
using AwesomeAssertions;
12
using CSharpier.Core.CSharp;
2-
using FluentAssertions;
3-
using NUnit.Framework;
43

54
namespace CSharpier.Tests.CSharp;
65

7-
[TestFixture]
8-
[Parallelizable(ParallelScope.All)]
96
public class DisabledTextComparerTests
107
{
118
[Test]

Src/CSharpier.Tests/CSharp/PreprocessorSymbolsTests.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1+
using AwesomeAssertions;
12
using CSharpier.Core.CSharp;
2-
using FluentAssertions;
3-
using NUnit.Framework;
43

54
namespace CSharpier.Tests.CSharp;
65

7-
[TestFixture]
86
public class PreprocessorSymbolsTests
97
{
10-
[TestCase("DEBUG")]
11-
[TestCase("NET48")]
12-
[TestCase("NET48_OR_GREATER")]
8+
[Test]
9+
[Arguments("DEBUG")]
10+
[Arguments("NET48")]
11+
[Arguments("NET48_OR_GREATER")]
1312
public void GetSets_Should_Handle_Basic_If(string symbol)
1413
{
1514
RunTest(

Src/CSharpier.Tests/CSharp/SyntaxNodeComparerTests.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
using AwesomeAssertions;
12
using CSharpier.Core.CSharp;
2-
using FluentAssertions;
33
using Microsoft.CodeAnalysis;
4-
using NUnit.Framework;
54

65
namespace CSharpier.Tests.CSharp;
76

8-
[TestFixture]
9-
[Parallelizable(ParallelScope.All)]
107
public class SyntaxNodeComparerTests
118
{
129
[Test]
@@ -299,9 +296,10 @@ public class ClassName { }
299296
);
300297
}
301298

302-
[TestCase("@")]
303-
[TestCase("@$")]
304-
[TestCase("$@")]
299+
[Test]
300+
[Arguments("@")]
301+
[Arguments("@$")]
302+
[Arguments("$@")]
305303
public void Mismatched_Line_Endings_In_Verbatim_String_Should_Not_Print_Error(string start)
306304
{
307305
var left =
@@ -570,8 +568,9 @@ public void Sorted_Usings_With_Header_Pass_Validation()
570568
result.Should().BeEmpty();
571569
}
572570

573-
[TestCase("namespace Namespace { }")]
574-
[TestCase("namespace Namespace;")]
571+
[Test]
572+
[Arguments("namespace Namespace { }")]
573+
[Arguments("namespace Namespace;")]
575574
public void Usings_With_Directives_Pass_Validation(string content)
576575
{
577576
// The problem is that the #endif leading trivia to the ClassDeclaration

Src/CSharpier.Tests/CSharp/SyntaxPrinter/CSharpierIgnoreTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
using AwesomeAssertions;
12
using CSharpier.Core.CSharp.SyntaxPrinter;
2-
using FluentAssertions;
3-
using NUnit.Framework;
43

54
namespace CSharpier.Tests.CSharp.SyntaxPrinter;
65

7-
[TestFixture]
86
public class CSharpierIgnoreTests
97
{
108
[Test]

Src/CSharpier.Tests/CSharpier.Tests.csproj

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,10 @@
1313
<PackageReference Include="FluentAssertions" />
1414
<PackageReference Include="GitHubActionsTestLogger" PrivateAssets="all" />
1515
<PackageReference Include="LibGit2Sharp" />
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" />
17-
<PackageReference Include="NUnit" />
18-
<PackageReference Include="NUnit3TestAdapter" />
16+
<PackageReference Include="TUnit" />
1917
</ItemGroup>
2018
<ItemGroup>
2119
<ProjectReference Include="..\CSharpier.Cli\CSharpier.Cli.csproj" />
22-
<ProjectReference
23-
Include="..\CSharpier.Tests.Generators\CSharpier.Tests.Generators.csproj"
24-
OutputItemType="Analyzer"
25-
ReferenceOutputAssembly="false"
26-
/>
2720
<ProjectReference Include="..\CSharpier.Core\CSharpier.Core.csproj" />
2821
</ItemGroup>
2922
<ItemGroup>

0 commit comments

Comments
 (0)