Skip to content

Commit afeab7c

Browse files
committed
fix: update dependencies and convert FluentAssertions to Shouldly due to licensing
1 parent 59ed686 commit afeab7c

File tree

14 files changed

+173
-202
lines changed

14 files changed

+173
-202
lines changed

Catglobe.ResXFileCodeGenerator.Tests/AdditionalTextStub.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using Microsoft.CodeAnalysis;
2-
using Microsoft.CodeAnalysis.Text;
3-
4-
namespace Catglobe.ResXFileCodeGenerator.Tests;
1+
namespace Catglobe.ResXFileCodeGenerator.Tests;
52

63
internal class AdditionalTextStub : AdditionalText
74
{

Catglobe.ResXFileCodeGenerator.Tests/Catglobe.ResXFileCodeGenerator.Tests.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<LangVersion>latest</LangVersion>
77
<Nullable>enable</Nullable>
@@ -11,19 +11,19 @@
1111
<Import Project="../Catglobe.ResXFileCodeGenerator/build/Catglobe.ResXFileCodeGenerator.props" />
1212

1313
<ItemGroup>
14-
<PackageReference Include="FluentAssertions" Version="6.12.0" />
15-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
14+
<PackageReference Include="Shouldly" Version="4.3.0" />
15+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
</PackageReference>
19-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
21-
<PackageReference Include="xunit" Version="2.5.3" />
22-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
19+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
20+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
21+
<PackageReference Include="xunit" Version="2.9.3" />
22+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2424
<PrivateAssets>all</PrivateAssets>
2525
</PackageReference>
26-
<PackageReference Include="coverlet.collector" Version="6.0.0">
26+
<PackageReference Include="coverlet.collector" Version="6.0.4">
2727
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2828
<PrivateAssets>all</PrivateAssets>
2929
</PackageReference>

Catglobe.ResXFileCodeGenerator.Tests/CodeGenTests.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using FluentAssertions;
2-
using Xunit;
3-
using static System.Guid;
4-
5-
namespace Catglobe.ResXFileCodeGenerator.Tests;
1+
namespace Catglobe.ResXFileCodeGenerator.Tests;
62

73
public class CodeGenTests
84
{
@@ -267,8 +263,8 @@ namespace Resources;
267263
StaticMembers = staticMembers
268264
}
269265
);
270-
ErrorsAndWarnings.Should().BeNullOrEmpty();
271-
SourceCode.ReplaceLineEndings().Should().Be(expected.ReplaceLineEndings());
266+
ErrorsAndWarnings.ShouldBeEmpty();
267+
SourceCode.ReplaceLineEndings().ShouldBe(expected.ReplaceLineEndings());
272268
}
273269

274270

Catglobe.ResXFileCodeGenerator.Tests/GeneratorTests.cs

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using FluentAssertions;
2-
using Microsoft.CodeAnalysis;
3-
using Xunit;
4-
using static System.Guid;
5-
6-
namespace Catglobe.ResXFileCodeGenerator.Tests;
1+
namespace Catglobe.ResXFileCodeGenerator.Tests;
72

83
public class GeneratorTests
94
{
@@ -132,8 +127,8 @@ namespace Resources;
132127
StaticMembers = staticMembers
133128
}
134129
);
135-
ErrorsAndWarnings.Should().BeNullOrEmpty();
136-
SourceCode.ReplaceLineEndings().Should().Be(expected.ReplaceLineEndings());
130+
ErrorsAndWarnings.ShouldBeEmpty();
131+
SourceCode.ReplaceLineEndings().ShouldBe(expected.ReplaceLineEndings());
137132
}
138133

139134
private static void GenerateInner(
@@ -202,8 +197,8 @@ namespace Resources;
202197
InnerClassInstanceName = innerClassInstanceName
203198
}
204199
);
205-
ErrorsAndWarnings.Should().BeNullOrEmpty();
206-
SourceCode.ReplaceLineEndings().Should().Be(expected.ReplaceLineEndings());
200+
ErrorsAndWarnings.ShouldBeEmpty();
201+
SourceCode.ReplaceLineEndings().ShouldBe(expected.ReplaceLineEndings());
207202
}
208203

209204
[Fact]
@@ -473,8 +468,8 @@ public static class CommonMessages
473468
StaticMembers = true
474469
}
475470
);
476-
ErrorsAndWarnings.Should().BeNullOrEmpty();
477-
SourceCode.ReplaceLineEndings().Should().Be(expected.ReplaceLineEndings());
471+
ErrorsAndWarnings.ShouldBeEmpty();
472+
SourceCode.ReplaceLineEndings().ShouldBe(expected.ReplaceLineEndings());
478473
}
479474

480475
[Fact]
@@ -530,8 +525,8 @@ public static class CommonMessages
530525
StaticMembers = true
531526
}
532527
);
533-
ErrorsAndWarnings.Should().BeNullOrEmpty();
534-
SourceCode.ReplaceLineEndings().Should().Be(expected.ReplaceLineEndings());
528+
ErrorsAndWarnings.ShouldBeEmpty();
529+
SourceCode.ReplaceLineEndings().ShouldBe(expected.ReplaceLineEndings());
535530
}
536531

537532
[Fact]
@@ -565,12 +560,12 @@ public void Generate_StringBuilder_Name_DuplicatedataGivesWarning()
565560
}
566561
);
567562
var errs = ErrorsAndWarnings.ToList();
568-
errs.Should().NotBeNull();
569-
errs.Should().HaveCount(1);
570-
errs[0].Id.Should().Be("CatglobeResXFileCodeGenerator001");
571-
errs[0].Severity.Should().Be(DiagnosticSeverity.Warning);
572-
errs[0].GetMessage().Should().Contain("DupKey");
573-
errs[0].Location.GetLineSpan().StartLinePosition.Line.Should().Be(5);
563+
errs.ShouldNotBeNull();
564+
errs.Count.ShouldBe(1);
565+
errs[0].Id.ShouldBe("CatglobeResXFileCodeGenerator001");
566+
errs[0].Severity.ShouldBe(DiagnosticSeverity.Warning);
567+
errs[0].GetMessage().ShouldContain("DupKey");
568+
errs[0].Location.GetLineSpan().StartLinePosition.Line.ShouldBe(5);
574569
}
575570

576571
[Fact]
@@ -601,25 +596,25 @@ public void Generate_StringBuilder_Name_MemberSameAsFileGivesWarning()
601596
}
602597
);
603598
var errs = ErrorsAndWarnings.ToList();
604-
errs.Should().NotBeNull();
605-
errs.Should().HaveCount(1);
606-
errs[0].Id.Should().Be("CatglobeResXFileCodeGenerator002");
607-
errs[0].Severity.Should().Be(DiagnosticSeverity.Warning);
608-
errs[0].GetMessage().Should().Contain("CommonMessages");
609-
errs[0].Location.GetLineSpan().StartLinePosition.Line.Should().Be(2);
599+
errs.ShouldNotBeNull();
600+
errs.Count.ShouldBe(1);
601+
errs[0].Id.ShouldBe("CatglobeResXFileCodeGenerator002");
602+
errs[0].Severity.ShouldBe(DiagnosticSeverity.Warning);
603+
errs[0].GetMessage().ShouldContain("CommonMessages");
604+
errs[0].Location.GetLineSpan().StartLinePosition.Line.ShouldBe(2);
610605
}
611606

612607
[Fact]
613608
public void GetLocalNamespace_ShouldNotGenerateIllegalNamespace()
614609
{
615610
var ns = Utilities.GetLocalNamespace("resx", "asd.asd", "path", "name", "root");
616-
ns.Should().Be("root");
611+
ns.ShouldBe("root");
617612
}
618613

619614
[Fact]
620615
public void ResxFileName_ShouldNotGenerateIllegalClassnames()
621616
{
622617
var ns = Utilities.GetClassNameFromPath("test.cshtml.resx");
623-
ns.Should().Be("test");
618+
ns.ShouldBe("test");
624619
}
625620
}

Catglobe.ResXFileCodeGenerator.Tests/GithubIssues/Issue3/GeneratorTests.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System.Xml;
2-
using FluentAssertions;
3-
using Xunit;
4-
using static System.Guid;
5-
6-
namespace Catglobe.ResXFileCodeGenerator.Tests.GithubIssues.Issue3;
1+
namespace Catglobe.ResXFileCodeGenerator.Tests.GithubIssues.Issue3;
72

83
public class GeneratorTests
94
{
@@ -118,8 +113,8 @@ public static class CommonMessages
118113
StaticMembers = true
119114
}
120115
);
121-
source.ErrorsAndWarnings.Should().BeNullOrEmpty();
122-
source.SourceCode.ReplaceLineEndings().Should().Be(expected.ReplaceLineEndings());
116+
source.ErrorsAndWarnings.ShouldBeEmpty();
117+
source.SourceCode.ReplaceLineEndings().ShouldBe(expected.ReplaceLineEndings());
123118
}
124119

125120
[Fact]
@@ -206,6 +201,9 @@ public void Generate_StringBuilder_Value_InvalidCharacter()
206201
NullForgivingOperators = false,
207202
StaticClass = true
208203
};
209-
generator.Invoking(subject => subject.Generate(options)).Should().Throw<XmlException>();
204+
Should.Throw<XmlException>(() =>
205+
{
206+
generator.Generate(options);
207+
});
210208
}
211209
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
global using System.Diagnostics.CodeAnalysis;
2+
global using System.Globalization;
3+
global using System.Xml;
4+
global using Microsoft.CodeAnalysis;
5+
global using Microsoft.CodeAnalysis.Diagnostics;
6+
global using Microsoft.CodeAnalysis.Text;
7+
global using Shouldly;
8+
global using Xunit;
9+
global using static System.Guid;

Catglobe.ResXFileCodeGenerator.Tests/GroupResxFilesTests.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using FluentAssertions;
2-
using Xunit;
3-
using static System.Guid;
4-
5-
namespace Catglobe.ResXFileCodeGenerator.Tests;
1+
namespace Catglobe.ResXFileCodeGenerator.Tests;
62

73
public class GroupResxFilesTests
84
{
@@ -26,7 +22,7 @@ public void CompareGroupedAdditionalFile_SameRoot_SameSubFiles_DifferentOrder()
2622
new AdditionalTextWithHash(new AdditionalTextStub(@"D:\src\xhg\y\Areas\CaModule\Pages\IdfgControlCenter.da.resx"), Parse("B7EDA261-6923-4526-AFB7-B2A64984F099")),
2723
}
2824
);
29-
v1.Should().Be(v2);
25+
v1.ShouldBe(v2);
3026
}
3127

3228
[Fact]
@@ -49,7 +45,7 @@ public void CompareGroupedAdditionalFile_SameRoot_DiffSubFilesNames()
4945
new AdditionalTextWithHash(new AdditionalTextStub(@"D:\src\xhg\y\Areas\CaModule\Pages\IdfgControlCenter.ro.resx"), Parse("B7EDA261-6923-4526-AFB7-B2A64984F099")),
5046
}
5147
);
52-
v1.Should().NotBe(v2);
48+
v1.ShouldNotBe(v2);
5349
}
5450

5551
[Fact]
@@ -72,7 +68,7 @@ public void CompareGroupedAdditionalFile_SameRoot_DiffSubFileContent()
7268
new AdditionalTextWithHash(new AdditionalTextStub(@"D:\src\xhg\y\Areas\CaModule\Pages\IdfgControlCenter.da.resx"), Parse("B7EDA261-6923-4526-AFB7-B2A64984F099")),
7369
}
7470
);
75-
v1.Should().NotBe(v2);
71+
v1.ShouldNotBe(v2);
7672
}
7773

7874
[Fact]
@@ -95,7 +91,7 @@ public void CompareGroupedAdditionalFile_DiffRootContent_SameSubFiles()
9591
new AdditionalTextWithHash(new AdditionalTextStub(@"D:\src\xhg\y\Areas\CaModule\Pages\IdfgControlCenter.da.resx"), Parse("B7EDA261-6923-4526-AFB7-B2A64984F099")),
9692
}
9793
);
98-
v1.Should().NotBe(v2);
94+
v1.ShouldNotBe(v2);
9995
}
10096

10197
static readonly (string Path, Guid Hash)[] s_data =
@@ -211,10 +207,10 @@ public void FileGrouping()
211207
)
212208
};
213209
var resAsList = result.ToList();
214-
resAsList.Count.Should().Be(testData.Count);
210+
resAsList.Count.ShouldBe(testData.Count);
215211
foreach (var groupedAdditionalFile in testData)
216212
{
217-
resAsList.Should().Contain(groupedAdditionalFile);
213+
resAsList.ShouldContain(groupedAdditionalFile);
218214
}
219215
}
220216

Catglobe.ResXFileCodeGenerator.Tests/HelperGeneratorTests.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using FluentAssertions;
2-
using Xunit;
3-
4-
namespace Catglobe.ResXFileCodeGenerator.Tests;
1+
namespace Catglobe.ResXFileCodeGenerator.Tests;
52

63
public class HelperGeneratorTests
74
{
@@ -39,9 +36,9 @@ internal static partial class Helpers
3936
};
4037
}
4138
";
42-
errorsAndWarnings.Should().BeNullOrEmpty();
43-
generatedFileName.Should().Be("Catglobe.ResXFileCodeGenerator.1030_6.g.cs");
44-
sourceCode.Should().BeEquivalentTo(expected);
39+
errorsAndWarnings.ShouldBeEmpty();
40+
generatedFileName.ShouldBe("Catglobe.ResXFileCodeGenerator.1030_6.g.cs");
41+
sourceCode.ShouldBeEquivalentTo(expected);
4542
}
4643
[Fact]
4744
public void CanGenerateEmptyCombo()
@@ -65,8 +62,8 @@ internal static partial class Helpers
6562
};
6663
}
6764
";
68-
errorsAndWarnings.Should().BeNullOrEmpty();
69-
generatedFileName.Should().Be("Catglobe.ResXFileCodeGenerator..g.cs");
70-
sourceCode.Should().Be(expected);
65+
errorsAndWarnings.ShouldBeEmpty();
66+
generatedFileName.ShouldBe("Catglobe.ResXFileCodeGenerator..g.cs");
67+
sourceCode.ShouldBe(expected);
7168
}
7269
}
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
1-
using System.Globalization;
2-
using FluentAssertions;
3-
using Xunit;
4-
5-
namespace Catglobe.ResXFileCodeGenerator.Tests.IntegrationTests;
1+
namespace Catglobe.ResXFileCodeGenerator.Tests.IntegrationTests;
62

73
public class TestResxFiles
84
{
95
[Fact]
106
public void TestNormalResourceGen()
117
{
128
Thread.CurrentThread.CurrentUICulture = new CultureInfo("da");
13-
Test1.CreateDate.Should().Be("OldestDa");
9+
Test1.CreateDate.ShouldBe("OldestDa");
1410
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
15-
Test1.CreateDate.Should().Be("Oldest");
11+
Test1.CreateDate.ShouldBe("Oldest");
1612
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ch");
17-
Test1.CreateDate.Should().Be("Oldest");
13+
Test1.CreateDate.ShouldBe("Oldest");
1814
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");
19-
Test1.CreateDate.Should().Be("OldestEnUs");
15+
Test1.CreateDate.ShouldBe("OldestEnUs");
2016
Thread.CurrentThread.CurrentUICulture = new CultureInfo("da-DK");
21-
Test1.CreateDate.Should().Be("OldestDaDK");
17+
Test1.CreateDate.ShouldBe("OldestDaDK");
2218
}
2319
[Fact]
2420
public void TestCodeGenResourceGen()
2521
{
2622
Thread.CurrentThread.CurrentUICulture = new CultureInfo("da");
27-
Test2.CreateDate.Should().Be("OldestDa");
23+
Test2.CreateDate.ShouldBe("OldestDa");
2824
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
29-
Test2.CreateDate.Should().Be("Oldest");
25+
Test2.CreateDate.ShouldBe("Oldest");
3026
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ch");
31-
Test2.CreateDate.Should().Be("Oldest");
27+
Test2.CreateDate.ShouldBe("Oldest");
3228
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");
33-
Test2.CreateDate.Should().Be("OldestEnUs");
29+
Test2.CreateDate.ShouldBe("OldestEnUs");
3430
Thread.CurrentThread.CurrentUICulture = new CultureInfo("da-DK");
35-
Test2.CreateDate.Should().Be("OldestDaDK");
31+
Test2.CreateDate.ShouldBe("OldestDaDK");
3632
}
3733

3834
}

0 commit comments

Comments
 (0)