Skip to content

Commit 5d66991

Browse files
authored
Merge pull request #133 from feO2x/dev
Light.GuardClauses 14.0.0
2 parents f634a2e + 555ab02 commit 5d66991

File tree

75 files changed

+4493
-4448
lines changed

Some content is hidden

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

75 files changed

+4493
-4448
lines changed

Code/Directory.Packages.props

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageVersion Include="BenchmarkDotNet" Version="0.15.6" />
8+
<PackageVersion Include="FluentAssertions" Version="[7.2.0]" />
9+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0" />
10+
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
11+
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="10.0.0" />
12+
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
13+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
14+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
15+
<PackageVersion Include="Nullable" Version="1.3.1" />
16+
<PackageVersion Include="System.Collections.Immutable" Version="10.0.0" />
17+
<PackageVersion Include="xunit" Version="2.9.3" />
18+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
19+
</ItemGroup>
20+
</Project>

Code/Light.GuardClauses.AllProjects.sln

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,24 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.SourceCo
2323
EndProject
2424
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.Source", "Light.GuardClauses.Source\Light.GuardClauses.Source.csproj", "{A7B9AC78-FA4F-4BDE-9DAF-B854408AB843}"
2525
EndProject
26-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Versioning", "Versioning", "{176BEDC4-CFE3-4084-8213-B4EC155A7E38}"
27-
ProjectSection(SolutionItems) = preProject
28-
Version.props = Version.props
29-
EndProjectSection
30-
EndProject
3126
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.SourceCodeTransformation.Tests", "Light.GuardClauses.SourceCodeTransformation.Tests\Light.GuardClauses.SourceCodeTransformation.Tests.csproj", "{A2067796-F167-47BE-B367-191152DCE230}"
3227
EndProject
3328
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plans", "Plans", "{664661A0-3861-486B-87B5-A35A5CC5F7B7}"
3429
ProjectSection(SolutionItems) = preProject
3530
Plans\issue-114-must-not-be-default-or-empty-for-immutable-array.md = Plans\issue-114-must-not-be-default-or-empty-for-immutable-array.md
3631
EndProjectSection
3732
EndProject
33+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{8A42A536-E597-454B-BE18-4F62311FA158}"
34+
ProjectSection(SolutionItems) = preProject
35+
..\CONTRIBUTING.md = ..\CONTRIBUTING.md
36+
..\README.md = ..\README.md
37+
..\LICENSE = ..\LICENSE
38+
Directory.Packages.props = Directory.Packages.props
39+
Version.props = Version.props
40+
Light.GuardClauses.AllProjects.sln.DotSettings = Light.GuardClauses.AllProjects.sln.DotSettings
41+
Light.GuardClauses.sln.DotSettings = Light.GuardClauses.sln.DotSettings
42+
EndProjectSection
43+
EndProject
3844
Global
3945
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4046
Debug|Any CPU = Debug|Any CPU

Code/Light.GuardClauses.InternalRoslynAnalyzers.Tests/Light.GuardClauses.InternalRoslynAnalyzers.Tests.csproj

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

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<ProjectReference Include="..\Light.GuardClauses.InternalRoslynAnalyzers\Light.GuardClauses.InternalRoslynAnalyzers.csproj" />
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
10-
<PackageReference Include="xunit" Version="2.9.2" />
11-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
12-
<PackageReference Include="FluentAssertions" Version="6.12.1" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
10+
<PackageReference Include="xunit" />
11+
<PackageReference Include="xunit.runner.visualstudio" />
12+
<PackageReference Include="FluentAssertions" />
1313
</ItemGroup>
1414

1515
<ItemGroup>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
9+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
1010
</ItemGroup>
1111

1212
</Project>

Code/Light.GuardClauses.Performance/StringAssertions/ContainsBenchmark.cs renamed to Code/Light.GuardClauses.Performance/FrameworkExtensions/ContainsBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using BenchmarkDotNet.Attributes;
33

4-
namespace Light.GuardClauses.Performance.StringAssertions
4+
namespace Light.GuardClauses.FrameworkExtensions.Performance.StringAssertions
55
{
66
public class ContainsOrdinalBenchmark
77
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -8,7 +8,7 @@
88

99
<ItemGroup>
1010
<ProjectReference Include="..\Light.GuardClauses\Light.GuardClauses.csproj" />
11-
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
11+
<PackageReference Include="BenchmarkDotNet" />
1212
</ItemGroup>
1313

1414
</Project>

Code/Light.GuardClauses.Source/Light.GuardClauses.Source.csproj

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

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
@@ -10,8 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="System.Memory" Version="4.6.0" />
14-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
13+
<PackageReference Include="System.Collections.Immutable" />
1514
</ItemGroup>
1615

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

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
10-
<PackageReference Include="xunit" Version="2.9.2" />
11-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
12-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
13-
<PackageReference Include="FluentAssertions" Version="6.12.1" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
10+
<PackageReference Include="xunit" />
11+
<PackageReference Include="xunit.runner.visualstudio" />
12+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
13+
<PackageReference Include="FluentAssertions" />
1414
</ItemGroup>
1515

1616
</Project>

Code/Light.GuardClauses.SourceCodeTransformation.Tests/ParseCSharpFilesWithRoslynTests.cs

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,56 @@
55
using Microsoft.CodeAnalysis.CSharp.Syntax;
66
using Xunit;
77

8-
namespace Light.GuardClauses.SourceCodeTransformation.Tests
8+
namespace Light.GuardClauses.SourceCodeTransformation.Tests;
9+
10+
public static class ParseCSharpWithRoslynTests
911
{
10-
public static class ParseCSharpWithRoslynTests
11-
{
12-
private static readonly DirectoryInfo CodeDirectory;
12+
private static readonly DirectoryInfo CodeDirectory;
1313

14-
static ParseCSharpWithRoslynTests()
15-
{
16-
CodeDirectory = FindCodeDirectory();
17-
}
14+
static ParseCSharpWithRoslynTests() => CodeDirectory = FindCodeDirectory();
1815

19-
[Fact]
20-
public static void ParseExpressionExtensionsFile()
21-
{
22-
var fileInfo = GetLightGuardClausesFile(@"FrameworkExtensions\ExpressionExtensions.cs");
23-
var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(fileInfo.FullName));
24-
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();
25-
26-
root.Members.Should().NotBeEmpty();
27-
}
16+
[Fact]
17+
public static void ParseExpressionExtensionsFile()
18+
{
19+
var fileInfo = GetLightGuardClausesFile("FrameworkExtensions/ExpressionExtensions.cs");
20+
var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(fileInfo.FullName));
21+
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();
2822

29-
[Fact]
30-
public static void ParseSpanDelegatesFile()
31-
{
32-
var fileInfo = GetLightGuardClausesFile("SpanDelegates.cs");
33-
var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(fileInfo.FullName), new CSharpParseOptions(LanguageVersion.CSharp7_3, preprocessorSymbols: new[] { "NETSTANDARD2_0" }));
34-
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();
23+
root.Members.Should().NotBeEmpty();
24+
}
3525

36-
root.Members.Should().NotBeEmpty();
37-
}
26+
[Fact]
27+
public static void ParseSpanDelegatesFile()
28+
{
29+
var fileInfo = GetLightGuardClausesFile("ExceptionFactory/SpanDelegates.cs");
30+
var syntaxTree = CSharpSyntaxTree.ParseText(
31+
File.ReadAllText(fileInfo.FullName),
32+
new (LanguageVersion.CSharp7_3, preprocessorSymbols: ["NETSTANDARD2_0"])
33+
);
34+
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();
35+
36+
root.Members.Should().NotBeEmpty();
37+
}
3838

39-
private static DirectoryInfo FindCodeDirectory()
39+
private static DirectoryInfo FindCodeDirectory()
40+
{
41+
var currentDirectory = new DirectoryInfo(".");
42+
do
4043
{
41-
var currentDirectory = new DirectoryInfo(".");
42-
do
44+
if (currentDirectory.Name == "Code")
4345
{
44-
if (currentDirectory.Name == "Code")
45-
return currentDirectory;
46+
return currentDirectory;
47+
}
4648

47-
currentDirectory = currentDirectory.Parent;
48-
} while (currentDirectory != null);
49+
currentDirectory = currentDirectory.Parent;
50+
} while (currentDirectory != null);
4951

50-
throw new InvalidOperationException("This test project does not reside in a folder called \"Code\" (directly or indirectly).");
51-
}
52-
53-
private static FileInfo GetLightGuardClausesFile(string relativeFilePath)
54-
{
55-
return new FileInfo(Path.Combine(CodeDirectory.FullName, "Light.GuardClauses", relativeFilePath));
56-
}
52+
throw new InvalidOperationException(
53+
"This test project does not reside in a folder called \"Code\" (directly or indirectly)."
54+
);
5755
}
58-
}
56+
57+
private static FileInfo GetLightGuardClausesFile(string relativeFilePath) => new (
58+
Path.Combine(CodeDirectory.FullName, "Light.GuardClauses", relativeFilePath)
59+
);
60+
}

Code/Light.GuardClauses.SourceCodeTransformation/Light.GuardClauses.SourceCodeTransformation.csproj

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

33
<Import Project="..\Version.props" />
44

@@ -10,10 +10,10 @@
1010

1111
<ItemGroup>
1212
<ProjectReference Include="..\Light.GuardClauses\Light.GuardClauses.csproj" />
13-
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
14-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
15-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
16-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0" />
13+
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" />
14+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
15+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
16+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

0 commit comments

Comments
 (0)