From e353ba258dbd43177a199995fa1423c1ca765c02 Mon Sep 17 00:00:00 2001 From: Remco Koopmans Date: Sat, 27 Jul 2024 16:49:59 +0200 Subject: [PATCH 1/6] MacOS builds are now ARM, drop dotnet 3.1 for mac --- .github/workflows/ci-cd.yml | 82 ++++++++++++++++++++++++------------- README.md | 1 - 2 files changed, 53 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index aa1fa1b..0e4dda9 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -18,20 +18,29 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - + dotnet-target: ["3.1.x", "6.0.x"] + exclude: + - os: macOS-latest + dotnet-target: "3.1.x" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up dotnet - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v4 with: dotnet-version: | - 3.1.x - 5.0.x - 6.0.x + 3.1.x + 6.0.x + if: ${{ !startsWith(matrix.os, 'macOS') }} + + - name: Set up dotnet macOS ARM + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.0.x + if: startsWith(matrix.os, 'macOS') - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} @@ -46,21 +55,32 @@ jobs: run: | dotnet build --configuration Release --version-suffix "$GITHUB_RUN_ID-prerelease" --no-restore - - name: Run tests on mac and linux - if: ${{ !startsWith(matrix.os, 'windows') }} - env: - TINIFY_KEY: ${{ secrets.TINIFY_KEY }} + - name: Run tests (Linux and macOS) + if: runner.os != 'Windows' run: | - dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests - dotnet test --configuration Release --no-build --verbosity normal --framework net5.0 test/Tinify.Tests - dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests - - - name: Run tests on windows - if: startsWith(matrix.os, 'windows') + if [ "${{ matrix.dotnet-target }}" == "3.1.x" ]; then + dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests + elif [ "${{ matrix.dotnet-target }}" == "6.0.x" ]; then + dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests + else + echo "Error: Unsupported .NET version ${{ matrix.dotnet-target }}" && exit 1 + fi + - name: Run tests (Windows) + if: runner.os == 'Windows' env: TINIFY_KEY: ${{ secrets.TINIFY_KEY }} run: | - dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests + if ("${{ matrix.dotnet-target }}" -eq "3.1.x") { + dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests + } elseif ("${{ matrix.dotnet-target }}" -eq "5.0.x") { + dotnet test --configuration Release --no-build --verbosity normal --framework net5.0 test/Tinify.Tests + } elseif ("${{ matrix.dotnet-target }}" -eq "6.0.x") { + dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests + } else { + Write-Error "Unsupported .NET version $env:MATRIX_DOTNET_VERSION" + exit 1 + } + integrationTests: if: github.event_name == 'push' @@ -72,19 +92,20 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - + dotnet-version: [3.1.x, 6.0.x] + exclude: + - os: macOS-latest + dotnet-version: 3.1.x steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up dotnet - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 3.1.x - 6.0.x + dotnet-version: ${{ matrix.dotnet-version }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} @@ -104,8 +125,11 @@ jobs: env: TINIFY_KEY: ${{ secrets.TINIFY_KEY }} run: | - dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests.Integration - dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration + if [ ${{ matrix.dotnet-version }} == "3.1.x" ]; then + dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests.Integration + else + dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration + fi - name: Run tests on windows if: startsWith(matrix.os, 'windows') @@ -124,12 +148,12 @@ jobs: - "integrationTests" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up dotnet - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v4 with: dotnet-version: 6.0.x diff --git a/README.md b/README.md index 5f9c6df..90af2fb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - [![MIT License](http://img.shields.io/badge/license-MIT-green.svg) ](https://github.com/tinify/tinify-python/blob/main/LICENSE) [![CI_CD](https://github.com/tinify/tinify-net/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/tinify/tinify-net/actions/workflows/ci-cd.yml) [![Nuget](https://img.shields.io/nuget/v/Tinify)](https://www.nuget.org/packages/Tinify) From 6bbb642014b764f02481f8b32853ea7dd06e57c7 Mon Sep 17 00:00:00 2001 From: Remco Koopmans Date: Sat, 27 Jul 2024 21:23:28 +0200 Subject: [PATCH 2/6] Add devcontainer for vscode --- .devcontainer/Dockerfile | 25 ++++++++++++++++++++ .devcontainer/devcontainer.json | 19 +++++++++++++++ test/Tinify.Tests.Integration/Integration.cs | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..279abee --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,25 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base + +# Install .NET Core 3.1 SDK +RUN apt-get update \ + && apt-get install -y wget \ + && wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && apt-get update \ + && apt-get install -y dotnet-sdk-3.1 mono-complete ca-certificates-mono \ + && rm -rf /var/lib/apt/lists/* + +# Set up environment +ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 +ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME; + + +USER vscode +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..1ca1cd3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +{ + "name": "DotNet Core 3.1 and .NET 6", + "build": { + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-dotnettools.csharp", + "GitHub.vscode-github-actions" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + } + } + }, + "postCreateCommand": "dotnet restore", + "remoteUser": "vscode" + } diff --git a/test/Tinify.Tests.Integration/Integration.cs b/test/Tinify.Tests.Integration/Integration.cs index c39d1f7..76947c0 100755 --- a/test/Tinify.Tests.Integration/Integration.cs +++ b/test/Tinify.Tests.Integration/Integration.cs @@ -208,7 +208,7 @@ public void Should_PreserveMetadata() { using (var file = new TempFile()) { - var options = new[] {"copyright", "location"}; + var options = new[] {"location", "copyright"}; optimized.Preserve(options).ToFile(file.Path).Wait(); var size = new FileInfo(file.Path).Length; From afe7aba33cc23c5800672d2f5e650b8627da0cd9 Mon Sep 17 00:00:00 2001 From: Remco Koopmans Date: Sat, 27 Jul 2024 21:39:20 +0200 Subject: [PATCH 3/6] Drop .NET 5 and add .NET 8 --- .devcontainer/Dockerfile | 11 +------ .devcontainer/devcontainer.json | 2 +- .github/workflows/ci-cd.yml | 30 +++++++++++++++---- .../Tinify.Tests.Integration.csproj | 2 +- test/Tinify.Tests/Tinify.Tests.csproj | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 279abee..e6783b1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,13 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base - -# Install .NET Core 3.1 SDK -RUN apt-get update \ - && apt-get install -y wget \ - && wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ - && dpkg -i packages-microsoft-prod.deb \ - && apt-get update \ - && apt-get install -y dotnet-sdk-3.1 mono-complete ca-certificates-mono \ - && rm -rf /var/lib/apt/lists/* +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base # Set up environment ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1ca1cd3..7005f56 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "DotNet Core 3.1 and .NET 6", + "name": ".NET 8", "build": { "dockerfile": "Dockerfile" }, diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 0e4dda9..f2219ca 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - dotnet-target: ["3.1.x", "6.0.x"] + dotnet-target: ["3.1.x", "6.0.x", "8.0.x"] exclude: - os: macOS-latest dotnet-target: "3.1.x" @@ -32,12 +32,15 @@ jobs: dotnet-version: | 3.1.x 6.0.x + 8.0.x if: ${{ !startsWith(matrix.os, 'macOS') }} - name: Set up dotnet macOS ARM uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: | + 6.0.x + 8.0.x if: startsWith(matrix.os, 'macOS') - uses: actions/cache@v4 @@ -62,6 +65,8 @@ jobs: dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests elif [ "${{ matrix.dotnet-target }}" == "6.0.x" ]; then dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests + elif [ "${{ matrix.dotnet-target }}" == "8.0.x" ]; then + dotnet test --configuration Release --no-build --verbosity normal --framework net8.0 test/Tinify.Tests else echo "Error: Unsupported .NET version ${{ matrix.dotnet-target }}" && exit 1 fi @@ -76,6 +81,8 @@ jobs: dotnet test --configuration Release --no-build --verbosity normal --framework net5.0 test/Tinify.Tests } elseif ("${{ matrix.dotnet-target }}" -eq "6.0.x") { dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests + } elseif ("${{ matrix.dotnet-target }}" -eq "8.0.x") { + dotnet test --configuration Release --no-build --verbosity normal --framework net8.0 test/Tinify.Tests } else { Write-Error "Unsupported .NET version $env:MATRIX_DOTNET_VERSION" exit 1 @@ -92,7 +99,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - dotnet-version: [3.1.x, 6.0.x] + dotnet-version: [3.1.x, 8.0.x] exclude: - os: macOS-latest dotnet-version: 3.1.x @@ -127,8 +134,10 @@ jobs: run: | if [ ${{ matrix.dotnet-version }} == "3.1.x" ]; then dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests.Integration - else + elif [ ${{ matrix.dotnet-version }} == "6.0.x" ]; then dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration + else + dotnet test --configuration Release --no-build --verbosity normal --framework net8.0 test/Tinify.Tests.Integration fi - name: Run tests on windows @@ -136,7 +145,18 @@ jobs: env: TINIFY_KEY: ${{ secrets.TINIFY_KEY }} run: | - dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration + if ("${{ matrix.dotnet-target }}" -eq "6.0.x") { + dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration + } elseif ("${{ matrix.dotnet-target }}" -eq "3.1.x") { + dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests.Integration + } elseif ("${{ matrix.dotnet-target }}" -eq "8.0.x") { + dotnet test --configuration Release --no-build --verbosity normal --framework net8.0 test/Tinify.Tests.Integration + } else { + Write-Error "Unsupported .NET version $env:MATRIX_DOTNET_VERSION" + exit 1 + } + + publish: if: | diff --git a/test/Tinify.Tests.Integration/Tinify.Tests.Integration.csproj b/test/Tinify.Tests.Integration/Tinify.Tests.Integration.csproj index 4979415..1abcc76 100644 --- a/test/Tinify.Tests.Integration/Tinify.Tests.Integration.csproj +++ b/test/Tinify.Tests.Integration/Tinify.Tests.Integration.csproj @@ -1,7 +1,7 @@  - net462;net472;net48;netcoreapp3.1;net5.0;net6.0 + net462;net472;net48;netcoreapp3.1;net6.0;net8.0 Tinify.Tests.Integration Tinify.Tests.Integration true diff --git a/test/Tinify.Tests/Tinify.Tests.csproj b/test/Tinify.Tests/Tinify.Tests.csproj index 4ceac4e..46f7b43 100644 --- a/test/Tinify.Tests/Tinify.Tests.csproj +++ b/test/Tinify.Tests/Tinify.Tests.csproj @@ -1,7 +1,7 @@  - net462;net472;net48;netcoreapp3.1;net5.0;net6.0 + net462;net472;net48;netcoreapp3.1;net6.0;net8.0 Tinify.Tests Tinify.Tests true From cad99524f2ab86e2ca853e6207dfcd38f4bb76db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 21:33:41 +0000 Subject: [PATCH 4/6] Bump System.Text.Json from 6.0.5 to 8.0.4 in /src/Tinify Bumps System.Text.Json from 6.0.5 to 8.0.4. --- updated-dependencies: - dependency-name: System.Text.Json dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- src/Tinify/Tinify.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 src/Tinify/Tinify.csproj diff --git a/src/Tinify/Tinify.csproj b/src/Tinify/Tinify.csproj old mode 100755 new mode 100644 index e71c406..3696e2a --- a/src/Tinify/Tinify.csproj +++ b/src/Tinify/Tinify.csproj @@ -41,7 +41,7 @@ - + From b72add15dd54b84ab735367fca702e64ff92cf38 Mon Sep 17 00:00:00 2001 From: Remco Koopmans Date: Sat, 27 Jul 2024 21:49:41 +0200 Subject: [PATCH 5/6] Prepare new release --- .github/workflows/ci-cd.yml | 6 +++--- CHANGES.md | 6 ++++++ src/Tinify/Tinify.csproj | 2 +- test/Tinify.Tests.Integration/Integration.cs | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index f2219ca..329f3f6 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -145,11 +145,11 @@ jobs: env: TINIFY_KEY: ${{ secrets.TINIFY_KEY }} run: | - if ("${{ matrix.dotnet-target }}" -eq "6.0.x") { + if ("${{ matrix.dotnet-version }}" -eq "6.0.x") { dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration - } elseif ("${{ matrix.dotnet-target }}" -eq "3.1.x") { + } elseif ("${{ matrix.dotnet-version }}" -eq "3.1.x") { dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests.Integration - } elseif ("${{ matrix.dotnet-target }}" -eq "8.0.x") { + } elseif ("${{ matrix.dotnet-version }}" -eq "8.0.x") { dotnet test --configuration Release --no-build --verbosity normal --framework net8.0 test/Tinify.Tests.Integration } else { Write-Error "Unsupported .NET version $env:MATRIX_DOTNET_VERSION" diff --git a/CHANGES.md b/CHANGES.md index 7645389..1eeb028 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +## 1.7.0 +* Added .NET 8 as test target +* Dropped .NET 6 +* Added tests for macOS ARM +* Bumped System.Text.Json to 8.0.4 + ## 1.6.0 * Increased TargetFramework to netstandard2.0 * Tinify client is now tested on diff --git a/src/Tinify/Tinify.csproj b/src/Tinify/Tinify.csproj index 3696e2a..132fe1c 100644 --- a/src/Tinify/Tinify.csproj +++ b/src/Tinify/Tinify.csproj @@ -3,7 +3,7 @@ .NET client for the Tinify API. Tinify compresses your images intelligently. Read more at https://tinify.com. Tinify - 1.6.0 + 1.7.0 Tinify netstandard2.0 Tinify diff --git a/test/Tinify.Tests.Integration/Integration.cs b/test/Tinify.Tests.Integration/Integration.cs index 76947c0..edd8fe5 100755 --- a/test/Tinify.Tests.Integration/Integration.cs +++ b/test/Tinify.Tests.Integration/Integration.cs @@ -229,12 +229,12 @@ public void Should_Resize_And_PreserveMetadata() { using var file = new TempFile(); var resizeOptions = new { method = "fit", width = 50, height = 20 }; - var preserveOptions = new[] { "copyright", "location" }; + var preserveOptions = new[] { "location", "copyright" }; optimized.Resize(resizeOptions).Preserve(preserveOptions).ToFile(file.Path).Wait(); var size = new FileInfo(file.Path).Length; Assert.Greater(size, 500); - Assert.Less(size, 1100); + Assert.Less(size, 1150); var metaData = new ImageMetadata(file.Path); Assert.That(metaData.IsPng); From 1a18e5f11cc80696e70588db45ece4b888c562f6 Mon Sep 17 00:00:00 2001 From: Remco Koopmans Date: Sun, 28 Jul 2024 10:28:34 +0200 Subject: [PATCH 6/6] Include dotnet 3.1, 6.0 and 8.0 in devcontainer --- .devcontainer/Dockerfile | 27 +++++++++++++++++++- test/Tinify.Tests.Integration/Integration.cs | 6 +++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e6783b1..01ab21d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base # Set up environment ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 @@ -12,5 +12,30 @@ RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME; +# Install .NET Core 3.1 SDK +RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && apt-get update \ + && apt-get install -y apt-transport-https \ + && apt-get update \ + && apt-get install -y dotnet-sdk-3.1 \ + && rm -rf /var/lib/apt/lists/* + +# Install .NET 5 SDK +RUN apt-get update \ + && apt-get install -y dotnet-sdk-8.0 \ + && rm -rf /var/lib/apt/lists/* + +RUN apt update && apt install -y dirmngr ca-certificates gnupg && \ + gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ + echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \ + apt update && apt install -y mono-complete ca-certificates-mono && \ + rm -rf /var/lib/apt/lists/* + + + +RUN cert-sync /etc/ssl/certs/ca-certificates.crt && \ + mozroots --import --sync + USER vscode ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/test/Tinify.Tests.Integration/Integration.cs b/test/Tinify.Tests.Integration/Integration.cs index edd8fe5..1782b57 100755 --- a/test/Tinify.Tests.Integration/Integration.cs +++ b/test/Tinify.Tests.Integration/Integration.cs @@ -220,7 +220,8 @@ public void Should_PreserveMetadata() /* width == 137 */ Assert.AreEqual(137, metaData.GetImageWidth()); - Assert.IsTrue(metaData.ContainsStringInXmpData(VoormediaCopyright)); + bool containsCopyright = File.ReadAllText(file.Path).Contains(VoormediaCopyright); + Assert.IsTrue(containsCopyright, "The file should contain the copyright string."); } } @@ -241,7 +242,8 @@ public void Should_Resize_And_PreserveMetadata() /* width == 50 */ Assert.AreEqual(50, metaData.GetImageWidth()); - Assert.IsTrue(metaData.ContainsStringInXmpData(VoormediaCopyright)); + bool containsCopyright = File.ReadAllText(file.Path).Contains(VoormediaCopyright); + Assert.IsTrue(containsCopyright, "The file should contain the copyright string."); } [Test]