From 8db41b2bb1b79cdbfeaa81eaec8baf61527e6e7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 15:39:31 +0100 Subject: [PATCH 01/32] Bump Nerdbank.GitVersioning from 3.5.107 to 3.5.119 in /src (#12) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.5.107 to 3.5.119. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.5.107...v3.5.119) --- updated-dependencies: - dependency-name: Nerdbank.GitVersioning dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index eea0820..27cd72c 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -16,7 +16,7 @@ - 3.5.107 + 3.5.119 4.18.4 3.13.3 From 694d4218c6d6c0b47eeb3ba53de16aedbec274e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 11:01:56 +0200 Subject: [PATCH 02/32] Bump Nerdbank.GitVersioning from 3.5.119 to 3.6.132 in /src (#14) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.5.119 to 3.6.132. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.5.119...v3.6.132) --- updated-dependencies: - dependency-name: Nerdbank.GitVersioning dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 27cd72c..2cf0123 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -16,7 +16,7 @@ - 3.5.119 + 3.6.132 4.18.4 3.13.3 From f9c205335c7a7e72d6b569b04a55a09a9dcd4c23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 15:19:03 +0200 Subject: [PATCH 03/32] Bump Microsoft.NET.Test.Sdk from 17.5.0 to 17.6.0 in /src (#16) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.5.0 to 17.6.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.5.0...v17.6.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 2cf0123..1678a22 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -21,7 +21,7 @@ 4.18.4 3.13.3 4.4.2 - 17.5.0 + 17.6.0 3.2.0 4.1.1 From e5ea7f4672e822dc633d60a53048af6014c0d311 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 15:19:59 +0200 Subject: [PATCH 04/32] Bump coverlet.collector from 3.2.0 to 6.0.0 in /src (#15) Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 3.2.0 to 6.0.0. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v3.2.0...v6.0.0) --- updated-dependencies: - dependency-name: coverlet.collector dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Michael Mairegger From 3c6cf1306a90970d9396ebfc34503d2305009656 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 22 May 2023 15:20:37 +0200 Subject: [PATCH 05/32] Update package --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 1678a22..b57d787 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -22,7 +22,7 @@ 3.13.3 4.4.2 17.6.0 - 3.2.0 + 6.0.0 4.1.1 From 4d56d31cbced4935200cf0d17346a91adb7b5089 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 11:29:04 +0200 Subject: [PATCH 06/32] Bump NUnit3TestAdapter from 4.4.2 to 4.5.0 in /src (#19) Bumps [NUnit3TestAdapter](https://github.com/nunit/nunit3-vs-adapter) from 4.4.2 to 4.5.0. - [Release notes](https://github.com/nunit/nunit3-vs-adapter/releases) - [Commits](https://github.com/nunit/nunit3-vs-adapter/compare/V4.4.2...V4.5.0) --- updated-dependencies: - dependency-name: NUnit3TestAdapter dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index b57d787..3ede75d 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -20,7 +20,7 @@ 4.18.4 3.13.3 - 4.4.2 + 4.5.0 17.6.0 6.0.0 4.1.1 From 7d8b80d30e7c01812f046f8cb722e21961ae16c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 11:29:18 +0200 Subject: [PATCH 07/32] Bump Nerdbank.GitVersioning from 3.6.132 to 3.6.133 in /src (#17) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.6.132 to 3.6.133. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.6.132...v3.6.133) --- updated-dependencies: - dependency-name: Nerdbank.GitVersioning dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 3ede75d..a711585 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -16,7 +16,7 @@ - 3.6.132 + 3.6.133 4.18.4 3.13.3 From e8ee4a1e3819eaa06a693467ff52be26a520b353 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 11:30:02 +0200 Subject: [PATCH 08/32] Bump Microsoft.NET.Test.Sdk from 17.6.0 to 17.6.1 in /src (#18) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.0 to 17.6.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.6.0...v17.6.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Michael Mairegger --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index a711585..533055e 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -21,7 +21,7 @@ 4.18.4 3.13.3 4.5.0 - 17.6.0 + 17.6.1 6.0.0 4.1.1 From ec1e7ec48e24af6528ac6a9254dc47d6b87ac58c Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 12 Jun 2023 08:14:35 +0200 Subject: [PATCH 09/32] Skip sonar steps when PR --- .github/actions/build-and-test/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-and-test/action.yml b/.github/actions/build-and-test/action.yml index ab3b1c4..7f9e552 100644 --- a/.github/actions/build-and-test/action.yml +++ b/.github/actions/build-and-test/action.yml @@ -31,6 +31,7 @@ runs: - name: Install SonarCloud scanner shell: pwsh run: dotnet tool update dotnet-sonarscanner -g + if: ${{ github.event_name == 'pull_request' }} - name: Install reportgenerator shell: pwsh @@ -45,6 +46,7 @@ runs: shell: pwsh run: dotnet sonarscanner begin /k:"mairegger.printing" /o:"mairegger" /v:"${{ steps.nbgv.outputs.NuGetPackageVersion }}" /d:sonar.login="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths="sonarqubecoverage\SonarQube.xml" working-directory: ${{ inputs.workingDirectory }} + if: ${{ github.event_name == 'pull_request' }} - name: Build shell: pwsh @@ -60,10 +62,12 @@ runs: uses: actions/setup-java@v1 with: java-version: 1.11 + if: ${{ github.event_name == 'pull_request' }} - name: Sonarscanner end shell: pwsh run: | reportgenerator "-reports:*\TestResults\*\coverage.cobertura.xml" "-targetdir:sonarqubecoverage" "-reporttypes:SonarQube" dotnet sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}" - working-directory: ${{ inputs.workingDirectory }} \ No newline at end of file + working-directory: ${{ inputs.workingDirectory }} + if: ${{ github.event_name == 'pull_request' }} \ No newline at end of file From 7dbe44adf845bc87c5f1cced725b4ad249ee67ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 08:25:31 +0200 Subject: [PATCH 10/32] Bump Microsoft.NET.Test.Sdk from 17.6.1 to 17.6.2 in /src (#20) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.1 to 17.6.2. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.6.1...v17.6.2) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 533055e..31b7ef0 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -21,7 +21,7 @@ 4.18.4 3.13.3 4.5.0 - 17.6.1 + 17.6.2 6.0.0 4.1.1 From 8aa4e47a759e6bf253057da09dd8bb67d5f0cab6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:08:59 +0200 Subject: [PATCH 11/32] Bump JetBrains.Annotations from 2022.3.1 to 2023.2.0 in /src (#22) Bumps [JetBrains.Annotations](https://github.com/JetBrains/JetBrains.Annotations) from 2022.3.1 to 2023.2.0. - [Commits](https://github.com/JetBrains/JetBrains.Annotations/compare/v2022.3.1...v2023.2.0) --- updated-dependencies: - dependency-name: JetBrains.Annotations dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 31b7ef0..27b5a56 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -33,7 +33,7 @@ - + From d5262402aa3923799421aad179ad3d1d802bf706 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:09:08 +0200 Subject: [PATCH 12/32] Bump Microsoft.NET.Test.Sdk from 17.6.2 to 17.6.3 in /src (#21) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.2 to 17.6.3. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.6.2...v17.6.3) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 27b5a56..0b11abd 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -21,7 +21,7 @@ 4.18.4 3.13.3 4.5.0 - 17.6.2 + 17.6.3 6.0.0 4.1.1 From caa8e70cd91b860b316f1f4f42dc7e826676a3d3 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Tue, 25 Jul 2023 11:39:34 +0200 Subject: [PATCH 13/32] Update source link --- .github/actions/build-and-test/action.yml | 4 ++++ src/Mairegger.Printing.sln | 24 +++++++++++++++++++ .../Mairegger.Printing.csproj | 4 ++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-and-test/action.yml b/.github/actions/build-and-test/action.yml index 7f9e552..b635971 100644 --- a/.github/actions/build-and-test/action.yml +++ b/.github/actions/build-and-test/action.yml @@ -1,12 +1,16 @@ name: 'Compile, test' +description: 'Compiles and tests the project' inputs: buildConfiguration: + description: Defines the build configuration like Debug or Release required: true workingDirectory: + description: Defines the base working directory containing the solution file required: true outputs: nuget-package-version: + description: Returns the nuget package version value: ${{ steps.nbgv.outputs.NuGetPackageVersion }} runs: diff --git a/src/Mairegger.Printing.sln b/src/Mairegger.Printing.sln index 3360cd9..1aefa22 100644 --- a/src/Mairegger.Printing.sln +++ b/src/Mairegger.Printing.sln @@ -19,6 +19,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\README.md = ..\README.md EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{B6545556-5FF3-42A6-92F4-6B609468AE80}" + ProjectSection(SolutionItems) = preProject + ..\.github\dependabot.yml = ..\.github\dependabot.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{94032B2D-96F4-4A31-A30C-D0FD6449980B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build-and-test", "build-and-test", "{F5EE117F-3999-4F59-847E-64B9A98AE589}" + ProjectSection(SolutionItems) = preProject + ..\.github\actions\build-and-test\action.yml = ..\.github\actions\build-and-test\action.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{1882D2FB-1D59-4E61-9B75-31DAF505CDE5}" + ProjectSection(SolutionItems) = preProject + ..\.github\workflows\build.yml = ..\.github\workflows\build.yml + ..\.github\workflows\publish.yml = ..\.github\workflows\publish.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -44,4 +62,10 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {598A1AB2-360A-415C-A7DA-E0325C6D2E2B} EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {B6545556-5FF3-42A6-92F4-6B609468AE80} = {FD2A69EE-3F3D-42F2-AFCE-C641D715F9DF} + {94032B2D-96F4-4A31-A30C-D0FD6449980B} = {B6545556-5FF3-42A6-92F4-6B609468AE80} + {F5EE117F-3999-4F59-847E-64B9A98AE589} = {94032B2D-96F4-4A31-A30C-D0FD6449980B} + {1882D2FB-1D59-4E61-9B75-31DAF505CDE5} = {B6545556-5FF3-42A6-92F4-6B609468AE80} + EndGlobalSection EndGlobal diff --git a/src/Mairegger.Printing/Mairegger.Printing.csproj b/src/Mairegger.Printing/Mairegger.Printing.csproj index 86b249d..80e25de 100644 --- a/src/Mairegger.Printing/Mairegger.Printing.csproj +++ b/src/Mairegger.Printing/Mairegger.Printing.csproj @@ -31,9 +31,9 @@ - true true - true + true + snupkg From 7b0cfd7b0f9a8aabc9c15c022a80f75c33d3958e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:56:39 +0200 Subject: [PATCH 14/32] Bump Microsoft.NET.Test.Sdk from 17.6.3 to 17.7.1 in /src (#25) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.3 to 17.7.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.6.3...v17.7.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 0b11abd..259e77f 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -21,7 +21,7 @@ 4.18.4 3.13.3 4.5.0 - 17.6.3 + 17.7.1 6.0.0 4.1.1 From 0e945254aa0c861e68c0a022f4aaad0fb101cf47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:56:49 +0200 Subject: [PATCH 15/32] Bump Moq from 4.18.4 to 4.20.69 in /src (#24) Bumps [Moq](https://github.com/moq/moq) from 4.18.4 to 4.20.69. - [Release notes](https://github.com/moq/moq/releases) - [Changelog](https://github.com/moq/moq/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq/compare/v4.18.4...v4.20.69) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 259e77f..83ce790 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -18,7 +18,7 @@ 3.6.133 - 4.18.4 + 4.20.69 3.13.3 4.5.0 17.7.1 From c08f8a7dbd6f5ccdd0d9ea97c2841a67390e4bcd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 08:27:18 +0200 Subject: [PATCH 16/32] Bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2 in /src (#26) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.1 to 17.7.2. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.1...v17.7.2) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 83ce790..2855963 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -21,7 +21,7 @@ 4.20.69 3.13.3 4.5.0 - 17.7.1 + 17.7.2 6.0.0 4.1.1 From 119673e1a428b056b86b080bf07177d45e7879f6 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Tue, 12 Sep 2023 15:09:06 +0200 Subject: [PATCH 17/32] Use analysis level: latest-recommended --- .editorconfig | 36 ++++++++++++++++++- src/Directory.Build.props | 4 +++ src/Mairegger.Printing.Test/.editorconfig | 4 +++ .../Content/PrintProcessorTests.cs | 12 +++---- ...s => PrintProcessorWithPrintOnAllPages.cs} | 8 ++--- .../Definition/ColumnDimensionAttribute.cs | 6 ++-- .../Definition/PageRange.cs | 10 ++++-- .../Definition/PrintDimension.cs | 6 ++-- .../PrintProcessor/PrintProcessor.cs | 4 +-- 9 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 src/Mairegger.Printing.Test/.editorconfig rename src/Mairegger.Printing.Test/Content/{PrintProcessorWithPrintOnAttribute.cs => PrintProcessorWithPrintOnAllPages.cs} (88%) diff --git a/.editorconfig b/.editorconfig index ecbf139..26b4af6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -249,4 +249,38 @@ csharp_preserve_single_line_statements = true # IDE0073: File header dotnet_diagnostic.IDE0073.severity = warning -file_header_template = Copyright 2017-2022 Michael Mairegger\n\nLicensed under the Apache License, Version 2.0 (the "License")\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License. \ No newline at end of file +file_header_template = Copyright 2017-2022 Michael Mairegger\n\nLicensed under the Apache License, Version 2.0 (the "License")\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License. + + +# Mairegger Custom +[*.{cs,vb}] + +#CA1303: Do not pass literals as localized parameters +dotnet_diagnostic.CA1303.severity = error + +#CA1304: Specify CultureInfo +dotnet_diagnostic.CA1304.severity = error + +#CA1305: Specify IFormatProvider +dotnet_diagnostic.CA1305.severity = error + +#CA1307: Specify StringComparison for clarity +dotnet_diagnostic.CA1307.severity = error + +#CA1308: Normalize strings to uppercase +dotnet_diagnostic.CA1308.severity = error + +#CA1309: Use ordinal StringComparison +dotnet_diagnostic.CA1309.severity = error + +#CA1310: Specify StringComparison for correctness +dotnet_diagnostic.CA1310.severity = error + +#CA1311: Specify a culture or use an invariant version +dotnet_diagnostic.CA1311.severity = error + +#CA1708: Identifiers should differ by more than case +dotnet_diagnostic.CA1708.severity = error + +#CA1707: Identifiers should not contain underscores +dotnet_diagnostic.CA1707.severity = error diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9db032e..6403ffc 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -8,11 +8,15 @@ $(GithubUrl) Apache-2.0 $(GithubUrl) + + en latest enable + + latest-recommended diff --git a/src/Mairegger.Printing.Test/.editorconfig b/src/Mairegger.Printing.Test/.editorconfig new file mode 100644 index 0000000..7379421 --- /dev/null +++ b/src/Mairegger.Printing.Test/.editorconfig @@ -0,0 +1,4 @@ +[*.{cs,vb}] + +# CA1707: Identifiers should not contain underscores +dotnet_diagnostic.CA1707.severity = none diff --git a/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs b/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs index a17a543..ec05790 100644 --- a/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs +++ b/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs @@ -35,7 +35,7 @@ public class PrintProcessorTests [Test] public void CheckPrintDimensions_HasPrintDimensionsSet() { - var print = new PrintProcessorWithPrintOnAttribute(); + var print = new PrintProcessorWithPrintOnAllPages(); var printDialog = new Mock(); printDialog.Setup(i => i.ShowDialog()).Returns(true); @@ -68,7 +68,7 @@ public void Ctor() public void CustomAlternatingRowColors([Random(10, 20, 1)] int itemCount, [Random(3, 7, 1)] int differentColors) { IList retrievedContent = new List(); - var pp = new PrintProcessorWithPrintOnAttribute(retrievedContent) + var pp = new PrintProcessorWithPrintOnAllPages(retrievedContent) { ItemCount = itemCount, IsAlternatingRowColor = true @@ -146,7 +146,7 @@ public void GetSummary_Throws_IfNotImplemented() public void IsAlternatingRowColor_False_NotColoring() { IList retrievedContent = new List(); - var pp = new PrintProcessorWithPrintOnAttribute(retrievedContent) + var pp = new PrintProcessorWithPrintOnAllPages(retrievedContent) { ItemCount = 3, IsAlternatingRowColor = false @@ -167,7 +167,7 @@ public void IsAlternatingRowColor_False_NotColoring() public void IsAlternatingRowColor_True_Coloring() { IList retrievedContent = new List(); - var pp = new PrintProcessorWithPrintOnAttribute(retrievedContent) + var pp = new PrintProcessorWithPrintOnAllPages(retrievedContent) { ItemCount = 10, IsAlternatingRowColor = true @@ -221,7 +221,7 @@ public void PreviewDocument(bool colorPrintPartsForDebug) [Test] public void PrintDimension() { - var pp = new PrintProcessorWithPrintOnAttribute(); + var pp = new PrintProcessorWithPrintOnAllPages(); var pd = new PrintDimension(); pp.PrintDimension = pd; Assert.That(pp.PrintDimension, Is.EqualTo(pd)); @@ -286,4 +286,4 @@ public void SaveToXps_FileIsFilled() File.Delete(file); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Content/PrintProcessorWithPrintOnAttribute.cs b/src/Mairegger.Printing.Test/Content/PrintProcessorWithPrintOnAllPages.cs similarity index 88% rename from src/Mairegger.Printing.Test/Content/PrintProcessorWithPrintOnAttribute.cs rename to src/Mairegger.Printing.Test/Content/PrintProcessorWithPrintOnAllPages.cs index a8132df..ac726ab 100644 --- a/src/Mairegger.Printing.Test/Content/PrintProcessorWithPrintOnAttribute.cs +++ b/src/Mairegger.Printing.Test/Content/PrintProcessorWithPrintOnAllPages.cs @@ -23,15 +23,15 @@ namespace Mairegger.Printing.Tests.Content using Moq; [PrintOnAllPages(PrintAppendixes.Footer)] - public class PrintProcessorWithPrintOnAttribute : TestPrintProcessor + public class PrintProcessorWithPrintOnAllPages : TestPrintProcessor { private readonly IList? _retrievedContent; - public PrintProcessorWithPrintOnAttribute() + public PrintProcessorWithPrintOnAllPages() { } - public PrintProcessorWithPrintOnAttribute(IList retrievedContent) + public PrintProcessorWithPrintOnAllPages(IList retrievedContent) { _retrievedContent = retrievedContent; } @@ -58,4 +58,4 @@ public override IEnumerable ItemCollection() yield return new TextBlock { Background = Brushes.Red }.ToPrintContent(); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs b/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs index dc2f48a..186c559 100644 --- a/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs +++ b/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs @@ -50,7 +50,7 @@ public ColumnDimensionAttribute(double columnWidth) public ColumnDimensionAttribute(string value) { - if (value.EndsWith("*")) + if (value.EndsWith("*", StringComparison.Ordinal)) { DimensionType = ColumnDimensionType.Star; @@ -65,7 +65,7 @@ public ColumnDimensionAttribute(string value) #endif } } - else if (value.EndsWith("px")) + else if (value.EndsWith("px", StringComparison.Ordinal)) { DimensionType = ColumnDimensionType.Pixels; #if NET7_0_OR_GREATER @@ -76,7 +76,7 @@ public ColumnDimensionAttribute(string value) } else { - throw new ArgumentException(string.Format(l10n.ColumnDimensionAttribute_ColumnDimensionAttribute__0__is_no_valid_column_dimension, value), nameof(value)); + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, l10n.ColumnDimensionAttribute_ColumnDimensionAttribute__0__is_no_valid_column_dimension, value), nameof(value)); } } diff --git a/src/Mairegger.Printing/Definition/PageRange.cs b/src/Mairegger.Printing/Definition/PageRange.cs index 3171854..7927048 100644 --- a/src/Mairegger.Printing/Definition/PageRange.cs +++ b/src/Mairegger.Printing/Definition/PageRange.cs @@ -6,6 +6,9 @@ // All rights reserved // // ----------------------------------------------------------------------- + +using System.Globalization; + namespace Mairegger.Printing.Definition { using System; @@ -32,7 +35,7 @@ public PageRange(double fromValue, double toValue) { if (fromValue.CompareTo(toValue) > 0) { - throw new ArgumentOutOfRangeException(nameof(fromValue), string.Format(l10n.PageRange_PageRange__0__must_be_lower_or_equal_than__1_, nameof(fromValue), nameof(toValue))); + throw new ArgumentOutOfRangeException(nameof(fromValue), string.Format(CultureInfo.CurrentCulture, l10n.PageRange_PageRange__0__must_be_lower_or_equal_than__1_, nameof(fromValue), nameof(toValue))); } From = fromValue; @@ -124,8 +127,11 @@ public static PageRange Parse(string input) { throw new ArgumentNullException(nameof(input)); } - +#if NETFRAMEWORK if (input.Contains(',')) +#else + if (input.Contains(',', StringComparison.Ordinal)) +#endif { throw new ArgumentException($"Use {nameof(ParseRanges)} for parsing multi-range values"); } diff --git a/src/Mairegger.Printing/Definition/PrintDimension.cs b/src/Mairegger.Printing/Definition/PrintDimension.cs index 045ce31..0e40b84 100644 --- a/src/Mairegger.Printing/Definition/PrintDimension.cs +++ b/src/Mairegger.Printing/Definition/PrintDimension.cs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Globalization; + namespace Mairegger.Printing.Definition { using System; @@ -143,7 +145,7 @@ internal double GetHeightFor(PrintAppendixes printAppendix, int pageNumber, bool var uiElement = _printPartDimensionsRetrievalDictionary[printAppendix](PrintProcessor); if (uiElement == null) { - throw new ArgumentNullException($"{nameof(PrintProcessor)}.Get{printAppendix}()", string.Format(l10n.PrintDimension_GetHeightFor__0__must_return_a_value_for__Get_1_____if___2___is_set_, typeof(PrintProcessor), printAppendix, printAppendix)); + throw new ArgumentNullException($"{nameof(PrintProcessor)}.Get{printAppendix}()", string.Format(CultureInfo.CurrentCulture, l10n.PrintDimension_GetHeightFor__0__must_return_a_value_for__Get_1_____if___2___is_set_, typeof(PrintProcessor), printAppendix, printAppendix)); } uiElement.Measure(new Size(double.MaxValue, double.MaxValue)); value = uiElement.DesiredSize.Height; @@ -315,4 +317,4 @@ private void WritePropertyInformation(IEnumerable propertyInfos) Debug.Unindent(); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs b/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs index 8262eb4..9715ed0 100644 --- a/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs +++ b/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs @@ -165,7 +165,7 @@ public bool PrintDocument(string printQueueName, PrintServer printServer) public bool PrintDocument(string printQueueName) { - if (printQueueName.StartsWith(@"\\")) + if (printQueueName.StartsWith(@"\\", StringComparison.Ordinal)) { var printServerName = new string(printQueueName.Substring(2).TakeWhile(c => c != '\\').ToArray()); @@ -287,4 +287,4 @@ private void SetPrintOnAttributes() PrintDimension.InternalPrintDefinition = PrintDefinition; } } -} \ No newline at end of file +} From 6a5e48f4f4143c08c21e9094b81a1a4467c4c9dc Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Thu, 9 Nov 2023 16:57:32 +0100 Subject: [PATCH 18/32] Update action.yml --- .github/actions/build-and-test/action.yml | 16 ++++++++-------- .github/workflows/build.yml | 23 +++++++++++++++++++---- .github/workflows/publish.yml | 2 +- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/actions/build-and-test/action.yml b/.github/actions/build-and-test/action.yml index b635971..c920c6e 100644 --- a/.github/actions/build-and-test/action.yml +++ b/.github/actions/build-and-test/action.yml @@ -35,7 +35,7 @@ runs: - name: Install SonarCloud scanner shell: pwsh run: dotnet tool update dotnet-sonarscanner -g - if: ${{ github.event_name == 'pull_request' }} + if: github.ref == 'refs/heads/master' - name: Install reportgenerator shell: pwsh @@ -48,9 +48,9 @@ runs: - name: Sonarscanner begin shell: pwsh - run: dotnet sonarscanner begin /k:"mairegger.printing" /o:"mairegger" /v:"${{ steps.nbgv.outputs.NuGetPackageVersion }}" /d:sonar.login="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths="sonarqubecoverage\SonarQube.xml" + run: dotnet sonarscanner begin /k:"mairegger.printing" /o:"mairegger" /v:"${{ steps.nbgv.outputs.NuGetPackageVersion }}" /d:sonar.login="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="${{ env.SONAR_HOST }}" /d:sonar.coverageReportPaths="sonarqubecoverage\SonarQube.xml" working-directory: ${{ inputs.workingDirectory }} - if: ${{ github.event_name == 'pull_request' }} + if: github.ref == 'refs/heads/master' - name: Build shell: pwsh @@ -62,11 +62,11 @@ runs: run: dotnet test --configuration ${{ inputs.buildConfiguration }} --no-build --collect:"XPlat Code Coverage" working-directory: ${{ inputs.workingDirectory }} - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - java-version: 1.11 - if: ${{ github.event_name == 'pull_request' }} + java-version: '17' + if: github.ref == 'refs/heads/master' - name: Sonarscanner end shell: pwsh @@ -74,4 +74,4 @@ runs: reportgenerator "-reports:*\TestResults\*\coverage.cobertura.xml" "-targetdir:sonarqubecoverage" "-reporttypes:SonarQube" dotnet sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}" working-directory: ${{ inputs.workingDirectory }} - if: ${{ github.event_name == 'pull_request' }} \ No newline at end of file + if: github.ref == 'refs/heads/master' \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb55b63..cd07504 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,19 @@ name: Build on: push: + branches: + - main + - dev env: buildConfiguration: 'Release' workingDirectory: 'src' jobs: - build: + build-production: + if: github.ref == 'refs/heads/master' runs-on: windows-latest + environment: production steps: - uses: actions/checkout@v3 with: @@ -18,6 +23,16 @@ jobs: with: buildConfiguration: ${{ env.buildConfiguration }} workingDirectory: ${{ env.workingDirectory }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + + build-ci: + if: github.ref != 'refs/heads/master' + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: ./.github/actions/build-and-test + with: + buildConfiguration: ${{ env.buildConfiguration }} + workingDirectory: ${{ env.workingDirectory }} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 16d43c9..9b93656 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,8 +22,8 @@ jobs: buildConfiguration: ${{ env.buildConfiguration }} workingDirectory: ${{ env.workingDirectory }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST: ${{ secrets.SONAR_HOST }} - name: Pack run: dotnet pack --configuration Release --no-build /p:Version=${{ steps.build-and-test.outputs.nuget-package-version }} --output artifacts From 96bcf2798139f4bd67f727191ade4426003ca1bd Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 20 Nov 2023 14:05:43 +0100 Subject: [PATCH 19/32] Migrate to net8.0 --- src/Directory.Packages.props | 37 ++++++++++++++----- .../Mairegger.Printing.Tests.csproj | 2 +- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 2855963..00a386c 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -1,12 +1,31 @@ - net6.0 - net7.0 - net462;$(NetCoreAppMinimum)-windows;$(NetCoreAppCurrent)-windows + 8.0.0 + 7.0.13 + 6.0.24 + net462 + 10.0.19041.0 + + net$(CurrentNetVersion.Substring(0,3)) + net$(PreviousNetVersion.Substring(0,3)) + net$(MinimumNetVersion.Substring(0,3)) + + $(NetCoreAppCurrent)-windows$(WindowsSdkVersion) + $(NetCoreAppPrevious)-windows$(WindowsSdkVersion) + $(NetCoreAppMinimum)-windows$(WindowsSdkVersion) + + $(CurrentNetVersion) + $(PreviousNetVersion) + $(MinimumNetVersion) + + + + $(NetCoreWpfCurrent);$(NetCoreWpfPrevious);$(NetCoreWpfMinimum);$(NetFrameworkMinimum) true + true false @@ -19,9 +38,9 @@ 3.6.133 4.20.69 - 3.13.3 + 3.14.0 4.5.0 - 17.7.2 + 17.8.0 6.0.0 4.1.1 @@ -29,16 +48,16 @@ - + - + - + - \ No newline at end of file + diff --git a/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj b/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj index 9db7da4..3c03d49 100644 --- a/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj +++ b/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj @@ -28,4 +28,4 @@ - \ No newline at end of file + From 969cf392aa9267bffa31de3b0d75e8ccfc0ff050 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 20 Nov 2023 14:06:24 +0100 Subject: [PATCH 20/32] Bump version --- version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.json b/version.json index edb927f..2c0ae5f 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "7.0.1-alpha.{height}", + "version": "8.0.0", "nuGetPackageVersion": { "semVer": 2.0 }, @@ -8,4 +8,4 @@ "^refs/heads/master$", "^refs/tags/v\\d+\\.\\d+\\.\\d+" ] -} \ No newline at end of file +} From abf1d01a3510109d1bddae677c0d3aa3d0d4a669 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 20 Nov 2023 17:12:49 +0100 Subject: [PATCH 21/32] Some adjustments Directory.Build.targets --- src/Directory.Build.targets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 04cdf2d..6c5c223 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,12 +1,12 @@ - - - - $([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../')) - - \ No newline at end of file + + + + + + From 45988c1dcde4ff8e1ef633259349b73857c7e6e9 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Tue, 21 Nov 2023 10:52:39 +0100 Subject: [PATCH 22/32] Add Version.props to allow to overwrite some package versions if using this library as submodule --- src/Directory.Packages.props | 21 +++------------------ src/Mairegger.Printing.sln | 1 + src/Versions.props | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 src/Versions.props diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 00a386c..4194a4a 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -1,13 +1,7 @@ - - - - 8.0.0 - 7.0.13 - 6.0.24 - net462 - 10.0.19041.0 + + net$(CurrentNetVersion.Substring(0,3)) net$(PreviousNetVersion.Substring(0,3)) net$(MinimumNetVersion.Substring(0,3)) @@ -34,16 +28,7 @@ $(WarningsAsErrors);NU1504 - - 3.6.133 - - 4.20.69 - 3.14.0 - 4.5.0 - 17.8.0 - 6.0.0 - 4.1.1 - + diff --git a/src/Mairegger.Printing.sln b/src/Mairegger.Printing.sln index 1aefa22..7acbf4e 100644 --- a/src/Mairegger.Printing.sln +++ b/src/Mairegger.Printing.sln @@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Directory.Build.targets = Directory.Build.targets Directory.Packages.props = Directory.Packages.props ..\README.md = ..\README.md + Versions.props = Versions.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{B6545556-5FF3-42A6-92F4-6B609468AE80}" diff --git a/src/Versions.props b/src/Versions.props new file mode 100644 index 0000000..1870950 --- /dev/null +++ b/src/Versions.props @@ -0,0 +1,27 @@ + + + + + 8.0.0 + 7.0.14 + 6.0.25 + 10.0.19041.0 + net462 + + + + 3.6.133 + + 4.20.69 + 3.14.0 + 4.5.0 + 17.8.0 + 6.0.0 + 4.1.1 + + + + $([MSBuild]::GetPathOfFileAbove('Versions.props', '$(MSBuildThisFileDirectory)../')) + + + From e3335125a41288a2a08b6164a093d110b31061a3 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Tue, 21 Nov 2023 14:36:56 +0100 Subject: [PATCH 23/32] ... --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd07504..6006191 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ on: branches: - main - dev + - migrate/net8 env: buildConfiguration: 'Release' @@ -35,4 +36,4 @@ jobs: - uses: ./.github/actions/build-and-test with: buildConfiguration: ${{ env.buildConfiguration }} - workingDirectory: ${{ env.workingDirectory }} \ No newline at end of file + workingDirectory: ${{ env.workingDirectory }} From 9d3de0c0648372cd37c7c8916d94fe1cda1bc35f Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Tue, 21 Nov 2023 14:36:56 +0100 Subject: [PATCH 24/32] Add net8.0.0 to actions --- .github/actions/build-and-test/action.yml | 5 +++-- .github/workflows/build.yml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/build-and-test/action.yml b/.github/actions/build-and-test/action.yml index c920c6e..2074134 100644 --- a/.github/actions/build-and-test/action.yml +++ b/.github/actions/build-and-test/action.yml @@ -16,17 +16,18 @@ outputs: runs: using: "composite" steps: - - uses: actions/setup-dotnet@v2 + - uses: actions/setup-dotnet@v3 with: dotnet-version: | 6.0.x 7.0.x + 8.0.x - uses: dotnet/nbgv@master id: nbgv - name: Cache SonarCloud packages - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~\sonar\cache key: ${{ runner.os }}-sonar diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd07504..6006191 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ on: branches: - main - dev + - migrate/net8 env: buildConfiguration: 'Release' @@ -35,4 +36,4 @@ jobs: - uses: ./.github/actions/build-and-test with: buildConfiguration: ${{ env.buildConfiguration }} - workingDirectory: ${{ env.workingDirectory }} \ No newline at end of file + workingDirectory: ${{ env.workingDirectory }} From 12e9416a7e08a2a5228087b25994470cfcc5582a Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 27 Nov 2023 11:34:25 +0100 Subject: [PATCH 25/32] Migrate to nunit 4.0 --- src/Directory.Packages.props | 4 + src/Mairegger.Printing.Test/.editorconfig | 92 +++++++++++++++++++ .../CombinedPrintContentCollectionTests.cs | 9 +- .../Content/PrintContentTests.cs | 30 +++--- .../Content/PrintProcessorCollectionTests.cs | 33 ++++--- .../Content/PrintProcessorTests.cs | 25 +++-- .../ColumnDimensionAttributeTests.cs | 28 ++++-- .../Definition/ExcludeFromPagesTests.cs | 43 +++++---- .../Definition/PrintDefinitionTest.cs | 43 ++++++--- .../Definition/PrintOnPageTests.cs | 43 +++++---- .../Definition/PrintingDimensionsTests.cs | 43 +++++---- .../Definition/RangeTests.cs | 37 +++----- .../Mairegger.Printing.Tests.csproj | 4 + src/Versions.props | 2 +- 14 files changed, 304 insertions(+), 132 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 4194a4a..70f3e6a 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -41,6 +41,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/Mairegger.Printing.Test/.editorconfig b/src/Mairegger.Printing.Test/.editorconfig index 7379421..cf8596f 100644 --- a/src/Mairegger.Printing.Test/.editorconfig +++ b/src/Mairegger.Printing.Test/.editorconfig @@ -2,3 +2,95 @@ # CA1707: Identifiers should not contain underscores dotnet_diagnostic.CA1707.severity = none + +dotnet_diagnostic.Nunit1001.severity = error +dotnet_diagnostic.Nunit1001.severity = error +dotnet_diagnostic.Nunit1002.severity = error +dotnet_diagnostic.Nunit1003.severity = error +dotnet_diagnostic.Nunit1004.severity = error +dotnet_diagnostic.Nunit1005.severity = error +dotnet_diagnostic.Nunit1006.severity = error +dotnet_diagnostic.Nunit1007.severity = error +dotnet_diagnostic.Nunit1008.severity = error +dotnet_diagnostic.Nunit1009.severity = error +dotnet_diagnostic.Nunit1010.severity = error +dotnet_diagnostic.Nunit1011.severity = error +dotnet_diagnostic.Nunit1012.severity = error +dotnet_diagnostic.Nunit1013.severity = error +dotnet_diagnostic.Nunit1014.severity = error +dotnet_diagnostic.Nunit1015.severity = error +dotnet_diagnostic.Nunit1016.severity = error +dotnet_diagnostic.Nunit1017.severity = error +dotnet_diagnostic.Nunit1018.severity = error +dotnet_diagnostic.Nunit1019.severity = error +dotnet_diagnostic.Nunit1010.severity = error +dotnet_diagnostic.Nunit1021.severity = error +dotnet_diagnostic.Nunit1022.severity = error +dotnet_diagnostic.Nunit1023.severity = error +dotnet_diagnostic.Nunit1024.severity = error +dotnet_diagnostic.Nunit1025.severity = error +dotnet_diagnostic.Nunit1026.severity = error +dotnet_diagnostic.Nunit1027.severity = error +dotnet_diagnostic.Nunit1028.severity = error +dotnet_diagnostic.Nunit1029.severity = error +dotnet_diagnostic.Nunit1030.severity = error +dotnet_diagnostic.Nunit1031.severity = error +dotnet_diagnostic.Nunit1032.severity = error + +dotnet_diagnostic.Nunit2001.severity = error +dotnet_diagnostic.Nunit2001.severity = error +dotnet_diagnostic.Nunit2002.severity = error +dotnet_diagnostic.Nunit2003.severity = error +dotnet_diagnostic.Nunit2004.severity = error +dotnet_diagnostic.Nunit2005.severity = error +dotnet_diagnostic.Nunit2006.severity = error +dotnet_diagnostic.Nunit2007.severity = error +dotnet_diagnostic.Nunit2008.severity = error +dotnet_diagnostic.Nunit2009.severity = error +dotnet_diagnostic.Nunit2010.severity = error +dotnet_diagnostic.Nunit2011.severity = error +dotnet_diagnostic.Nunit2012.severity = error +dotnet_diagnostic.Nunit2013.severity = error +dotnet_diagnostic.Nunit2014.severity = error +dotnet_diagnostic.Nunit2015.severity = error +dotnet_diagnostic.Nunit2016.severity = error +dotnet_diagnostic.Nunit2017.severity = error +dotnet_diagnostic.Nunit2018.severity = error +dotnet_diagnostic.Nunit2019.severity = error +dotnet_diagnostic.Nunit2020.severity = error +dotnet_diagnostic.Nunit2021.severity = error +dotnet_diagnostic.Nunit2022.severity = error +dotnet_diagnostic.Nunit2023.severity = error +dotnet_diagnostic.Nunit2024.severity = error +dotnet_diagnostic.Nunit2025.severity = error +dotnet_diagnostic.Nunit2026.severity = error +dotnet_diagnostic.Nunit2027.severity = error +dotnet_diagnostic.Nunit2028.severity = error +dotnet_diagnostic.Nunit2029.severity = error +dotnet_diagnostic.Nunit2030.severity = error +dotnet_diagnostic.Nunit2031.severity = error +dotnet_diagnostic.Nunit2032.severity = error +dotnet_diagnostic.Nunit2033.severity = error +dotnet_diagnostic.Nunit2034.severity = error +dotnet_diagnostic.Nunit2035.severity = error +dotnet_diagnostic.Nunit2036.severity = error +dotnet_diagnostic.Nunit2037.severity = error +dotnet_diagnostic.Nunit2038.severity = error +dotnet_diagnostic.Nunit2039.severity = error +dotnet_diagnostic.Nunit2040.severity = error +dotnet_diagnostic.Nunit2041.severity = error +dotnet_diagnostic.Nunit2042.severity = error +dotnet_diagnostic.Nunit2043.severity = error +dotnet_diagnostic.Nunit2044.severity = error +dotnet_diagnostic.Nunit2045.severity = error +dotnet_diagnostic.Nunit2046.severity = error +dotnet_diagnostic.Nunit2047.severity = error +dotnet_diagnostic.Nunit2048.severity = error +dotnet_diagnostic.Nunit2049.severity = error +dotnet_diagnostic.Nunit2050.severity = error + + +dotnet_diagnostic.Nunit3001.severity = error +dotnet_diagnostic.Nunit3002.severity = error +dotnet_diagnostic.Nunit3003.severity = error +dotnet_diagnostic.Nunit3004.severity = error diff --git a/src/Mairegger.Printing.Test/Content/CombinedPrintContentCollectionTests.cs b/src/Mairegger.Printing.Test/Content/CombinedPrintContentCollectionTests.cs index 5af3a3b..6c5b986 100644 --- a/src/Mairegger.Printing.Test/Content/CombinedPrintContentCollectionTests.cs +++ b/src/Mairegger.Printing.Test/Content/CombinedPrintContentCollectionTests.cs @@ -43,8 +43,11 @@ public void Content() CombinedPrintContentCollection collection = new CombinedPrintContentCollection(m1.Select(i => i.Object).ToArray()); - Assert.That(collection.Content, Is.Not.Null); - CollectionAssert.AreEqual(m1.Select(i => i.Object), collection); + Assert.Multiple(() => + { + Assert.That(collection.Content, Is.Not.Null); + Assert.That(collection, Is.EqualTo(m1.Select(i => i.Object)).AsCollection); + }); foreach (var mock in m1) { @@ -52,4 +55,4 @@ public void Content() } } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Content/PrintContentTests.cs b/src/Mairegger.Printing.Test/Content/PrintContentTests.cs index 82ddb1e..2ffe3d9 100644 --- a/src/Mairegger.Printing.Test/Content/PrintContentTests.cs +++ b/src/Mairegger.Printing.Test/Content/PrintContentTests.cs @@ -89,14 +89,17 @@ public void TextLine() var grid = (Grid)icontent.Content; var uiElement = (TextBlock)grid.Children[0]; - Assert.That(uiElement.Text, Is.EqualTo("Test")); - - Assert.That(uiElement.FontSize, Is.EqualTo(32)); - Assert.That(grid.Background, Is.EqualTo(Brushes.Bisque)); - Assert.That(uiElement.FontWeight, Is.EqualTo(FontWeights.ExtraBold)); - Assert.That(uiElement.HorizontalAlignment, Is.EqualTo(HorizontalAlignment.Right)); - Assert.That(uiElement.Padding, Is.EqualTo(new Thickness(12))); - Assert.That(grid.Margin, Is.EqualTo(new Thickness(24))); + Assert.Multiple(() => + { + Assert.That(uiElement.Text, Is.EqualTo("Test")); + + Assert.That(uiElement.FontSize, Is.EqualTo(32)); + Assert.That(grid.Background, Is.EqualTo(Brushes.Bisque)); + Assert.That(uiElement.FontWeight, Is.EqualTo(FontWeights.ExtraBold)); + Assert.That(uiElement.HorizontalAlignment, Is.EqualTo(HorizontalAlignment.Right)); + Assert.That(uiElement.Padding, Is.EqualTo(new Thickness(12))); + Assert.That(grid.Margin, Is.EqualTo(new Thickness(24))); + }); } [Test] @@ -117,9 +120,12 @@ public void TextLine_Configuration() var grid = (Grid)icontent.Content; var uiElement = (TextBlock)grid.Children[0]; - Assert.That(uiElement.FontSize, Is.EqualTo(10)); - Assert.That(uiElement.FontFamily, Is.EqualTo(new FontFamily("Verdana"))); - Assert.That(uiElement.HorizontalAlignment, Is.EqualTo(HorizontalAlignment.Right)); + Assert.Multiple(() => + { + Assert.That(uiElement.FontSize, Is.EqualTo(10)); + Assert.That(uiElement.FontFamily, Is.EqualTo(new FontFamily("Verdana"))); + Assert.That(uiElement.HorizontalAlignment, Is.EqualTo(HorizontalAlignment.Right)); + }); } @@ -134,4 +140,4 @@ public void ToPrintContent() Assert.That(icontent.Content, Is.EqualTo(content)); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Content/PrintProcessorCollectionTests.cs b/src/Mairegger.Printing.Test/Content/PrintProcessorCollectionTests.cs index 8d9f126..e3e3dc1 100644 --- a/src/Mairegger.Printing.Test/Content/PrintProcessorCollectionTests.cs +++ b/src/Mairegger.Printing.Test/Content/PrintProcessorCollectionTests.cs @@ -38,7 +38,7 @@ public void Ctor() new Mock() }; PrintProcessorCollection pp = new PrintProcessorCollection(m1.Select(i => i.Object), "FileName"); - CollectionAssert.AreEqual(m1.Select(i => i.Object), pp); + Assert.That(pp, Is.EqualTo(m1.Select(i => i.Object)).AsCollection); Assert.That(pp.FileName, Is.EqualTo("FileName")); } @@ -49,11 +49,12 @@ public void Ctor_SingleElement() var p = new Mock(); PrintProcessorCollection pp = new PrintProcessorCollection(p.Object); - Assert.That(pp.FileName, Is.EqualTo(p.Object.FileName)); - - CollectionAssert.Contains(pp, p.Object); - - Assert.That(pp.Count, Is.EqualTo(1)); + Assert.Multiple(() => + { + Assert.That(pp.FileName, Is.EqualTo(p.Object.FileName)); + Assert.That(pp, Has.Member(p.Object)); + Assert.That(pp, Has.Count.EqualTo(1)); + }); } [Test] @@ -72,7 +73,7 @@ public void FileName_InvalidCharacters_GetsRemoved() Assert.That(ppcoll.FileName, Is.Empty); ppcoll.FileName = formattableString; - CollectionAssert.DoesNotContain(ppcoll.FileName, Path.GetInvalidFileNameChars()); + Assert.That(ppcoll.FileName, Has.No.Member(Path.GetInvalidFileNameChars())); } [Test] @@ -117,8 +118,11 @@ public void PreviewDocument1() public void PrintDocument_NoPrintProcessor_DoesNotPrint() { var ppcoll = new PrintProcessorCollection(Enumerable.Empty()); - Assert.That(ppcoll.PrintDocument(), Is.False); - Assert.That(ppcoll.PrintDocument(string.Empty), Is.False); + Assert.Multiple(() => + { + Assert.That(ppcoll.PrintDocument(), Is.False); + Assert.That(ppcoll.PrintDocument(string.Empty), Is.False); + }); } [Test] @@ -149,9 +153,12 @@ public void PrintDoucment_Direct_ReturnsTrue() testPrintProcessor.PrintDialog = printDialog.Object; - Assert.That(printProcessor.PrintDocument(), Is.True); - Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0], new LocalPrintServer()), Is.True); - Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0]), Is.True); + Assert.Multiple(() => + { + Assert.That(printProcessor.PrintDocument(), Is.True); + Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0], new LocalPrintServer()), Is.True); + Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0]), Is.True); + }); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs b/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs index ec05790..0c83381 100644 --- a/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs +++ b/src/Mairegger.Printing.Test/Content/PrintProcessorTests.cs @@ -60,8 +60,11 @@ public void Ctor() { var printProcessor = new Mock(); - Assert.That(printProcessor.Object.PrintDialog, Is.Not.Null); - Assert.That(printProcessor.Object.PageOrientation, Is.EqualTo(PageOrientation.Portrait)); + Assert.Multiple(() => + { + Assert.That(printProcessor.Object.PrintDialog, Is.Not.Null); + Assert.That(printProcessor.Object.PageOrientation, Is.EqualTo(PageOrientation.Portrait)); + }); } [Test] @@ -109,7 +112,7 @@ public void FileName_InvalidCharacters_GetsRemoved() mock.Object.FileName = formattableString; - CollectionAssert.DoesNotContain(mock.Object.FileName, Path.GetInvalidFileNameChars()); + Assert.That(mock.Object.FileName, Has.No.Member(Path.GetInvalidFileNameChars())); } [Test] @@ -158,9 +161,12 @@ public void IsAlternatingRowColor_False_NotColoring() pp.PrintDialog = printDialog.Object; pp.PrintDocument(); - Assert.That(retrievedContent[0].Content.GetValue(Panel.BackgroundProperty), Is.EqualTo(null)); - Assert.That(retrievedContent[1].Content.GetValue(Panel.BackgroundProperty), Is.EqualTo(null)); - Assert.That(retrievedContent[2].Content.GetValue(Panel.BackgroundProperty), Is.EqualTo(null)); + Assert.Multiple(() => + { + Assert.That(retrievedContent[0].Content.GetValue(Panel.BackgroundProperty), Is.EqualTo(null)); + Assert.That(retrievedContent[1].Content.GetValue(Panel.BackgroundProperty), Is.EqualTo(null)); + Assert.That(retrievedContent[2].Content.GetValue(Panel.BackgroundProperty), Is.EqualTo(null)); + }); } [Test] @@ -263,8 +269,11 @@ public void PrintDoucment_Direct_ReturnsTrue() printProcessor.PrintDialog = printDialog.Object; - Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0], new LocalPrintServer()), Is.True); - Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0]), Is.True); + Assert.Multiple(() => + { + Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0], new LocalPrintServer()), Is.True); + Assert.That(printProcessor.PrintDocument(PrinterSettings.InstalledPrinters[0]), Is.True); + }); } [Test] diff --git a/src/Mairegger.Printing.Test/Definition/ColumnDimensionAttributeTests.cs b/src/Mairegger.Printing.Test/Definition/ColumnDimensionAttributeTests.cs index 53eaa44..0c0f155 100644 --- a/src/Mairegger.Printing.Test/Definition/ColumnDimensionAttributeTests.cs +++ b/src/Mairegger.Printing.Test/Definition/ColumnDimensionAttributeTests.cs @@ -43,24 +43,33 @@ public void AbsoluteWidth_Test(double param) { double width = param * 100; var v = new ColumnDimensionAttribute(width, ColumnDimensionType.Pixels); - Assert.AreEqual(width, v.ColumnWidth); - Assert.AreEqual(ColumnDimensionType.Pixels, v.DimensionType); + Assert.Multiple(() => + { + Assert.That(v.ColumnWidth, Is.EqualTo(width)); + Assert.That(v.DimensionType, Is.EqualTo(ColumnDimensionType.Pixels)); + }); } [Test] public void RelativeWidth_Px() { var v = new ColumnDimensionAttribute("2px"); - Assert.That(v.DimensionType, Is.EqualTo(ColumnDimensionType.Pixels)); - Assert.That(v.ColumnWidth, Is.EqualTo(2)); + Assert.Multiple(() => + { + Assert.That(v.DimensionType, Is.EqualTo(ColumnDimensionType.Pixels)); + Assert.That(v.ColumnWidth, Is.EqualTo(2)); + }); } [Test] public void RelativeWidth_Start() { var v = new ColumnDimensionAttribute("3*"); - Assert.That(v.DimensionType, Is.EqualTo(ColumnDimensionType.Star)); - Assert.That(v.ColumnWidth, Is.EqualTo(3)); + Assert.Multiple(() => + { + Assert.That(v.DimensionType, Is.EqualTo(ColumnDimensionType.Star)); + Assert.That(v.ColumnWidth, Is.EqualTo(3)); + }); } [Test] @@ -89,8 +98,11 @@ public void RelativeWidth_Test2(double param) { double width = 1 / param; var v = new ColumnDimensionAttribute(width); - Assert.AreEqual(width, v.ColumnWidth); - Assert.AreEqual(ColumnDimensionType.Star, v.DimensionType); + Assert.Multiple(() => + { + Assert.That(v.ColumnWidth, Is.EqualTo(width)); + Assert.That(v.DimensionType, Is.EqualTo(ColumnDimensionType.Star)); + }); } } } diff --git a/src/Mairegger.Printing.Test/Definition/ExcludeFromPagesTests.cs b/src/Mairegger.Printing.Test/Definition/ExcludeFromPagesTests.cs index 12f78d3..5bcb460 100644 --- a/src/Mairegger.Printing.Test/Definition/ExcludeFromPagesTests.cs +++ b/src/Mairegger.Printing.Test/Definition/ExcludeFromPagesTests.cs @@ -25,12 +25,15 @@ public void Ctor() { var attribute = new ExcludeFromPageAttribute(PrintAppendixes.All, new PageRange(2, 5)); - Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.Exclude)); - Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Exclude)); - Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.Exclude)); - Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Exclude)); - Assert.That(attribute.GetPrintDefinition(6), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.Multiple(() => + { + Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.That(attribute.GetPrintDefinition(6), Is.EqualTo(PrintPartStatus.NotDefined)); + }); } [Test] @@ -38,11 +41,14 @@ public void Ctor1() { var attribute = new ExcludeFromPageAttribute(PrintAppendixes.All, 1, 3, 5); - Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.Exclude)); - Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Exclude)); - Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.Multiple(() => + { + Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Exclude)); + }); } [Test] @@ -50,11 +56,14 @@ public void Ctor2() { var attribute = new ExcludeFromPageAttribute(PrintAppendixes.All, 3); - Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Exclude)); - Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.Multiple(() => + { + Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Exclude)); + Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.NotDefined)); + }); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Definition/PrintDefinitionTest.cs b/src/Mairegger.Printing.Test/Definition/PrintDefinitionTest.cs index 783138b..f20a345 100644 --- a/src/Mairegger.Printing.Test/Definition/PrintDefinitionTest.cs +++ b/src/Mairegger.Printing.Test/Definition/PrintDefinitionTest.cs @@ -45,29 +45,41 @@ public void IsToPrint_CheckSinglePage() pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, PrintPartDefinitionAttribute.LastPage)); - // do not print on page #1 - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); - - // but print on last page - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, true), Is.True); + Assert.Multiple(() => + { + // do not print on page #1 + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); + + // but print on last page + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, true), Is.True); + }); } [Test] public void IsToPrint_ExcludeIsStrongerThanInclude() { var pd = new PrintDefinition(); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.False); + Assert.Multiple(() => + { + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.False); + }); pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, 2)); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.True); + Assert.Multiple(() => + { + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.True); + }); pd.SetPrintAttribute(new ExcludeFromPageAttribute(PrintAppendixes.Footer, 2)); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.False); + Assert.Multiple(() => + { + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.False); + }); } [Test] @@ -93,8 +105,11 @@ public void IsToPrint_IncludePage() pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, 2)); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); - Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.True); + Assert.Multiple(() => + { + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); + Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.True); + }); } [Test] @@ -122,4 +137,4 @@ public void SetPrintAttribute() Assert.That(pd.IsDefined(PrintAppendixes.Footer), Is.True); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Definition/PrintOnPageTests.cs b/src/Mairegger.Printing.Test/Definition/PrintOnPageTests.cs index 8688f41..8819fd8 100644 --- a/src/Mairegger.Printing.Test/Definition/PrintOnPageTests.cs +++ b/src/Mairegger.Printing.Test/Definition/PrintOnPageTests.cs @@ -25,12 +25,15 @@ public void Ctor() { var attribute = new PrintOnPageAttribute(PrintAppendixes.All, new PageRange(2, 5)); - Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.Include)); - Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Include)); - Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.Include)); - Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Include)); - Assert.That(attribute.GetPrintDefinition(6), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.Multiple(() => + { + Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.Include)); + Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Include)); + Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.Include)); + Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Include)); + Assert.That(attribute.GetPrintDefinition(6), Is.EqualTo(PrintPartStatus.NotDefined)); + }); } [Test] @@ -38,11 +41,14 @@ public void Ctor1() { var attribute = new PrintOnPageAttribute(PrintAppendixes.All, 1, 3, 5); - Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.Include)); - Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Include)); - Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Include)); + Assert.Multiple(() => + { + Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.Include)); + Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Include)); + Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.Include)); + }); } [Test] @@ -50,11 +56,14 @@ public void Ctor2() { var attribute = new PrintOnPageAttribute(PrintAppendixes.All, 3); - Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Include)); - Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); - Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.Multiple(() => + { + Assert.That(attribute.GetPrintDefinition(1), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(2), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(3), Is.EqualTo(PrintPartStatus.Include)); + Assert.That(attribute.GetPrintDefinition(4), Is.EqualTo(PrintPartStatus.NotDefined)); + Assert.That(attribute.GetPrintDefinition(5), Is.EqualTo(PrintPartStatus.NotDefined)); + }); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Definition/PrintingDimensionsTests.cs b/src/Mairegger.Printing.Test/Definition/PrintingDimensionsTests.cs index d15eb5a..dea1381 100644 --- a/src/Mairegger.Printing.Test/Definition/PrintingDimensionsTests.cs +++ b/src/Mairegger.Printing.Test/Definition/PrintingDimensionsTests.cs @@ -42,12 +42,15 @@ public void GetHeightFor() }; pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Header | PrintAppendixes.Footer | PrintAppendixes.Summary)); - Assert.That(pd.GetHeightFor(PrintAppendixes.Header, 1, false), Is.EqualTo(1)); - Assert.That(pd.GetHeightFor(PrintAppendixes.Footer, 1, false), Is.EqualTo(2)); + Assert.Multiple(() => + { + Assert.That(pd.GetHeightFor(PrintAppendixes.Header, 1, false), Is.EqualTo(1)); + Assert.That(pd.GetHeightFor(PrintAppendixes.Footer, 1, false), Is.EqualTo(2)); - Assert.That(pd.GetHeightFor(PrintAppendixes.HeaderDescription, 1, false), Is.EqualTo(0)); + Assert.That(pd.GetHeightFor(PrintAppendixes.HeaderDescription, 1, false), Is.EqualTo(0)); - Assert.That(() => pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Throws.ArgumentNullException); + Assert.That(() => pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Throws.ArgumentNullException); + }); pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.HeaderDescription)); Assert.That(pd.GetHeightFor(PrintAppendixes.HeaderDescription, 1, false), Is.EqualTo(3)); @@ -113,12 +116,15 @@ public void GetRangeFor() }; pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All)); - Assert.That(pd.GetRangeFor(PrintAppendixes.Header, 1, false), Is.EqualTo(new Printing.Definition.PageRange(10, 20))); - Assert.That(pd.GetRangeFor(PrintAppendixes.HeaderDescription, 1, false), Is.EqualTo(new Printing.Definition.PageRange(20, 50))); - Assert.That(pd.GetRangeForBodyGrid(1, false), Is.EqualTo(new Printing.Definition.PageRange(50, 905))); - Assert.That(pd.GetRangeFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(new Printing.Definition.PageRange(905, 945))); - Assert.That(pd.GetRangeFor(PrintAppendixes.Footer, 1, false), Is.EqualTo(new Printing.Definition.PageRange(945, 965))); - Assert.That(pd.GetRangeFor(PrintAppendixes.PageNumbers, 1, false), Is.EqualTo(new Printing.Definition.PageRange(965, 990))); + Assert.Multiple(() => + { + Assert.That(pd.GetRangeFor(PrintAppendixes.Header, 1, false), Is.EqualTo(new Printing.Definition.PageRange(10, 20))); + Assert.That(pd.GetRangeFor(PrintAppendixes.HeaderDescription, 1, false), Is.EqualTo(new Printing.Definition.PageRange(20, 50))); + Assert.That(pd.GetRangeForBodyGrid(1, false), Is.EqualTo(new Printing.Definition.PageRange(50, 905))); + Assert.That(pd.GetRangeFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(new Printing.Definition.PageRange(905, 945))); + Assert.That(pd.GetRangeFor(PrintAppendixes.Footer, 1, false), Is.EqualTo(new Printing.Definition.PageRange(945, 965))); + Assert.That(pd.GetRangeFor(PrintAppendixes.PageNumbers, 1, false), Is.EqualTo(new Printing.Definition.PageRange(965, 990))); + }); } [Test] @@ -137,7 +143,7 @@ public void PageSize_Test() Size pageSize = new Size(500, 1000); SetPageSizeToPrintDimension(printingDimensions, pageSize); - Assert.AreEqual(pageSize, printingDimensions.PageSize); + Assert.That(printingDimensions.PageSize, Is.EqualTo(pageSize)); } [Test] @@ -155,7 +161,7 @@ public void PrintablePageSize_Test( Size expected = new Size(pageSize.Width - margin.Left - margin.Right, pageSize.Height - margin.Top - margin.Bottom); - Assert.AreEqual(expected, printingDimensions.PrintablePageSize); + Assert.That(printingDimensions.PrintablePageSize, Is.EqualTo(expected)); } [Test] @@ -174,10 +180,13 @@ public void PrintDimensionTest() double pieces = 5; // sum of TestPrintDimensions double widthPerPiece = (totalWidth - 100) / pieces; - Assert.That(tpd.Column1, Is.EqualTo(1 * widthPerPiece), $"{nameof(tpd.Column1)}"); - Assert.That(tpd.Column2, Is.EqualTo(3 * widthPerPiece), $"{nameof(tpd.Column2)}"); - Assert.That(tpd.Column3, Is.EqualTo(100), $"{nameof(tpd.Column3)}"); - Assert.That(tpd.Column4, Is.EqualTo(1 * widthPerPiece), $"{nameof(tpd.Column4)}"); + Assert.Multiple(() => + { + Assert.That(tpd.Column1, Is.EqualTo(1 * widthPerPiece), $"{nameof(tpd.Column1)}"); + Assert.That(tpd.Column2, Is.EqualTo(3 * widthPerPiece), $"{nameof(tpd.Column2)}"); + Assert.That(tpd.Column3, Is.EqualTo(100), $"{nameof(tpd.Column3)}"); + Assert.That(tpd.Column4, Is.EqualTo(1 * widthPerPiece), $"{nameof(tpd.Column4)}"); + }); } [Test] @@ -300,4 +309,4 @@ public TestPrintDimension(Thickness margin) public double Column4 { get; private set; } } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Definition/RangeTests.cs b/src/Mairegger.Printing.Test/Definition/RangeTests.cs index f4ebd3a..77ca16c 100644 --- a/src/Mairegger.Printing.Test/Definition/RangeTests.cs +++ b/src/Mairegger.Printing.Test/Definition/RangeTests.cs @@ -29,14 +29,14 @@ public void IsInRange_InRange_ReturnsTrue() var r1 = new PageRange(5, 10); var r2 = new PageRange(6, 10); - Assert.True(r1.IsInRange(r2)); + Assert.That(r1.IsInRange(r2), Is.True); } [Test] public void IsInRange_InRange_True([Values(1, 2, 3, 4, 5)] double value) { var r = new PageRange(1, 100); - Assert.IsTrue(r.IsInRange(value)); + Assert.That(r.IsInRange(value), Is.True); } [Test] @@ -45,14 +45,14 @@ public void IsInRange_NotInRange_ReturnsFalse() var r1 = new PageRange(5, 10); var r2 = new PageRange(6, 10); - Assert.False(r2.IsInRange(r1)); + Assert.That(r2.IsInRange(r1), Is.False); } [Test] public void IsInRange_OutOfRange_False([Values(1, 2, 3, 4, 5)] double value) { var r = new PageRange(6, 10); - Assert.IsFalse(r.IsInRange(value)); + Assert.That(r.IsInRange(value), Is.False); } [Test] @@ -60,14 +60,14 @@ public void IsInRange_SameRange_ReturnsTrue() { var r1 = new PageRange(5, 10); - Assert.True(r1.IsInRange(r1)); + Assert.That(r1.IsInRange(r1), Is.True); } [Test] public void Length([Values(1, 2, 3, 4, 5)] double length) { var r = new PageRange(0, length); - Assert.AreEqual(r.Length, length); + Assert.That(length, Is.EqualTo(r.Length)); } [Test] @@ -89,8 +89,11 @@ public void Parse_Invalid() public void Parse_ValidRange() { var r = PageRange.Parse("4-6"); - Assert.That(r.From, Is.EqualTo(4)); - Assert.That(r.To, Is.EqualTo(6)); + Assert.Multiple(() => + { + Assert.That(r.From, Is.EqualTo(4)); + Assert.That(r.To, Is.EqualTo(6)); + }); } [Test] @@ -98,9 +101,9 @@ public void ParseRanges() { var ranges = PageRange.ParseRanges("1-2,5,10-11").ToList(); - CollectionAssert.Contains(ranges, PageRange.Parse("1-2")); - CollectionAssert.Contains(ranges, PageRange.Parse("5")); - CollectionAssert.Contains(ranges, PageRange.Parse("10-11")); + Assert.That(ranges, Has.Member(PageRange.Parse("1-2"))); + Assert.That(ranges, Has.Member(PageRange.Parse("5"))); + Assert.That(ranges, Has.Member(PageRange.Parse("10-11"))); } [Test] @@ -110,8 +113,6 @@ public void Range_Equals() var r2 = new PageRange(5, 10); Assert.That(r1, Is.EqualTo(r2)); - Assert.True(r1 == r2); - Assert.True(Equals(r1, r2)); Assert.That(r1.GetHashCode(), Is.EqualTo(r2.GetHashCode())); } @@ -158,14 +159,6 @@ public void Range_NotEquals() var r2 = new PageRange(6, 10); Assert.That(r1, Is.Not.EqualTo(r2)); - - Assert.True(r1 != r2); - - Assert.False(Equals(r1, r2)); - Assert.False(r1.Equals(null)); - Assert.That(r1, Is.Not.EqualTo(null)); - // ReSharper disable once SuspiciousTypeConversion.Global - Assert.False(r1.Equals(5)); Assert.That(r1.GetHashCode(), Is.Not.EqualTo(r2.GetHashCode())); } @@ -184,4 +177,4 @@ public void Range_ToString() Assert.That(r.ToString(), Is.EqualTo("7-11")); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj b/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj index 3c03d49..799f9f4 100644 --- a/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj +++ b/src/Mairegger.Printing.Test/Mairegger.Printing.Tests.csproj @@ -3,6 +3,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Versions.props b/src/Versions.props index 1870950..9f7821a 100644 --- a/src/Versions.props +++ b/src/Versions.props @@ -13,7 +13,7 @@ 3.6.133 4.20.69 - 3.14.0 + 4.0.0 4.5.0 17.8.0 6.0.0 From 84948e2a3fa2191a91b8cd56465e7d7b980d1f8f Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Tue, 12 Dec 2023 09:02:53 +0100 Subject: [PATCH 26/32] Enable additional package vulnerability warnings --- src/Directory.Packages.props | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 70f3e6a..2a82522 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -23,10 +23,15 @@ true false - $(WarningsAsErrors);NU1506 - $(WarningsAsErrors);NU1504 + $(WarningsAsErrors);NU1506 + + + + + + $(WarningsAsErrors);NU1901;NU1902;NU1903;NU1904 From 79c819f7ddc0d11d46bb8bc07de3e7aac28070cf Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 8 Jan 2024 16:28:12 +0100 Subject: [PATCH 27/32] Update package versions --- src/Directory.Packages.props | 2 +- src/Versions.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 2a82522..84dd2ba 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -46,7 +46,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Versions.props b/src/Versions.props index 9f7821a..c447780 100644 --- a/src/Versions.props +++ b/src/Versions.props @@ -12,8 +12,8 @@ 3.6.133 - 4.20.69 - 4.0.0 + 4.20.70 + 4.0.1 4.5.0 17.8.0 6.0.0 From 7bda8dfa0fa00da1c90ddeac55992530cbde3d7a Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 5 Feb 2024 11:39:54 +0100 Subject: [PATCH 28/32] Update NUnit.Analyzers version The version of NUnit.Analyzers has been updated in Versions.props and Directory.Packages.props files. Instead of hardcoding the value, we are now using a variable to easily manage the NUnit.Analyzers version across different parts of the repository. --- src/Directory.Packages.props | 2 +- src/Versions.props | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 84dd2ba..c7a41b7 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -46,7 +46,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Versions.props b/src/Versions.props index c447780..370ae89 100644 --- a/src/Versions.props +++ b/src/Versions.props @@ -15,6 +15,7 @@ 4.20.70 4.0.1 4.5.0 + 4.0.1 17.8.0 6.0.0 4.1.1 From e81f030a201933f7045a0e298a595bfb751c0084 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Tue, 6 Feb 2024 09:23:42 +0100 Subject: [PATCH 29/32] Some code improvements --- .../Content/StringLineItem.cs | 4 +-- .../Definition/ColumnDimensionAttribute.cs | 12 +++++++- .../Definition/PageRange.cs | 4 +++ .../Definition/PrintDimension.cs | 4 +++ .../Internal/InternalPrintProcessor.cs | 4 +-- .../Internal/PrintOnAttributeHelper.cs | 4 +-- .../PrintProcessor/PrintProcessor.cs | 7 ++--- .../Properties/l10nComposite.cs | 30 +++++++++++++++++++ 8 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 src/Mairegger.Printing/Properties/l10nComposite.cs diff --git a/src/Mairegger.Printing/Content/StringLineItem.cs b/src/Mairegger.Printing/Content/StringLineItem.cs index db1e82a..29cebe5 100644 --- a/src/Mairegger.Printing/Content/StringLineItem.cs +++ b/src/Mairegger.Printing/Content/StringLineItem.cs @@ -111,7 +111,7 @@ public IEnumerable PageContents(double currentPageHeight, Size printa } } - private UIElement ConstructContent(string text) + private Grid ConstructContent(string text) { var g = new Grid(); if (Background != null) @@ -159,4 +159,4 @@ private double GetLineHeight() return textBlock.DesiredSize.Height; } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs b/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs index 186c559..b42dfa1 100644 --- a/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs +++ b/src/Mairegger.Printing/Definition/ColumnDimensionAttribute.cs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Text; + namespace Mairegger.Printing.Definition { using System; @@ -50,7 +52,11 @@ public ColumnDimensionAttribute(double columnWidth) public ColumnDimensionAttribute(string value) { + #if NETFRAMEWORK if (value.EndsWith("*", StringComparison.Ordinal)) + #else + if (value.EndsWith('*')) + #endif { DimensionType = ColumnDimensionType.Star; @@ -76,12 +82,16 @@ public ColumnDimensionAttribute(string value) } else { + #if NET8_0_OR_GREATER + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, l10nComposite.ColumnDimensionAttribute_ColumnDimensionAttribute__0__is_no_valid_column_dimension, value), nameof(value)); + #else throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, l10n.ColumnDimensionAttribute_ColumnDimensionAttribute__0__is_no_valid_column_dimension, value), nameof(value)); + #endif } } /// - /// Initializes a new instance of the class defining the column width width + /// Initializes a new instance of the class defining the column width width /// the passed value. The column width is either Relative or Absolute. /// /// The width of the column. diff --git a/src/Mairegger.Printing/Definition/PageRange.cs b/src/Mairegger.Printing/Definition/PageRange.cs index 7927048..5b8b1c4 100644 --- a/src/Mairegger.Printing/Definition/PageRange.cs +++ b/src/Mairegger.Printing/Definition/PageRange.cs @@ -35,7 +35,11 @@ public PageRange(double fromValue, double toValue) { if (fromValue.CompareTo(toValue) > 0) { + #if NET8_0_OR_GREATER + throw new ArgumentOutOfRangeException(nameof(fromValue), string.Format(CultureInfo.CurrentCulture, l10nComposite.PageRange_PageRange__0__must_be_lower_or_equal_than__1_, nameof(fromValue), nameof(toValue))); + #else throw new ArgumentOutOfRangeException(nameof(fromValue), string.Format(CultureInfo.CurrentCulture, l10n.PageRange_PageRange__0__must_be_lower_or_equal_than__1_, nameof(fromValue), nameof(toValue))); + #endif } From = fromValue; diff --git a/src/Mairegger.Printing/Definition/PrintDimension.cs b/src/Mairegger.Printing/Definition/PrintDimension.cs index 0e40b84..f263253 100644 --- a/src/Mairegger.Printing/Definition/PrintDimension.cs +++ b/src/Mairegger.Printing/Definition/PrintDimension.cs @@ -145,7 +145,11 @@ internal double GetHeightFor(PrintAppendixes printAppendix, int pageNumber, bool var uiElement = _printPartDimensionsRetrievalDictionary[printAppendix](PrintProcessor); if (uiElement == null) { + #if NET8_0_OR_GREATER + throw new ArgumentNullException($"{nameof(PrintProcessor)}.Get{printAppendix}()", string.Format(CultureInfo.CurrentCulture, l10nComposite.PrintDimension_GetHeightFor__0__must_return_a_value_for__Get_1_____if___2___is_set_, typeof(PrintProcessor), printAppendix, printAppendix)); + #else throw new ArgumentNullException($"{nameof(PrintProcessor)}.Get{printAppendix}()", string.Format(CultureInfo.CurrentCulture, l10n.PrintDimension_GetHeightFor__0__must_return_a_value_for__Get_1_____if___2___is_set_, typeof(PrintProcessor), printAppendix, printAppendix)); + #endif } uiElement.Measure(new Size(double.MaxValue, double.MaxValue)); value = uiElement.DesiredSize.Height; diff --git a/src/Mairegger.Printing/Internal/InternalPrintProcessor.cs b/src/Mairegger.Printing/Internal/InternalPrintProcessor.cs index 3c61f1f..207da2e 100644 --- a/src/Mairegger.Printing/Internal/InternalPrintProcessor.cs +++ b/src/Mairegger.Printing/Internal/InternalPrintProcessor.cs @@ -388,7 +388,7 @@ private void PositionUiElement(PageContent pageContent, UIElement panel, PrintAp PositionUiElement(pageContent, contentControl, position); } - private static Brush ComputeBackGround(PrintAppendixes printAppendix) + private static SolidColorBrush ComputeBackGround(PrintAppendixes printAppendix) { var factor = (byte)(byte.MaxValue - (byte)((byte.MaxValue / (byte)Enum.GetValues(typeof(PrintAppendixes)).Length) * (byte)printAppendix)); return new SolidColorBrush(Color.FromArgb(128, factor, factor, factor)); @@ -482,4 +482,4 @@ public static FixedDocument CreateFixedDocument(PrintProcessorCollection collect return fixedDocument; } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing/Internal/PrintOnAttributeHelper.cs b/src/Mairegger.Printing/Internal/PrintOnAttributeHelper.cs index 4696d01..75ad155 100644 --- a/src/Mairegger.Printing/Internal/PrintOnAttributeHelper.cs +++ b/src/Mairegger.Printing/Internal/PrintOnAttributeHelper.cs @@ -47,7 +47,7 @@ public PrintPartStatus IsPrintOnPage(PrintAppendixes printA, int page) } var printOnPageAttributes = GetPossiblePrintDefinitionAttributes(printA).ToList(); - if (!printOnPageAttributes.Any()) + if (printOnPageAttributes.Count == 0) { return PrintPartStatus.NotDefined; } @@ -75,4 +75,4 @@ private IEnumerable GetPossiblePrintDefinitionAttributes(P return _printOnAttributes.Where(v => v.PrintAppendixes.HasFlag(printAppendixes)); } } -} \ No newline at end of file +} diff --git a/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs b/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs index 9715ed0..7720fc3 100644 --- a/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs +++ b/src/Mairegger.Printing/PrintProcessor/PrintProcessor.cs @@ -84,6 +84,8 @@ public PrintDimension PrintDimension set => _printDimension = value ?? throw new ArgumentNullException(nameof(value)); } + private static readonly char[] AdditionalInvalidCharacters = ['.']; + /// /// Sets the global configuration of the . This action is applied before each print. /// @@ -214,10 +216,7 @@ public static void PreviewDocument(PrintProcessorCollection ppc, IWindowProvider internal static string ReplaceInvalidCharsFromFilename(string path) { - var invalidFileNameChars = Path.GetInvalidFileNameChars().Union(new[] - { - '.' - }).ToList(); + var invalidFileNameChars = Path.GetInvalidFileNameChars().Union(AdditionalInvalidCharacters).ToList(); return path.Aggregate( new StringBuilder(), (sb, c) => diff --git a/src/Mairegger.Printing/Properties/l10nComposite.cs b/src/Mairegger.Printing/Properties/l10nComposite.cs new file mode 100644 index 0000000..a43475a --- /dev/null +++ b/src/Mairegger.Printing/Properties/l10nComposite.cs @@ -0,0 +1,30 @@ +// Copyright 2017-2022 Michael Mairegger +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Diagnostics.CodeAnalysis; +using System.Text; + +#if NET8_0_OR_GREATER + +namespace Mairegger.Printing.Properties; + +[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores")] +public class l10nComposite +{ + public static readonly CompositeFormat ColumnDimensionAttribute_ColumnDimensionAttribute__0__is_no_valid_column_dimension = CompositeFormat.Parse(l10n.ColumnDimensionAttribute_ColumnDimensionAttribute__0__is_no_valid_column_dimension); + public static readonly CompositeFormat PageRange_PageRange__0__must_be_lower_or_equal_than__1_ = CompositeFormat.Parse(l10n.PageRange_PageRange__0__must_be_lower_or_equal_than__1_); + public static readonly CompositeFormat PrintDimension_GetHeightFor__0__must_return_a_value_for__Get_1_____if___2___is_set_ = CompositeFormat.Parse(l10n.PrintDimension_GetHeightFor__0__must_return_a_value_for__Get_1_____if___2___is_set_); +} + +#endif From 8db9e9ffc045028df0dd777fdcf974e06b861de9 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 19 Feb 2024 08:25:42 +0100 Subject: [PATCH 30/32] Upgrade to 8.0.2 --- src/Directory.Packages.props | 2 +- src/Versions.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index c7a41b7..2550c49 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -51,7 +51,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Versions.props b/src/Versions.props index 370ae89..6fc483b 100644 --- a/src/Versions.props +++ b/src/Versions.props @@ -16,7 +16,7 @@ 4.0.1 4.5.0 4.0.1 - 17.8.0 + 17.9.0 6.0.0 4.1.1 From bbe8a1cb5eb7f3e1c388eaf335d14a5ef82d6896 Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 19 Feb 2024 09:21:05 +0100 Subject: [PATCH 31/32] Change build conditions from 'master' to 'main' --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6006191..21f86f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ env: jobs: build-production: - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/main' runs-on: windows-latest environment: production steps: @@ -26,7 +26,7 @@ jobs: workingDirectory: ${{ env.workingDirectory }} build-ci: - if: github.ref != 'refs/heads/master' + if: github.ref != 'refs/heads/main' runs-on: windows-latest steps: - uses: actions/checkout@v3 From 5e172ae190d651e550f93cd8624809e9d285c9eb Mon Sep 17 00:00:00 2001 From: Michael Mairegger Date: Mon, 19 Feb 2024 10:02:26 +0100 Subject: [PATCH 32/32] Add environment to publish.yml --- .github/workflows/publish.yml | 43 ++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9b93656..9b44bf3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,34 +1,35 @@ name: Publish on: push: - tags: + tags: - 'v*.*.*' env: buildConfiguration: 'Release' workingDirectory: 'src' - + jobs: - build: + deploy: runs-on: windows-latest + environment: production steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: ./.github/actions/build-and-test + id: build-and-test + with: + buildConfiguration: ${{ env.buildConfiguration }} + workingDirectory: ${{ env.workingDirectory }} + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST: ${{ secrets.SONAR_HOST }} - - uses: ./.github/actions/build-and-test - id: build-and-test - with: - buildConfiguration: ${{ env.buildConfiguration }} - workingDirectory: ${{ env.workingDirectory }} - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST: ${{ secrets.SONAR_HOST }} + - name: Pack + run: dotnet pack --configuration Release --no-build /p:Version=${{ steps.build-and-test.outputs.nuget-package-version }} --output artifacts + working-directory: src - - name: Pack - run: dotnet pack --configuration Release --no-build /p:Version=${{ steps.build-and-test.outputs.nuget-package-version }} --output artifacts - working-directory: src - - - name: Push with dotnet - run: dotnet nuget push artifacts\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json - working-directory: src + - name: Push with dotnet + run: dotnet nuget push artifacts\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json + working-directory: src