Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Code/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.6" />
<PackageVersion Include="FluentAssertions" Version="[7.2.0]" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Nullable" Version="1.3.1" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
</ItemGroup>
</Project>
16 changes: 11 additions & 5 deletions Code/Light.GuardClauses.AllProjects.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.SourceCo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.Source", "Light.GuardClauses.Source\Light.GuardClauses.Source.csproj", "{A7B9AC78-FA4F-4BDE-9DAF-B854408AB843}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Versioning", "Versioning", "{176BEDC4-CFE3-4084-8213-B4EC155A7E38}"
ProjectSection(SolutionItems) = preProject
Version.props = Version.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Light.GuardClauses.SourceCodeTransformation.Tests", "Light.GuardClauses.SourceCodeTransformation.Tests\Light.GuardClauses.SourceCodeTransformation.Tests.csproj", "{A2067796-F167-47BE-B367-191152DCE230}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plans", "Plans", "{664661A0-3861-486B-87B5-A35A5CC5F7B7}"
ProjectSection(SolutionItems) = preProject
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
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{8A42A536-E597-454B-BE18-4F62311FA158}"
ProjectSection(SolutionItems) = preProject
..\CONTRIBUTING.md = ..\CONTRIBUTING.md
..\README.md = ..\README.md
..\LICENSE = ..\LICENSE
Directory.Packages.props = Directory.Packages.props
Version.props = Version.props
Light.GuardClauses.AllProjects.sln.DotSettings = Light.GuardClauses.AllProjects.sln.DotSettings
Light.GuardClauses.sln.DotSettings = Light.GuardClauses.sln.DotSettings
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Light.GuardClauses.InternalRoslynAnalyzers\Light.GuardClauses.InternalRoslynAnalyzers.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="FluentAssertions" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -8,7 +8,7 @@

<ItemGroup>
<ProjectReference Include="..\Light.GuardClauses\Light.GuardClauses.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -10,8 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Memory" Version="4.6.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
<PackageReference Include="FluentAssertions" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,56 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Xunit;

namespace Light.GuardClauses.SourceCodeTransformation.Tests
namespace Light.GuardClauses.SourceCodeTransformation.Tests;

public static class ParseCSharpWithRoslynTests
{
public static class ParseCSharpWithRoslynTests
{
private static readonly DirectoryInfo CodeDirectory;
private static readonly DirectoryInfo CodeDirectory;

static ParseCSharpWithRoslynTests()
{
CodeDirectory = FindCodeDirectory();
}
static ParseCSharpWithRoslynTests() => CodeDirectory = FindCodeDirectory();

[Fact]
public static void ParseExpressionExtensionsFile()
{
var fileInfo = GetLightGuardClausesFile(@"FrameworkExtensions\ExpressionExtensions.cs");
var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(fileInfo.FullName));
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();

root.Members.Should().NotBeEmpty();
}
[Fact]
public static void ParseExpressionExtensionsFile()
{
var fileInfo = GetLightGuardClausesFile("FrameworkExtensions/ExpressionExtensions.cs");
var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(fileInfo.FullName));
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();

[Fact]
public static void ParseSpanDelegatesFile()
{
var fileInfo = GetLightGuardClausesFile(@"ExceptionFactory\SpanDelegates.cs");
var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(fileInfo.FullName), new CSharpParseOptions(LanguageVersion.CSharp7_3, preprocessorSymbols: new[] { "NETSTANDARD2_0" }));
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();
root.Members.Should().NotBeEmpty();
}

root.Members.Should().NotBeEmpty();
}
[Fact]
public static void ParseSpanDelegatesFile()
{
var fileInfo = GetLightGuardClausesFile("ExceptionFactory/SpanDelegates.cs");
var syntaxTree = CSharpSyntaxTree.ParseText(
File.ReadAllText(fileInfo.FullName),
new (LanguageVersion.CSharp7_3, preprocessorSymbols: ["NETSTANDARD2_0"])
);
var root = (CompilationUnitSyntax) syntaxTree.GetRoot();

root.Members.Should().NotBeEmpty();
}

private static DirectoryInfo FindCodeDirectory()
private static DirectoryInfo FindCodeDirectory()
{
var currentDirectory = new DirectoryInfo(".");
do
{
var currentDirectory = new DirectoryInfo(".");
do
if (currentDirectory.Name == "Code")
{
if (currentDirectory.Name == "Code")
return currentDirectory;
return currentDirectory;
}

currentDirectory = currentDirectory.Parent;
} while (currentDirectory != null);
currentDirectory = currentDirectory.Parent;
} while (currentDirectory != null);

throw new InvalidOperationException("This test project does not reside in a folder called \"Code\" (directly or indirectly).");
}

private static FileInfo GetLightGuardClausesFile(string relativeFilePath)
{
return new FileInfo(Path.Combine(CodeDirectory.FullName, "Light.GuardClauses", relativeFilePath));
}
throw new InvalidOperationException(
"This test project does not reside in a folder called \"Code\" (directly or indirectly)."
);
}
}

private static FileInfo GetLightGuardClausesFile(string relativeFilePath) => new (
Path.Combine(CodeDirectory.FullName, "Light.GuardClauses", relativeFilePath)
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

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

Expand All @@ -10,10 +10,10 @@

<ItemGroup>
<ProjectReference Include="..\Light.GuardClauses\Light.GuardClauses.csproj" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
Expand Down
33 changes: 15 additions & 18 deletions Code/Light.GuardClauses.Tests/Light.GuardClauses.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="TargetFrameworks.props" Condition="Exists('TargetFrameworks.props')" />
<Import Project="TargetFrameworks.props" Condition="Exists('TargetFrameworks.props')" />

<PropertyGroup>
<TargetFramework Condition="'$(TargetFrameworks)' == '' and '$(TargetFramework)' == ''">net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>12</LangVersion>
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<TargetFramework Condition="'$(TargetFrameworks)' == '' and '$(TargetFramework)' == ''">net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>12</LangVersion>
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<ProjectReference Include="..\Light.GuardClauses\Light.GuardClauses.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Light.GuardClauses\Light.GuardClauses.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
</ItemGroup>

</Project>
13 changes: 5 additions & 8 deletions Code/Light.GuardClauses/Light.GuardClauses.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,17 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>
Light.GuardClauses 13.1.0
Light.GuardClauses 14.0.0
--------------------------------

- new assertions for ImmutableArray&lt;T&gt;: MustNotBeDefaultOrEmpty, MustHaveLength, MustHaveLengthIn, MustHaveMinimumLength, MustHaveMaximumLength
- new dependency: System.Collections.Immutable
- Breaking Change: Check.Contains(string, string, System.StringComparison) now exists in Light.GuardClauses.FrameworkExtensions to avoid conflict with other polyfill libraries
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.Memory" Version="4.6.0" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" Condition="'$(TargetFramework)' != 'net8.0'" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
<PackageReference Include="Nullable" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Code/Version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>13.1.0</Version>
<Version>14.0.0</Version>
</PropertyGroup>
</Project>
Loading
Loading