Skip to content
Merged

Dev #35

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
21 changes: 21 additions & 0 deletions CodeQuality.sln
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.Playwrigh
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.TestTool", "src\tests\SoloX.CodeQuality.TestTool\SoloX.CodeQuality.TestTool.csproj", "{C92C3947-9EBB-43E3-9104-58CADE937BB3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.PreReleaseTestTool", "src\tests\SoloX.CodeQuality.PreReleaseTestTool\SoloX.CodeQuality.PreReleaseTestTool.csproj", "{1F289698-A61C-4886-9E42-CFF9CDFD82E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.TestNuget", "src\tests\SoloX.CodeQuality.TestNuget\SoloX.CodeQuality.TestNuget.csproj", "{93418C7A-7C63-430B-8299-EEEE2FB83716}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.PreReleaseTestNuget", "src\tests\SoloX.CodeQuality.PreReleaseTestNuget\SoloX.CodeQuality.PreReleaseTestNuget.csproj", "{FF0CCE33-32A5-4973-8A03-1763F513CE31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -112,6 +118,18 @@ Global
{C92C3947-9EBB-43E3-9104-58CADE937BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C92C3947-9EBB-43E3-9104-58CADE937BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C92C3947-9EBB-43E3-9104-58CADE937BB3}.Release|Any CPU.Build.0 = Release|Any CPU
{1F289698-A61C-4886-9E42-CFF9CDFD82E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F289698-A61C-4886-9E42-CFF9CDFD82E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F289698-A61C-4886-9E42-CFF9CDFD82E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F289698-A61C-4886-9E42-CFF9CDFD82E8}.Release|Any CPU.Build.0 = Release|Any CPU
{93418C7A-7C63-430B-8299-EEEE2FB83716}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93418C7A-7C63-430B-8299-EEEE2FB83716}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93418C7A-7C63-430B-8299-EEEE2FB83716}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93418C7A-7C63-430B-8299-EEEE2FB83716}.Release|Any CPU.Build.0 = Release|Any CPU
{FF0CCE33-32A5-4973-8A03-1763F513CE31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF0CCE33-32A5-4973-8A03-1763F513CE31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF0CCE33-32A5-4973-8A03-1763F513CE31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF0CCE33-32A5-4973-8A03-1763F513CE31}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -131,6 +149,9 @@ Global
{B339195D-10B0-471F-9401-F883B18838CE} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
{D0CDEC61-7956-4F49-AC4D-C0DA3063969F} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
{C92C3947-9EBB-43E3-9104-58CADE937BB3} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
{1F289698-A61C-4886-9E42-CFF9CDFD82E8} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
{93418C7A-7C63-430B-8299-EEEE2FB83716} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
{FF0CCE33-32A5-4973-8A03-1763F513CE31} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {74BCF463-5FDE-4DBC-B32A-431E8A228CA0}
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ You can checkout this Github repository or you can use the NuGet package:

**Install using the command line from the Package Manager:**
```bash
Install-Package SoloX.CodeQuality.Prod -version 2.3.4
Install-Package SoloX.CodeQuality.Prod -version 2.3.5
or
Install-Package SoloX.CodeQuality.Test -version 2.3.4
Install-Package SoloX.CodeQuality.Test -version 2.3.5
```

**Install using the .Net CLI:**
```bash
dotnet add package SoloX.CodeQuality.Prod --version 2.3.4
dotnet add package SoloX.CodeQuality.Prod --version 2.3.5
or
dotnet add package SoloX.CodeQuality.Test --version 2.3.4
dotnet add package SoloX.CodeQuality.Test --version 2.3.5
```

**Install editing your project file (csproj):**
```xml
<PackageReference Include="SoloX.CodeQuality.Prod" Version="2.3.4">
<PackageReference Include="SoloX.CodeQuality.Prod" Version="2.3.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
or
<PackageReference Include="SoloX.CodeQuality.Test" Version="2.3.4">
<PackageReference Include="SoloX.CodeQuality.Test" Version="2.3.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down Expand Up @@ -218,17 +218,17 @@ You can checkout this Github repository or use the NuGet package:

**Install using the command line from the Package Manager:**
```bash
Install-Package SoloX.CodeQuality.Playwright -version 2.3.4
Install-Package SoloX.CodeQuality.Playwright -version 2.3.5
```

**Install using the .Net CLI:**
```bash
dotnet add package SoloX.CodeQuality.Playwright --version 2.3.4
dotnet add package SoloX.CodeQuality.Playwright --version 2.3.5
```

**Install editing your project file (csproj):**
```xml
<PackageReference Include="SoloX.CodeQuality.Playwright" Version="2.3.4" />
<PackageReference Include="SoloX.CodeQuality.Playwright" Version="2.3.5" />
```

* * *
Expand Down Expand Up @@ -424,29 +424,29 @@ You can checkout this Github repository or you can use the NuGet package:

**Install using the command line from the Package Manager:**
```bash
Install-Package SoloX.CodeQuality.Test.Helpers -version 2.3.4
Install-Package SoloX.CodeQuality.Test.Helpers -version 2.3.5

Install-Package SoloX.CodeQuality.Test.Helpers.XUnit -version 2.3.4
Install-Package SoloX.CodeQuality.Test.Helpers.XUnit -version 2.3.5

Install-Package SoloX.CodeQuality.Test.Helpers.NUnit -version 2.3.4
Install-Package SoloX.CodeQuality.Test.Helpers.NUnit -version 2.3.5
```

**Install using the .Net CLI:**
```bash
dotnet add package SoloX.CodeQuality.Test.Helpers --version 2.3.4
dotnet add package SoloX.CodeQuality.Test.Helpers --version 2.3.5

dotnet add package SoloX.CodeQuality.Test.Helpers.XUnit --version 2.3.4
dotnet add package SoloX.CodeQuality.Test.Helpers.XUnit --version 2.3.5

dotnet add package SoloX.CodeQuality.Test.Helpers.NUnit --version 2.3.4
dotnet add package SoloX.CodeQuality.Test.Helpers.NUnit --version 2.3.5
```

**Install editing your project file (csproj):**
```xml
<PackageReference Include="SoloX.CodeQuality.Test.Helpers" Version="2.3.4" />
<PackageReference Include="SoloX.CodeQuality.Test.Helpers" Version="2.3.5" />

<PackageReference Include="SoloX.CodeQuality.Test.Helpers.XUnit" Version="2.3.4" />
<PackageReference Include="SoloX.CodeQuality.Test.Helpers.XUnit" Version="2.3.5" />

<PackageReference Include="SoloX.CodeQuality.Test.Helpers.NUnit" Version="2.3.4" />
<PackageReference Include="SoloX.CodeQuality.Test.Helpers.NUnit" Version="2.3.5" />
```

* * *
Expand Down
4 changes: 2 additions & 2 deletions src/SharedProperties.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<Version>2.3.4</Version>
<Version>2.3.5</Version>
<Authors>Xavier Solau</Authors>
<Copyright>Copyright © 2021 Xavier Solau</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -14,7 +14,7 @@
<CodeQualityHeaderLicense>$(PackageLicenseExpression)</CodeQualityHeaderLicense>
<CodeQualityHeaderLicenseFile>LICENSE</CodeQualityHeaderLicenseFile>

<AssemblyVersion>2.3.4.0</AssemblyVersion>
<AssemblyVersion>2.3.5.0</AssemblyVersion>
<LangVersion>12</LangVersion>

</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/libs/SoloX.CodeQuality.Test.Helpers/DotnetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static bool SlnAdd(string path, string project, out ProcessResult process
public static bool AddPackage(string path, string projectFilePath, string packageName, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
{
return Dotnet(path, $"{ADD} {projectFilePath} {PACKAGE} {packageName}", out processResult, environmentVariablesHandler);
return Dotnet(path, $"{ADD} {projectFilePath} {PACKAGE} {packageName} --prerelease", out processResult, environmentVariablesHandler);
}

public static bool AddReference(string path, string projectFilePath, string projectReferenceFilePath, out ProcessResult processResult,
Expand Down Expand Up @@ -107,7 +107,7 @@ internal static bool NewToolManifest(string path, out ProcessResult processResul
internal static bool ToolInstall(string path, string toolName, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
{
return Dotnet(path, $"{TOOL} {INSTALL} {toolName}", out processResult, environmentVariablesHandler);
return Dotnet(path, $"{TOOL} {INSTALL} {toolName} --prerelease", out processResult, environmentVariablesHandler);
}

public static bool Dotnet(string path, string args, out ProcessResult processResult,
Expand Down
7 changes: 7 additions & 0 deletions src/tests/SoloX.CodeQuality.PreReleaseTestNuget/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SoloX.CodeQuality.PreReleaseTestNuget
{
public class Class1
{

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

<Import Project="../../SharedProperties.props" />

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<Version>1.2.3-alpha.1</Version>

</PropertyGroup>

</Project>
28 changes: 28 additions & 0 deletions src/tests/SoloX.CodeQuality.PreReleaseTestTool/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// See https://aka.ms/new-console-template for more information

#if DEBUG
using System.Diagnostics;

if (!Debugger.IsAttached && args != null && args.Contains("--debug:true"))
{
Debugger.Launch();
}

#endif

Console.WriteLine("Hello, World!");

if (args != null)
{
for (var i = 0; i < args.Length; i++)
{
var arg = args[i];

Console.WriteLine($"given arg {i}: {arg}");
}
}
else
{
Console.WriteLine($"no given args");
}

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

<Import Project="../../SharedProperties.props" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<PackAsTool>true</PackAsTool>
<ToolCommandName>prerealsetesttool</ToolCommandName>

<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<Version>1.2.3-alpha.1</Version>

</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

<ItemGroup>
<ProjectReference Include="..\..\libs\SoloX.CodeQuality.Test.Helpers\SoloX.CodeQuality.Test.Helpers.csproj" />
<ProjectReference Include="..\SoloX.CodeQuality.PreReleaseTestNuget\SoloX.CodeQuality.PreReleaseTestNuget.csproj" />
<ProjectReference Include="..\SoloX.CodeQuality.PreReleaseTestTool\SoloX.CodeQuality.PreReleaseTestTool.csproj" />
<ProjectReference Include="..\SoloX.CodeQuality.TestNuget\SoloX.CodeQuality.TestNuget.csproj" />
<ProjectReference Include="..\SoloX.CodeQuality.TestTool\SoloX.CodeQuality.TestTool.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ namespace SoloX.CodeQuality.Test.Helpers.UTest.Solution
{
public class SolutionBuilderTest
{
[Fact]
public void IsShouldBuildASolutionWithATestProject()
[Theory]
[InlineData("SoloX.CodeQuality.TestNuget")]
[InlineData("SoloX.CodeQuality.PreReleaseTestNuget")]
public void IsShouldBuildASolutionWithATestProject(string packageName)
{
var configurationName = ProbConfiguration();

var root = new RandomGenerator().RandomString(4);

// Let's create a solution in the random root folder.
Expand All @@ -29,14 +33,15 @@ public void IsShouldBuildASolutionWithATestProject()
configuration
.UsePackageSources(src =>
{
src.Clear().AddNugetOrg();
src.Clear()
.Add($"../../../../../{packageName}/bin/{configurationName}")
.AddNugetOrg();
});
})
// Set up a xunit project to use the nugets.
.WithProject("TestProject", "xunit", configuration =>
{
// Nothing more to do for now.
// We will use the default UnitTest1.cs file.
configuration.UsePackageReference(packageName);
})
// Finally create the solution.
.Build();
Expand All @@ -57,8 +62,10 @@ public void IsShouldBuildASolutionWithATestProject()
}
}

[Fact]
public void IsShouldBuildASolutionUsingADotnetTool()
[Theory]
[InlineData("SoloX.CodeQuality.TestTool", "testtool")]
[InlineData("SoloX.CodeQuality.PreReleaseTestTool", "prerealsetesttool")]
public void IsShouldBuildASolutionUsingADotnetTool(string toolProject, string toolName)
{
var configurationName = ProbConfiguration();

Expand All @@ -75,14 +82,14 @@ public void IsShouldBuildASolutionUsingADotnetTool()
.UsePackageSources(src =>
{
src.Clear()
.Add(@$"../../../../../SoloX.CodeQuality.TestTool/bin/{configurationName}")
.Add(@$"../../../../../{toolProject}/bin/{configurationName}")
.AddNugetOrg();
});
})
.WithDotnetTools(configuration =>
{
configuration
.UseTool("SoloX.CodeQuality.TestTool");
.UseTool(toolProject);
})
// Finally create the solution.
.Build();
Expand All @@ -93,7 +100,7 @@ public void IsShouldBuildASolutionUsingADotnetTool()

actBuild.Should().NotThrow();

var actTest = () => solution.RunTool("testtool", $"a1 a2 --debug:false");
var actTest = () => solution.RunTool(toolName, $"a1 a2 --debug:false");

var logs = actTest.Should().NotThrow().Subject.LogMessages;

Expand Down
7 changes: 7 additions & 0 deletions src/tests/SoloX.CodeQuality.TestNuget/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SoloX.CodeQuality.TestNuget
{
public class Class1
{

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

<Import Project="../../SharedProperties.props" />

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<Version>1.2.3</Version>

</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<Version>1.2.3</Version>

</PropertyGroup>

</Project>
Loading