diff --git a/.github/workflows/TvdbClient-Nuget-Package.yml b/.github/workflows/TvdbClient-Nuget-Package.yml
index cb5a906..2ba11ae 100644
--- a/.github/workflows/TvdbClient-Nuget-Package.yml
+++ b/.github/workflows/TvdbClient-Nuget-Package.yml
@@ -2,9 +2,9 @@ name: Publish Public Release on NuGet
on:
push:
- paths: [ 'TvdbClient/**' ]
+ paths: [ 'src/**' ]
pull_request:
- paths: [ 'TvdbClient/**' ]
+ paths: [ 'src/**' ]
workflow_dispatch:
env:
diff --git a/.github/workflows/TvdbClient-Unit-Tests.yml b/.github/workflows/TvdbClient-Unit-Tests.yml
index f8b53fa..590d159 100644
--- a/.github/workflows/TvdbClient-Unit-Tests.yml
+++ b/.github/workflows/TvdbClient-Unit-Tests.yml
@@ -2,9 +2,9 @@ name: Code Coverage
on:
push:
- paths: [ 'TvdbClient/**','TvdbClient.Tests/**' ]
+ paths: [ 'src/**','tests/**' ]
pull_request:
- paths: [ 'TvdbClient/**','TvdbClient.Tests/**' ]
+ paths: [ 'src/**','tests/**' ]
workflow_dispatch:
env:
@@ -35,7 +35,7 @@ jobs:
run: dotnet build --no-restore
- name: Run tests with coverage
- run: dotnet test ${{env.PROJECT_NAME}}/${{env.PROJECT_NAME}}.csproj --no-build --collect:"XPlat Code Coverage" #-p:CollectCoverage=true -p:CoverletOutputFormat=opencover
+ run: dotnet test --configuration Release -- --report-trx --results-directory '**/${{env.PROJECT_NAME}}/TestResults' --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage" --settings "coverlet.runsettings" --no-build
continue-on-error: true
- name: Upload coverage report
diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml
new file mode 100644
index 0000000..d138685
--- /dev/null
+++ b/.github/workflows/code-coverage.yml
@@ -0,0 +1,80 @@
+name: Code Coverage
+
+on:
+ push:
+ branches: [ main, develop ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '8.x' # Adjust to your .NET version
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --no-restore --configuration Release
+
+ - name: Run TUNIT tests with coverage
+ run: |
+ dotnet test ./tests --no-build --configuration Release \
+ --collect:"XPlat Code Coverage" \
+ --results-directory ./test-results \
+ --logger "trx;LogFileName=TestResults.trx" \
+ --logger "console;verbosity=detailed"
+
+ - name: Install ReportGenerator
+ run: dotnet tool install -g dotnet-reportgenerator-globaltool
+
+ - name: Generate coverage report
+ run: |
+ reportgenerator \
+ -reports:"./test-results/**/coverage.cobertura.xml" \
+ -targetdir:"./coverage-report" \
+ -reporttypes:"Html;Cobertura;MarkdownSummaryGithub"
+
+ - name: Upload test results
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: test-results
+ path: |
+ ./test-results/**/*.trx
+ ./coverage-report/**/*
+
+ - name: Publish test results
+ uses: dorny/test-reporter@v1
+ if: always()
+ with:
+ name: Test Results
+ path: './test-results/**/*.trx'
+ reporter: dotnet-trx
+
+ - name: Code Coverage Report
+ uses: irongut/CodeCoverageSummary@v1.3.0
+ with:
+ filename: ./coverage-report/Cobertura.xml
+ badge: true
+ fail_below_min: false # Set to true if you want to fail on low coverage
+ format: markdown
+ hide_branch_rate: false
+ hide_complexity: false
+ indicators: true
+ output: both
+ thresholds: '60 80' # Warning at 60%, error below 80%
+
+ - name: Add Coverage PR Comment
+ uses: marocchino/sticky-pull-request-comment@v2
+ if: github.event_name == 'pull_request'
+ with:
+ recreate: true
+ path: code-coverage-results.md
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..79eb035
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,142 @@
+name: Release
+
+on:
+ push:
+ branches: [ release, release/* ] # Trigger on release branch(es)
+ workflow_dispatch: # Allows manual trigger from any branch
+
+jobs:
+ build-and-test:
+ runs-on: ubuntu-latest
+
+ outputs:
+ version: ${{ steps.nbgv.outputs.SemVer2 }}
+ simple-version: ${{ steps.nbgv.outputs.SimpleVersion }}
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Full history needed for Nerdbank.GitVersioning
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '8.x' # Adjust to your .NET version
+
+ - name: Install Nerdbank.GitVersioning
+ run: dotnet tool install -g nbgv
+
+ - name: Get Version from Nerdbank.GitVersioning
+ id: nbgv
+ run: |
+ nbgv cloud
+ echo "SemVer2=$(nbgv get-version -v SemVer2)" >> $GITHUB_OUTPUT
+ echo "SimpleVersion=$(nbgv get-version -v SimpleVersion)" >> $GITHUB_OUTPUT
+ echo "Version will be: $(nbgv get-version -v SemVer2)"
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --no-restore --configuration Release
+
+ - name: Run TUNIT tests
+ run: dotnet test ./tests --no-build --configuration Release
+
+ - name: Pack NuGet packages
+ run: |
+ dotnet pack ./src --no-build --configuration Release \
+ --output ./packages
+
+ - name: Upload build artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: nuget-packages
+ path: ./packages/*.nupkg
+
+ publish-nuget:
+ needs: build-and-test
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Download artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: nuget-packages
+ path: ./packages
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '8.x'
+
+ - name: Publish to NuGet
+ run: |
+ dotnet nuget push "./packages/*.nupkg" \
+ --api-key ${{ secrets.NUGET_API_KEY }} \
+ --source https://api.nuget.org/v3/index.json \
+ --skip-duplicate
+
+ github-release:
+ needs: [build-and-test, publish-nuget]
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Download artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: nuget-packages
+ path: ./packages
+
+ - name: Create source archive
+ run: |
+ # Create a clean source archive excluding build artifacts
+ git archive --format=zip --output=./packages/source-v${{ needs.build-and-test.outputs.simple-version }}.zip HEAD
+ git archive --format=tar.gz --output=./packages/source-v${{ needs.build-and-test.outputs.simple-version }}.tar.gz HEAD
+
+ - name: Generate Release Notes
+ id: release_notes
+ run: |
+ # Generate basic release notes from commits since last release tag
+ PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match="v*" 2>/dev/null || echo "")
+
+ echo "## What's Changed" > release_notes.md
+ if [ -n "$PREVIOUS_TAG" ]; then
+ echo "" >> release_notes.md
+ git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD >> release_notes.md
+ else
+ echo "- Initial release" >> release_notes.md
+ fi
+
+ echo "" >> release_notes.md
+ echo "## NuGet Package" >> release_notes.md
+ echo "This release is available on NuGet:" >> release_notes.md
+ echo '```' >> release_notes.md
+ echo "dotnet add package YourPackageName --version ${{ needs.build-and-test.outputs.version }}" >> release_notes.md
+ echo '```' >> release_notes.md
+
+ - name: Create Git Tag
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git tag -a "v${{ needs.build-and-test.outputs.simple-version }}" -m "Release v${{ needs.build-and-test.outputs.simple-version }}"
+ git push origin "v${{ needs.build-and-test.outputs.simple-version }}"
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Create GitHub Release
+ uses: softprops/action-gh-release@v1
+ with:
+ tag_name: v${{ needs.build-and-test.outputs.simple-version }}
+ name: Release v${{ needs.build-and-test.outputs.simple-version }}
+ body_path: release_notes.md
+ files: |
+ ./packages/*.nupkg
+ ./packages/*.zip
+ ./packages/*.tar.gz
+ draft: false
+ prerelease: ${{ contains(needs.build-and-test.outputs.version, '-') }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
index 26886e4..fe6a208 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,9 +1,18 @@
-
+
+ net9.0
+ Tvdb
+ enable
+ enable
+
+
all
3.7.115
+
+ $([System.DateTime]::Now.ToString("yyyy"))
+
\ No newline at end of file
diff --git a/TvdbApi.sln b/TvdbApi.sln
index be98e19..07c455c 100644
--- a/TvdbApi.sln
+++ b/TvdbApi.sln
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35617.110
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient", "TvdbClient\TvdbClient.csproj", "{02CB1507-5FF6-9962-1A70-EC35D9E298ED}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient", "src\TvdbClient\TvdbClient.csproj", "{02CB1507-5FF6-9962-1A70-EC35D9E298ED}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Tests", "TvdbClient.Tests\TvdbClient.Tests.csproj", "{E72AACA8-0A10-E62A-E526-41B75B6E6348}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Tests", "tests\TvdbClient.Tests\TvdbClient.Tests.csproj", "{E72AACA8-0A10-E62A-E526-41B75B6E6348}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
ProjectSection(SolutionItems) = preProject
@@ -18,6 +18,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
version.json = version.json
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1570EA31-904E-4036-89EE-890A8358C7AA}"
+ ProjectSection(SolutionItems) = preProject
+ src\Directory.Build.props = src\Directory.Build.props
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7849F1D9-4557-41C5-A747-241B92631187}"
+ ProjectSection(SolutionItems) = preProject
+ tests\Directory.Build.props = tests\Directory.Build.props
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -36,6 +46,10 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {02CB1507-5FF6-9962-1A70-EC35D9E298ED} = {1570EA31-904E-4036-89EE-890A8358C7AA}
+ {E72AACA8-0A10-E62A-E526-41B75B6E6348} = {7849F1D9-4557-41C5-A747-241B92631187}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EBB4E090-0583-48B6-AEC2-1AB4E3B98D2A}
EndGlobalSection
diff --git a/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs b/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs
deleted file mode 100644
index 4530d11..0000000
--- a/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Text;
-using System.Text.Json;
-
-namespace Tvdb.Converters;
-
- public class DateOnlyConverterTests
- {
- [Fact]
- public void Read_ValidDate_ReturnsDateOnly()
- {
- // Arrange
- var json = "\"2023-10-05\"";
- var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
- var converter = new DateOnlyConverter(null);
-
- // Act
- reader.Read();
- var result = converter.Read(ref reader, typeof(DateOnly?), new JsonSerializerOptions());
-
- // Assert
- Assert.NotNull(result);
- Assert.Equal(new DateOnly(2023, 10, 5), result);
- }
-
- [Fact]
- public void Read_NullOrEmpty_ReturnsNull()
- {
- // Arrange
- var json = "\"\"";
- var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
- var converter = new DateOnlyConverter(null);
-
- // Act
- reader.Read();
- var result = converter.Read(ref reader, typeof(DateOnly?), new JsonSerializerOptions());
-
- // Assert
- Assert.Null(result);
- }
-
- [Fact]
- public void Write_ValidDate_WritesCorrectJson()
- {
- // Arrange
- var value = new DateOnly(2023, 10, 5);
- var options = new JsonSerializerOptions { Converters = { new DateOnlyConverter(null) } };
- var expectedJson = "\"2023-10-05\"";
-
- // Act
- var json = JsonSerializer.Serialize(value, options);
-
- // Assert
- Assert.Equal(expectedJson, json);
- }
-
- [Fact]
- public void Write_Null_WritesEmptyString()
- {
- // Arrange
- DateOnly? value = null;
- var options = new JsonSerializerOptions { Converters = { new DateOnlyConverter(null) } };
- var expectedJson = "null";
-
- // Act
- var json = JsonSerializer.Serialize(value, options);
-
- // Assert
- Assert.Equal(expectedJson, json);
- }
- }
\ No newline at end of file
diff --git a/TvdbClient.Tests/Converters/DateTimeConverterTests.cs b/TvdbClient.Tests/Converters/DateTimeConverterTests.cs
deleted file mode 100644
index 8595cb3..0000000
--- a/TvdbClient.Tests/Converters/DateTimeConverterTests.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System;
-using System.Text;
-using System.Text.Json;
-
-namespace Tvdb.Converters;
- public class DateTimeConverterTests
- {
- [Fact]
- public void Read_ValidDate_ReturnsDateTime()
- {
- // Arrange
- var json = "\"2023-10-10 12:34:56\"";
- var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
- var converter = new DateTimeConverter();
-
- // Act
- reader.Read();
- var result = converter.Read(ref reader, typeof(DateTime?), new JsonSerializerOptions());
-
- // Assert
- Assert.Equal(new DateTime(2023, 10, 10, 12, 34, 56), result);
- }
-
- [Fact]
- public void Read_NullOrEmptyString_ReturnsNull()
- {
- // Arrange
- var json = "\"\"";
- var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
- var converter = new DateTimeConverter();
-
- // Act
- reader.Read();
- var result = converter.Read(ref reader, typeof(DateTime?), new JsonSerializerOptions());
-
- // Assert
- Assert.Null(result);
- }
-
- [Fact]
- public void Write_ValidDate_WritesCorrectJson()
- {
- // Arrange
- var options = new JsonSerializerOptions { Converters = { new DateTimeConverter() } };
- var dateTime = new DateTime(2023, 10, 10, 12, 34, 56);
-
- // Act
- var json = JsonSerializer.Serialize(dateTime, options);
-
- // Assert
- Assert.Equal("\"2023-10-10T12:34:56\"", json);
- }
-
- [Fact]
- public void Write_NullValue_WritesEmptyString()
- {
- // Arrange
- var options = new JsonSerializerOptions { Converters = { new DateTimeConverter() } };
- DateTime? dateTime = null;
-
- // Act
- var json = JsonSerializer.Serialize(dateTime, options);
-
- // Assert
- Assert.Equal("null", json);
- }
- }
\ No newline at end of file
diff --git a/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs b/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs
deleted file mode 100644
index 78873d6..0000000
--- a/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Text;
-using System.Text.Json;
-using Xunit;
-
-namespace Tvdb.Converters;
- public class TimeOnlyConverterTests
- {
- [Fact]
- public void Read_ValidTime_ReturnsTimeOnly()
- {
- // Arrange
- var json = "\"14:30:00\"";
- var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
- var converter = new TimeOnlyConverter(null);
-
- // Act
- reader.Read();
- var result = converter.Read(ref reader, typeof(TimeOnly?), new JsonSerializerOptions());
-
- // Assert
- Assert.NotNull(result);
- Assert.Equal(new TimeOnly(14, 30, 0), result);
- }
-
- [Fact]
- public void Read_NullOrEmpty_ReturnsNull()
- {
- // Arrange
- var json = "\"\"";
- var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
- var converter = new TimeOnlyConverter(null);
-
- // Act
- reader.Read();
- var result = converter.Read(ref reader, typeof(TimeOnly?), new JsonSerializerOptions());
-
- // Assert
- Assert.Null(result);
- }
-
- [Fact]
- public void Write_ValidTime_WritesCorrectJson()
- {
- // Arrange
- var value = new TimeOnly(14, 30, 0);
- var options = new JsonSerializerOptions { Converters = { new TimeOnlyConverter(null) } };
- var expectedJson = "\"14:30:00\"";
-
- // Act
- var json = JsonSerializer.Serialize(value, options);
-
- // Assert
- Assert.Equal(expectedJson, json);
- }
-
- [Fact]
- public void Write_Null_WritesEmptyString()
- {
- // Arrange
- TimeOnly? value = null;
- var options = new JsonSerializerOptions { Converters = { new TimeOnlyConverter(null) } };
- var expectedJson = "null";
-
- // Act
- var json = JsonSerializer.Serialize(value, options);
-
- // Assert
- Assert.Equal(expectedJson, json);
- }
- }
\ No newline at end of file
diff --git a/TvdbClient.Tests/TvdbClient.Tests.csproj b/TvdbClient.Tests/TvdbClient.Tests.csproj
deleted file mode 100644
index 6ab9e11..0000000
--- a/TvdbClient.Tests/TvdbClient.Tests.csproj
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- net9.0
- enable
- enable
- false
- Tvdb
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 0000000..721f1dc
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,17 @@
+
+
+
+ Chrison Simtian
+ $(CurrentYear) - $(Authors)
+ https://github.com/ChrisonSimtian/TvdbApi
+ https://github.com/ChrisonSimtian/TvdbApi.git
+ git
+ LICENSE
+ True
+ README.md
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TvdbClient/Clients/ILoginClient.cs b/src/TvdbClient/Clients/ILoginClient.cs
similarity index 100%
rename from TvdbClient/Clients/ILoginClient.cs
rename to src/TvdbClient/Clients/ILoginClient.cs
diff --git a/TvdbClient/Clients/ITvdbClient.cs b/src/TvdbClient/Clients/ITvdbClient.cs
similarity index 100%
rename from TvdbClient/Clients/ITvdbClient.cs
rename to src/TvdbClient/Clients/ITvdbClient.cs
diff --git a/TvdbClient/Clients/Interfaces.cs b/src/TvdbClient/Clients/Interfaces.cs
similarity index 100%
rename from TvdbClient/Clients/Interfaces.cs
rename to src/TvdbClient/Clients/Interfaces.cs
diff --git a/TvdbClient/Clients/TvdbClient.cs b/src/TvdbClient/Clients/TvdbClient.cs
similarity index 100%
rename from TvdbClient/Clients/TvdbClient.cs
rename to src/TvdbClient/Clients/TvdbClient.cs
diff --git a/TvdbClient/Configuration/TvdbConfiguration.cs b/src/TvdbClient/Configuration/TvdbConfiguration.cs
similarity index 100%
rename from TvdbClient/Configuration/TvdbConfiguration.cs
rename to src/TvdbClient/Configuration/TvdbConfiguration.cs
diff --git a/TvdbClient/Constants/TvdbConstants.cs b/src/TvdbClient/Constants/TvdbConstants.cs
similarity index 100%
rename from TvdbClient/Constants/TvdbConstants.cs
rename to src/TvdbClient/Constants/TvdbConstants.cs
diff --git a/TvdbClient/Converters/DateOnlyConverter.cs b/src/TvdbClient/Converters/DateOnlyConverter.cs
similarity index 100%
rename from TvdbClient/Converters/DateOnlyConverter.cs
rename to src/TvdbClient/Converters/DateOnlyConverter.cs
diff --git a/TvdbClient/Converters/DateTimeConverter.cs b/src/TvdbClient/Converters/DateTimeConverter.cs
similarity index 100%
rename from TvdbClient/Converters/DateTimeConverter.cs
rename to src/TvdbClient/Converters/DateTimeConverter.cs
diff --git a/TvdbClient/Converters/TimeOnlyConverter.cs b/src/TvdbClient/Converters/TimeOnlyConverter.cs
similarity index 100%
rename from TvdbClient/Converters/TimeOnlyConverter.cs
rename to src/TvdbClient/Converters/TimeOnlyConverter.cs
diff --git a/TvdbClient/Extensions/Bootstrapper.cs b/src/TvdbClient/Extensions/Bootstrapper.cs
similarity index 100%
rename from TvdbClient/Extensions/Bootstrapper.cs
rename to src/TvdbClient/Extensions/Bootstrapper.cs
diff --git a/TvdbClient/Extensions/DateTimeExtensions.cs b/src/TvdbClient/Extensions/DateTimeExtensions.cs
similarity index 100%
rename from TvdbClient/Extensions/DateTimeExtensions.cs
rename to src/TvdbClient/Extensions/DateTimeExtensions.cs
diff --git a/TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs b/src/TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs
similarity index 100%
rename from TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs
rename to src/TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs
diff --git a/TvdbClient/Models/AbstractBaseRecord.cs b/src/TvdbClient/Models/AbstractBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/AbstractBaseRecord.cs
rename to src/TvdbClient/Models/AbstractBaseRecord.cs
diff --git a/TvdbClient/Models/Alias.cs b/src/TvdbClient/Models/Alias.cs
similarity index 100%
rename from TvdbClient/Models/Alias.cs
rename to src/TvdbClient/Models/Alias.cs
diff --git a/TvdbClient/Models/ApiException.cs b/src/TvdbClient/Models/ApiException.cs
similarity index 100%
rename from TvdbClient/Models/ApiException.cs
rename to src/TvdbClient/Models/ApiException.cs
diff --git a/TvdbClient/Models/ApiResponseWrapper.cs b/src/TvdbClient/Models/ApiResponseWrapper.cs
similarity index 100%
rename from TvdbClient/Models/ApiResponseWrapper.cs
rename to src/TvdbClient/Models/ApiResponseWrapper.cs
diff --git a/TvdbClient/Models/ArtworkBaseRecord.cs b/src/TvdbClient/Models/ArtworkBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/ArtworkBaseRecord.cs
rename to src/TvdbClient/Models/ArtworkBaseRecord.cs
diff --git a/TvdbClient/Models/ArtworkExtendedRecord.cs b/src/TvdbClient/Models/ArtworkExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/ArtworkExtendedRecord.cs
rename to src/TvdbClient/Models/ArtworkExtendedRecord.cs
diff --git a/TvdbClient/Models/ArtworkStatus.cs b/src/TvdbClient/Models/ArtworkStatus.cs
similarity index 100%
rename from TvdbClient/Models/ArtworkStatus.cs
rename to src/TvdbClient/Models/ArtworkStatus.cs
diff --git a/TvdbClient/Models/ArtworkType.cs b/src/TvdbClient/Models/ArtworkType.cs
similarity index 100%
rename from TvdbClient/Models/ArtworkType.cs
rename to src/TvdbClient/Models/ArtworkType.cs
diff --git a/TvdbClient/Models/AwardBaseRecord.cs b/src/TvdbClient/Models/AwardBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/AwardBaseRecord.cs
rename to src/TvdbClient/Models/AwardBaseRecord.cs
diff --git a/TvdbClient/Models/AwardCategoryBaseRecord.cs b/src/TvdbClient/Models/AwardCategoryBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/AwardCategoryBaseRecord.cs
rename to src/TvdbClient/Models/AwardCategoryBaseRecord.cs
diff --git a/TvdbClient/Models/AwardCategoryExtendedRecord.cs b/src/TvdbClient/Models/AwardCategoryExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/AwardCategoryExtendedRecord.cs
rename to src/TvdbClient/Models/AwardCategoryExtendedRecord.cs
diff --git a/TvdbClient/Models/AwardExtendedRecord.cs b/src/TvdbClient/Models/AwardExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/AwardExtendedRecord.cs
rename to src/TvdbClient/Models/AwardExtendedRecord.cs
diff --git a/TvdbClient/Models/AwardNomineeBaseRecord.cs b/src/TvdbClient/Models/AwardNomineeBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/AwardNomineeBaseRecord.cs
rename to src/TvdbClient/Models/AwardNomineeBaseRecord.cs
diff --git a/TvdbClient/Models/Biography.cs b/src/TvdbClient/Models/Biography.cs
similarity index 100%
rename from TvdbClient/Models/Biography.cs
rename to src/TvdbClient/Models/Biography.cs
diff --git a/TvdbClient/Models/Character.cs b/src/TvdbClient/Models/Character.cs
similarity index 100%
rename from TvdbClient/Models/Character.cs
rename to src/TvdbClient/Models/Character.cs
diff --git a/TvdbClient/Models/Companies.cs b/src/TvdbClient/Models/Companies.cs
similarity index 100%
rename from TvdbClient/Models/Companies.cs
rename to src/TvdbClient/Models/Companies.cs
diff --git a/TvdbClient/Models/Company.cs b/src/TvdbClient/Models/Company.cs
similarity index 100%
rename from TvdbClient/Models/Company.cs
rename to src/TvdbClient/Models/Company.cs
diff --git a/TvdbClient/Models/CompanyRelationShip.cs b/src/TvdbClient/Models/CompanyRelationShip.cs
similarity index 100%
rename from TvdbClient/Models/CompanyRelationShip.cs
rename to src/TvdbClient/Models/CompanyRelationShip.cs
diff --git a/TvdbClient/Models/CompanyType.cs b/src/TvdbClient/Models/CompanyType.cs
similarity index 100%
rename from TvdbClient/Models/CompanyType.cs
rename to src/TvdbClient/Models/CompanyType.cs
diff --git a/TvdbClient/Models/ContentRating.cs b/src/TvdbClient/Models/ContentRating.cs
similarity index 100%
rename from TvdbClient/Models/ContentRating.cs
rename to src/TvdbClient/Models/ContentRating.cs
diff --git a/TvdbClient/Models/Country.cs b/src/TvdbClient/Models/Country.cs
similarity index 100%
rename from TvdbClient/Models/Country.cs
rename to src/TvdbClient/Models/Country.cs
diff --git a/TvdbClient/Models/Entity.cs b/src/TvdbClient/Models/Entity.cs
similarity index 100%
rename from TvdbClient/Models/Entity.cs
rename to src/TvdbClient/Models/Entity.cs
diff --git a/TvdbClient/Models/EntityType.cs b/src/TvdbClient/Models/EntityType.cs
similarity index 100%
rename from TvdbClient/Models/EntityType.cs
rename to src/TvdbClient/Models/EntityType.cs
diff --git a/TvdbClient/Models/EntityUpdate.cs b/src/TvdbClient/Models/EntityUpdate.cs
similarity index 100%
rename from TvdbClient/Models/EntityUpdate.cs
rename to src/TvdbClient/Models/EntityUpdate.cs
diff --git a/TvdbClient/Models/EpisodeBaseRecord.cs b/src/TvdbClient/Models/EpisodeBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/EpisodeBaseRecord.cs
rename to src/TvdbClient/Models/EpisodeBaseRecord.cs
diff --git a/TvdbClient/Models/EpisodeExtendedRecord.cs b/src/TvdbClient/Models/EpisodeExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/EpisodeExtendedRecord.cs
rename to src/TvdbClient/Models/EpisodeExtendedRecord.cs
diff --git a/TvdbClient/Models/FavoriteRecord.cs b/src/TvdbClient/Models/FavoriteRecord.cs
similarity index 100%
rename from TvdbClient/Models/FavoriteRecord.cs
rename to src/TvdbClient/Models/FavoriteRecord.cs
diff --git a/TvdbClient/Models/Favorites.cs b/src/TvdbClient/Models/Favorites.cs
similarity index 100%
rename from TvdbClient/Models/Favorites.cs
rename to src/TvdbClient/Models/Favorites.cs
diff --git a/TvdbClient/Models/Gender.cs b/src/TvdbClient/Models/Gender.cs
similarity index 100%
rename from TvdbClient/Models/Gender.cs
rename to src/TvdbClient/Models/Gender.cs
diff --git a/TvdbClient/Models/GenreBaseRecord.cs b/src/TvdbClient/Models/GenreBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/GenreBaseRecord.cs
rename to src/TvdbClient/Models/GenreBaseRecord.cs
diff --git a/TvdbClient/Models/Inspiration.cs b/src/TvdbClient/Models/Inspiration.cs
similarity index 100%
rename from TvdbClient/Models/Inspiration.cs
rename to src/TvdbClient/Models/Inspiration.cs
diff --git a/TvdbClient/Models/InspirationType.cs b/src/TvdbClient/Models/InspirationType.cs
similarity index 100%
rename from TvdbClient/Models/InspirationType.cs
rename to src/TvdbClient/Models/InspirationType.cs
diff --git a/TvdbClient/Models/Language.cs b/src/TvdbClient/Models/Language.cs
similarity index 100%
rename from TvdbClient/Models/Language.cs
rename to src/TvdbClient/Models/Language.cs
diff --git a/TvdbClient/Models/Links.cs b/src/TvdbClient/Models/Links.cs
similarity index 100%
rename from TvdbClient/Models/Links.cs
rename to src/TvdbClient/Models/Links.cs
diff --git a/TvdbClient/Models/ListBaseRecord.cs b/src/TvdbClient/Models/ListBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/ListBaseRecord.cs
rename to src/TvdbClient/Models/ListBaseRecord.cs
diff --git a/TvdbClient/Models/ListExtendedRecord.cs b/src/TvdbClient/Models/ListExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/ListExtendedRecord.cs
rename to src/TvdbClient/Models/ListExtendedRecord.cs
diff --git a/TvdbClient/Models/LoginRequestBody.cs b/src/TvdbClient/Models/LoginRequestBody.cs
similarity index 100%
rename from TvdbClient/Models/LoginRequestBody.cs
rename to src/TvdbClient/Models/LoginRequestBody.cs
diff --git a/TvdbClient/Models/MovieBaseRecord.cs b/src/TvdbClient/Models/MovieBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/MovieBaseRecord.cs
rename to src/TvdbClient/Models/MovieBaseRecord.cs
diff --git a/TvdbClient/Models/MovieExtendedRecord.cs b/src/TvdbClient/Models/MovieExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/MovieExtendedRecord.cs
rename to src/TvdbClient/Models/MovieExtendedRecord.cs
diff --git a/TvdbClient/Models/ParentCompany.cs b/src/TvdbClient/Models/ParentCompany.cs
similarity index 100%
rename from TvdbClient/Models/ParentCompany.cs
rename to src/TvdbClient/Models/ParentCompany.cs
diff --git a/TvdbClient/Models/PeopleBaseRecord.cs b/src/TvdbClient/Models/PeopleBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/PeopleBaseRecord.cs
rename to src/TvdbClient/Models/PeopleBaseRecord.cs
diff --git a/TvdbClient/Models/PeopleExtendedRecord.cs b/src/TvdbClient/Models/PeopleExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/PeopleExtendedRecord.cs
rename to src/TvdbClient/Models/PeopleExtendedRecord.cs
diff --git a/TvdbClient/Models/PeopleType.cs b/src/TvdbClient/Models/PeopleType.cs
similarity index 100%
rename from TvdbClient/Models/PeopleType.cs
rename to src/TvdbClient/Models/PeopleType.cs
diff --git a/TvdbClient/Models/ProductionCountry.cs b/src/TvdbClient/Models/ProductionCountry.cs
similarity index 100%
rename from TvdbClient/Models/ProductionCountry.cs
rename to src/TvdbClient/Models/ProductionCountry.cs
diff --git a/TvdbClient/Models/Race.cs b/src/TvdbClient/Models/Race.cs
similarity index 100%
rename from TvdbClient/Models/Race.cs
rename to src/TvdbClient/Models/Race.cs
diff --git a/TvdbClient/Models/RecordInfo.cs b/src/TvdbClient/Models/RecordInfo.cs
similarity index 100%
rename from TvdbClient/Models/RecordInfo.cs
rename to src/TvdbClient/Models/RecordInfo.cs
diff --git a/TvdbClient/Models/Release.cs b/src/TvdbClient/Models/Release.cs
similarity index 100%
rename from TvdbClient/Models/Release.cs
rename to src/TvdbClient/Models/Release.cs
diff --git a/TvdbClient/Models/RemoteID.cs b/src/TvdbClient/Models/RemoteID.cs
similarity index 100%
rename from TvdbClient/Models/RemoteID.cs
rename to src/TvdbClient/Models/RemoteID.cs
diff --git a/TvdbClient/Models/ResponseClasses.cs b/src/TvdbClient/Models/ResponseClasses.cs
similarity index 100%
rename from TvdbClient/Models/ResponseClasses.cs
rename to src/TvdbClient/Models/ResponseClasses.cs
diff --git a/TvdbClient/Models/SearchByRemoteIdResult.cs b/src/TvdbClient/Models/SearchByRemoteIdResult.cs
similarity index 100%
rename from TvdbClient/Models/SearchByRemoteIdResult.cs
rename to src/TvdbClient/Models/SearchByRemoteIdResult.cs
diff --git a/TvdbClient/Models/SearchResult.cs b/src/TvdbClient/Models/SearchResult.cs
similarity index 100%
rename from TvdbClient/Models/SearchResult.cs
rename to src/TvdbClient/Models/SearchResult.cs
diff --git a/TvdbClient/Models/SeasonBaseRecord.cs b/src/TvdbClient/Models/SeasonBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/SeasonBaseRecord.cs
rename to src/TvdbClient/Models/SeasonBaseRecord.cs
diff --git a/TvdbClient/Models/SeasonExtendedRecord.cs b/src/TvdbClient/Models/SeasonExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/SeasonExtendedRecord.cs
rename to src/TvdbClient/Models/SeasonExtendedRecord.cs
diff --git a/TvdbClient/Models/SeasonType.cs b/src/TvdbClient/Models/SeasonType.cs
similarity index 100%
rename from TvdbClient/Models/SeasonType.cs
rename to src/TvdbClient/Models/SeasonType.cs
diff --git a/TvdbClient/Models/SeriesAirsDays.cs b/src/TvdbClient/Models/SeriesAirsDays.cs
similarity index 100%
rename from TvdbClient/Models/SeriesAirsDays.cs
rename to src/TvdbClient/Models/SeriesAirsDays.cs
diff --git a/TvdbClient/Models/SeriesBaseRecord.cs b/src/TvdbClient/Models/SeriesBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/SeriesBaseRecord.cs
rename to src/TvdbClient/Models/SeriesBaseRecord.cs
diff --git a/TvdbClient/Models/SeriesExtendedRecord.cs b/src/TvdbClient/Models/SeriesExtendedRecord.cs
similarity index 100%
rename from TvdbClient/Models/SeriesExtendedRecord.cs
rename to src/TvdbClient/Models/SeriesExtendedRecord.cs
diff --git a/TvdbClient/Models/SourceType.cs b/src/TvdbClient/Models/SourceType.cs
similarity index 100%
rename from TvdbClient/Models/SourceType.cs
rename to src/TvdbClient/Models/SourceType.cs
diff --git a/TvdbClient/Models/Status.cs b/src/TvdbClient/Models/Status.cs
similarity index 100%
rename from TvdbClient/Models/Status.cs
rename to src/TvdbClient/Models/Status.cs
diff --git a/TvdbClient/Models/StudioBaseRecord.cs b/src/TvdbClient/Models/StudioBaseRecord.cs
similarity index 100%
rename from TvdbClient/Models/StudioBaseRecord.cs
rename to src/TvdbClient/Models/StudioBaseRecord.cs
diff --git a/TvdbClient/Models/Tag.cs b/src/TvdbClient/Models/Tag.cs
similarity index 100%
rename from TvdbClient/Models/Tag.cs
rename to src/TvdbClient/Models/Tag.cs
diff --git a/TvdbClient/Models/TagOption.cs b/src/TvdbClient/Models/TagOption.cs
similarity index 100%
rename from TvdbClient/Models/TagOption.cs
rename to src/TvdbClient/Models/TagOption.cs
diff --git a/TvdbClient/Models/TagOptionEntity.cs b/src/TvdbClient/Models/TagOptionEntity.cs
similarity index 100%
rename from TvdbClient/Models/TagOptionEntity.cs
rename to src/TvdbClient/Models/TagOptionEntity.cs
diff --git a/TvdbClient/Models/Token.cs b/src/TvdbClient/Models/Token.cs
similarity index 100%
rename from TvdbClient/Models/Token.cs
rename to src/TvdbClient/Models/Token.cs
diff --git a/TvdbClient/Models/Trailer.cs b/src/TvdbClient/Models/Trailer.cs
similarity index 100%
rename from TvdbClient/Models/Trailer.cs
rename to src/TvdbClient/Models/Trailer.cs
diff --git a/TvdbClient/Models/Translation.cs b/src/TvdbClient/Models/Translation.cs
similarity index 100%
rename from TvdbClient/Models/Translation.cs
rename to src/TvdbClient/Models/Translation.cs
diff --git a/TvdbClient/Models/TranslationExtended.cs b/src/TvdbClient/Models/TranslationExtended.cs
similarity index 100%
rename from TvdbClient/Models/TranslationExtended.cs
rename to src/TvdbClient/Models/TranslationExtended.cs
diff --git a/TvdbClient/Models/TranslationSimple.cs b/src/TvdbClient/Models/TranslationSimple.cs
similarity index 100%
rename from TvdbClient/Models/TranslationSimple.cs
rename to src/TvdbClient/Models/TranslationSimple.cs
diff --git a/TvdbClient/Models/TvdbModels.cs b/src/TvdbClient/Models/TvdbModels.cs
similarity index 100%
rename from TvdbClient/Models/TvdbModels.cs
rename to src/TvdbClient/Models/TvdbModels.cs
diff --git a/TvdbClient/Models/UserInfo.cs b/src/TvdbClient/Models/UserInfo.cs
similarity index 100%
rename from TvdbClient/Models/UserInfo.cs
rename to src/TvdbClient/Models/UserInfo.cs
diff --git a/TvdbClient/Provider/ITokenProvider.cs b/src/TvdbClient/Provider/ITokenProvider.cs
similarity index 100%
rename from TvdbClient/Provider/ITokenProvider.cs
rename to src/TvdbClient/Provider/ITokenProvider.cs
diff --git a/TvdbClient/Provider/TvdbTokenProvider.cs b/src/TvdbClient/Provider/TvdbTokenProvider.cs
similarity index 100%
rename from TvdbClient/Provider/TvdbTokenProvider.cs
rename to src/TvdbClient/Provider/TvdbTokenProvider.cs
diff --git a/TvdbClient/TvdbClient.csproj b/src/TvdbClient/TvdbClient.csproj
similarity index 59%
rename from TvdbClient/TvdbClient.csproj
rename to src/TvdbClient/TvdbClient.csproj
index e269359..d99364d 100644
--- a/TvdbClient/TvdbClient.csproj
+++ b/src/TvdbClient/TvdbClient.csproj
@@ -1,12 +1,4 @@
-
-
- net9.0
- enable
- enable
- Tvdb
-
-
@@ -18,29 +10,13 @@
-
True
TVDB Api Client
- Chrison Simtian
- $([System.DateTime]::Now.ToString(yyyy)) - $(Authors)
C# Api Client (HttpClient) for TVDB Api
- https://github.com/ChrisonSimtian/TvdbApi
- https://github.com/ChrisonSimtian/TvdbApi.git
- git
- LICENSE
- True
False
- README.md
-
CS1591;CS8618
-
-
-
-
-
-
diff --git a/TvdbClient/TvdbClient.nswag b/src/TvdbClient/TvdbClient.nswag
similarity index 100%
rename from TvdbClient/TvdbClient.nswag
rename to src/TvdbClient/TvdbClient.nswag
diff --git a/TvdbClient/TvdbClient.yml b/src/TvdbClient/TvdbClient.yml
similarity index 100%
rename from TvdbClient/TvdbClient.yml
rename to src/TvdbClient/TvdbClient.yml
diff --git a/TvdbClient/Types/EpisodesMeta.cs b/src/TvdbClient/Types/EpisodesMeta.cs
similarity index 100%
rename from TvdbClient/Types/EpisodesMeta.cs
rename to src/TvdbClient/Types/EpisodesMeta.cs
diff --git a/TvdbClient/Types/MovieSort.cs b/src/TvdbClient/Types/MovieSort.cs
similarity index 100%
rename from TvdbClient/Types/MovieSort.cs
rename to src/TvdbClient/Types/MovieSort.cs
diff --git a/TvdbClient/Types/MoviesMeta.cs b/src/TvdbClient/Types/MoviesMeta.cs
similarity index 100%
rename from TvdbClient/Types/MoviesMeta.cs
rename to src/TvdbClient/Types/MoviesMeta.cs
diff --git a/TvdbClient/Types/PeopleMeta.cs b/src/TvdbClient/Types/PeopleMeta.cs
similarity index 100%
rename from TvdbClient/Types/PeopleMeta.cs
rename to src/TvdbClient/Types/PeopleMeta.cs
diff --git a/TvdbClient/Types/SeriesMeta.cs b/src/TvdbClient/Types/SeriesMeta.cs
similarity index 100%
rename from TvdbClient/Types/SeriesMeta.cs
rename to src/TvdbClient/Types/SeriesMeta.cs
diff --git a/TvdbClient/Types/SeriesSort.cs b/src/TvdbClient/Types/SeriesSort.cs
similarity index 100%
rename from TvdbClient/Types/SeriesSort.cs
rename to src/TvdbClient/Types/SeriesSort.cs
diff --git a/TvdbClient/Types/SortType.cs b/src/TvdbClient/Types/SortType.cs
similarity index 100%
rename from TvdbClient/Types/SortType.cs
rename to src/TvdbClient/Types/SortType.cs
diff --git a/TvdbClient/Types/UpdateAction.cs b/src/TvdbClient/Types/UpdateAction.cs
similarity index 100%
rename from TvdbClient/Types/UpdateAction.cs
rename to src/TvdbClient/Types/UpdateAction.cs
diff --git a/TvdbClient/Types/UpdateEntity.cs b/src/TvdbClient/Types/UpdateEntity.cs
similarity index 100%
rename from TvdbClient/Types/UpdateEntity.cs
rename to src/TvdbClient/Types/UpdateEntity.cs
diff --git a/TvdbClient/version.json b/src/TvdbClient/version.json
similarity index 88%
rename from TvdbClient/version.json
rename to src/TvdbClient/version.json
index 77b4226..7d9a7c7 100644
--- a/TvdbClient/version.json
+++ b/src/TvdbClient/version.json
@@ -4,7 +4,7 @@
"pathFilters": ["."],
"publicReleaseRefSpec": [
"^refs/heads/main$",
- "^refs/heads/v\\d+(?:\\.\\d+)?$"
+ "^refs/heads/release(/.*)?$"
],
"cloudBuild": {
"buildNumber": {
diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props
new file mode 100644
index 0000000..d5634e1
--- /dev/null
+++ b/tests/Directory.Build.props
@@ -0,0 +1,18 @@
+
+
+
+ true
+ true
+ Exe
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TvdbClient.Tests/AuthenticationUnitTests.cs b/tests/TvdbClient.Tests/AuthenticationUnitTests.cs
similarity index 85%
rename from TvdbClient.Tests/AuthenticationUnitTests.cs
rename to tests/TvdbClient.Tests/AuthenticationUnitTests.cs
index f455d47..7bb5c64 100644
--- a/TvdbClient.Tests/AuthenticationUnitTests.cs
+++ b/tests/TvdbClient.Tests/AuthenticationUnitTests.cs
@@ -1,33 +1,27 @@
using System.Text.Json;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
using Tvdb.Clients;
using Tvdb.Models;
-using Xunit.Abstractions;
namespace Tvdb;
public class AuthenticationUnitTests
{
- public AuthenticationUnitTests(ITestOutputHelper outputHelper)
+ public AuthenticationUnitTests()
{
- OutputHelper = outputHelper;
-
var builder = new HostApplicationBuilder();
var config = builder.Configuration
.AddTvdbClient()
.Build();
ServiceProvider = builder.Services
- .AddLogging((builder) => builder.AddXUnit(OutputHelper))
.AddTvdbClient(config)
.BuildServiceProvider();
}
- public ITestOutputHelper OutputHelper { get; }
public ServiceProvider ServiceProvider { get; internal set; }
- [Fact]
+ [Test]
public async Task ManuallyAuthenticate_Fact()
{
// Arrange
@@ -63,7 +57,7 @@ public async Task ManuallyAuthenticate_Fact()
token.AccessToken.ShouldNotBeNullOrEmpty();
}
- [Fact]
+ [Test]
public async Task TestRandomApi_Fact()
{
// Arrange
diff --git a/TvdbClient.Tests/Clients/SeriesClient.cs b/tests/TvdbClient.Tests/Clients/SeriesClient.cs
similarity index 75%
rename from TvdbClient.Tests/Clients/SeriesClient.cs
rename to tests/TvdbClient.Tests/Clients/SeriesClient.cs
index 400294b..e16e48a 100644
--- a/TvdbClient.Tests/Clients/SeriesClient.cs
+++ b/tests/TvdbClient.Tests/Clients/SeriesClient.cs
@@ -5,16 +5,13 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
-using Xunit.Abstractions;
namespace Tvdb.Clients;
public class SeriesClient
{
- public SeriesClient(ITestOutputHelper outputHelper)
+ public SeriesClient()
{
- OutputHelper = outputHelper;
var builder = new HostApplicationBuilder();
var config = builder.Configuration
@@ -22,22 +19,20 @@ public SeriesClient(ITestOutputHelper outputHelper)
.Build();
ServiceProvider = builder.Services
- .AddLogging((builder) => builder.AddXUnit(OutputHelper))
.AddTvdbClient(config)
.BuildServiceProvider();
Client = ServiceProvider.GetRequiredService();
}
- public ITestOutputHelper OutputHelper { get; }
public ServiceProvider ServiceProvider { get; }
public ISeriesClient Client { get; }
- [Fact]
+ [Test]
public void DependencyInjection_Fact() => Client.ShouldNotBeNull();
- [Theory]
- [InlineData(234791)] // Heute Show
+ [Test]
+ [Arguments(234791)] // Heute Show
public async Task GetSeriesById_Theory(int tvdbId)
{
// Arrange
@@ -53,8 +48,8 @@ public async Task GetSeriesById_Theory(int tvdbId)
data.ShouldNotBeNull();
}
- [Theory]
- [InlineData(234791)] // Heute Show
+ [Test]
+ [Arguments(234791)] // Heute Show
public async Task GetSeriesExtendedById_Theory(int tvdbId)
{
// Arrange
diff --git a/tests/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs b/tests/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs
new file mode 100644
index 0000000..982cb22
--- /dev/null
+++ b/tests/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Text;
+using System.Text.Json;
+
+namespace Tvdb.Converters;
+
+public class DateOnlyConverterTests
+{
+ [Test]
+ public void Read_ValidDate_ReturnsDateOnly()
+ {
+ // Arrange
+ var json = "\"2023-10-05\"";
+ var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
+ var converter = new DateOnlyConverter(null);
+
+ // Act
+ reader.Read();
+ var result = converter.Read(ref reader, typeof(DateOnly?), new JsonSerializerOptions());
+
+ // Assert
+ result.ShouldNotBeNull();
+ result.ShouldBeOfType();
+ // Validate the date
+ result.ShouldBe(new DateOnly(2023, 10, 5));
+ }
+
+ [Test]
+ public void Read_NullOrEmpty_ReturnsNull()
+ {
+ // Arrange
+ var json = "\"\"";
+ var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
+ var converter = new DateOnlyConverter(null);
+
+ // Act
+ reader.Read();
+ var result = converter.Read(ref reader, typeof(DateOnly?), new JsonSerializerOptions());
+
+ // Assert
+ result.ShouldBeNull();
+ }
+
+ [Test]
+ public void Write_ValidDate_WritesCorrectJson()
+ {
+ // Arrange
+ var value = new DateOnly(2023, 10, 5);
+ var options = new JsonSerializerOptions { Converters = { new DateOnlyConverter(null) } };
+ var expectedJson = "\"2023-10-05\"";
+
+ // Act
+ var json = JsonSerializer.Serialize(value, options);
+
+ // Assert
+ json.ShouldBeEquivalentTo(expectedJson);
+ }
+
+ [Test]
+ public void Write_Null_WritesEmptyString()
+ {
+ // Arrange
+ DateOnly? value = null;
+ var options = new JsonSerializerOptions { Converters = { new DateOnlyConverter(null) } };
+ var expectedJson = "null";
+
+ // Act
+ var json = JsonSerializer.Serialize(value, options);
+
+ // Assert
+ json.ShouldBeEquivalentTo(expectedJson);
+ }
+}
\ No newline at end of file
diff --git a/tests/TvdbClient.Tests/Converters/DateTimeConverterTests.cs b/tests/TvdbClient.Tests/Converters/DateTimeConverterTests.cs
new file mode 100644
index 0000000..efeac56
--- /dev/null
+++ b/tests/TvdbClient.Tests/Converters/DateTimeConverterTests.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Text;
+using System.Text.Json;
+
+namespace Tvdb.Converters;
+
+public class DateTimeConverterTests
+{
+ [Test]
+ [Arguments(2023, 10, 10, 12, 34, 56)]
+ public void Read_ValidDate_ReturnsDateTime(int year, int month, int day, int hour, int minute, int second)
+ {
+ // Arrange
+ var json = $"\"{year:0000}-{month:00}-{day:00} {hour:00}:{minute:00}:{second:00}\"";
+ var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
+ var converter = new DateTimeConverter();
+
+ // Act
+ reader.Read();
+ var result = converter.Read(ref reader, typeof(DateTime?), new JsonSerializerOptions());
+
+ // Assert
+ DateTime expectedDate = new(year, month, day, hour, minute, second);
+ result.ShouldBe(expectedDate);
+ }
+
+ [Test]
+ public void Read_NullOrEmptyString_ReturnsNull()
+ {
+ // Arrange
+ var json = "\"\"";
+ var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
+ var converter = new DateTimeConverter();
+
+ // Act
+ reader.Read();
+ var result = converter.Read(ref reader, typeof(DateTime?), new JsonSerializerOptions());
+
+ // Assert
+ result.ShouldBeNull();
+ }
+
+ [Test]
+ public void Write_ValidDate_WritesCorrectJson()
+ {
+ // Arrange
+ var options = new JsonSerializerOptions { Converters = { new DateTimeConverter() } };
+ var dateTime = new DateTime(2023, 10, 10, 12, 34, 56);
+
+ // Act
+ var json = JsonSerializer.Serialize(dateTime, options);
+
+ // Assert
+ json.ShouldBe("\"2023-10-10T12:34:56\"");
+ }
+
+ [Test]
+ public void Write_NullValue_WritesEmptyString()
+ {
+ // Arrange
+ var options = new JsonSerializerOptions { Converters = { new DateTimeConverter() } };
+ DateTime? dateTime = null;
+
+ // Act
+ var json = JsonSerializer.Serialize(dateTime, options);
+
+ // Assert
+ json.ShouldBe("null");
+ }
+}
\ No newline at end of file
diff --git a/tests/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs b/tests/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs
new file mode 100644
index 0000000..20c0c6e
--- /dev/null
+++ b/tests/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Text;
+using System.Text.Json;
+
+namespace Tvdb.Converters;
+
+public class TimeOnlyConverterTests
+{
+ [Test]
+ [Arguments(14, 30, 0)]
+ public void Read_ValidTime_ReturnsTimeOnly(int hour, int minute, int second)
+ {
+ // Arrange
+ var json = $"\"{hour:00}:{minute:00}:{second:00}\"";
+ var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
+ var converter = new TimeOnlyConverter(null);
+
+ // Act
+ reader.Read();
+ var result = converter.Read(ref reader, typeof(TimeOnly?), new JsonSerializerOptions());
+
+ // Assert
+ result.ShouldNotBeNull();
+ result.ShouldBeOfType();
+ result.ShouldBe(new TimeOnly(hour, minute, second));
+ }
+
+ [Test]
+ public void Read_NullOrEmpty_ReturnsNull()
+ {
+ // Arrange
+ var json = "\"\"";
+ var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
+ var converter = new TimeOnlyConverter(null);
+
+ // Act
+ reader.Read();
+ var result = converter.Read(ref reader, typeof(TimeOnly?), new JsonSerializerOptions());
+
+ // Assert
+ result.ShouldBeNull();
+ }
+
+ [Test]
+ public void Write_ValidTime_WritesCorrectJson()
+ {
+ // Arrange
+ var value = new TimeOnly(14, 30, 0);
+ var options = new JsonSerializerOptions { Converters = { new TimeOnlyConverter(null) } };
+ var expectedJson = "\"14:30:00\"";
+
+ // Act
+ var json = JsonSerializer.Serialize(value, options);
+
+ // Assert
+ json.ShouldBeEquivalentTo(expectedJson);
+ }
+
+ [Test]
+ public void Write_Null_WritesEmptyString()
+ {
+ // Arrange
+ TimeOnly? value = null;
+ var options = new JsonSerializerOptions { Converters = { new TimeOnlyConverter(null) } };
+ var expectedJson = "null";
+
+ // Act
+ var json = JsonSerializer.Serialize(value, options);
+
+ // Assert
+ json.ShouldBeEquivalentTo(expectedJson);
+ }
+}
\ No newline at end of file
diff --git a/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs b/tests/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs
similarity index 81%
rename from TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs
rename to tests/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs
index 5e57f57..499cff9 100644
--- a/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs
+++ b/tests/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs
@@ -6,18 +6,15 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
using Tvdb.Configuration;
-using Xunit.Abstractions;
namespace Tvdb.Provider;
public class TvdbTokenProviderUnitTests
{
- public TvdbTokenProviderUnitTests(ITestOutputHelper outputHelper)
+ public TvdbTokenProviderUnitTests()
{
- OutputHelper = outputHelper;
var builder = new HostApplicationBuilder();
var config = builder.Configuration
@@ -25,16 +22,14 @@ public TvdbTokenProviderUnitTests(ITestOutputHelper outputHelper)
.Build();
ServiceProvider = builder.Services
- .AddLogging((builder) => builder.AddXUnit(OutputHelper))
.Configure(config.GetRequiredSection("TvdbConfiguration"))
.AddScoped()
.BuildServiceProvider();
}
- public ITestOutputHelper OutputHelper { get; }
public ServiceProvider ServiceProvider { get; internal set; }
- [Fact]
+ [Test]
public async Task AcquireTokenAsync_Fact()
{
// Arrange
diff --git a/tests/TvdbClient.Tests/TvdbClient.Tests.csproj b/tests/TvdbClient.Tests/TvdbClient.Tests.csproj
new file mode 100644
index 0000000..63e415c
--- /dev/null
+++ b/tests/TvdbClient.Tests/TvdbClient.Tests.csproj
@@ -0,0 +1,33 @@
+
+
+
+ net9.0
+ enable
+ enable
+ false
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TvdbClient.Tests/TvdbClientConfig.json b/tests/TvdbClient.Tests/TvdbClientConfig.json
similarity index 100%
rename from TvdbClient.Tests/TvdbClientConfig.json
rename to tests/TvdbClient.Tests/TvdbClientConfig.json