-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from Tynamix/develop
Release 1.5.9
- Loading branch information
Showing
7 changed files
with
414 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This workflow will build a .NET project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | ||
|
||
name: build-and-test | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "develop", "master" ] | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and Test .NET Libraries | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
matrix: | ||
dotnet-version: [8.0.x, 4.8] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET 8 | ||
if: matrix.dotnet-version == '8.0.x' | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ matrix.dotnet-version }} | ||
|
||
- name: Setup .NET Framework 4.8 | ||
if: matrix.dotnet-version == '4.8' | ||
run: echo "Using pre-installed .NET Framework 4.8" | ||
|
||
- name: Restore dependencies .NET 8 | ||
if: matrix.dotnet-version == '8.0.x' | ||
run: dotnet restore | ||
|
||
- name: Restore dependencies .NET 4.8 | ||
if: matrix.dotnet-version == '4.8' | ||
run: nuget restore ObjectFillerNET.sln | ||
|
||
- name: Build .NET 8 | ||
if: matrix.dotnet-version == '8.0.x' | ||
run: dotnet build --configuration Release --no-restore | ||
|
||
- name: Build .NET 4.8 | ||
if: matrix.dotnet-version == '4.8' | ||
run: | | ||
&"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin\MSBuild.exe" ObjectFillerNET.sln /p:Configuration=Release | ||
- name: Test .NET 8 | ||
if: matrix.dotnet-version == '8.0.x' | ||
run: dotnet test --configuration Release --no-build --verbosity normal | ||
|
||
- name: Test .NET 4.8 | ||
if: matrix.dotnet-version == '4.8' | ||
run: | | ||
&"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net48\Tynamix.ObjectFiller.Test.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
|
||
name: publish-to-nuget | ||
on: | ||
workflow_dispatch: # Allow running the workflow manually from the GitHub UI | ||
push: | ||
branches: | ||
- 'master' # Run the workflow when pushing to the main branch | ||
|
||
env: | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
DOTNET_NOLOGO: true | ||
NuGetDirectory: ${{ github.workspace}}/nuget | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
create_nuget: | ||
runs-on: windows-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
# Install the .NET SDK indicated in the global.json file | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
|
||
# Create the NuGet package in the folder from the environment variable NuGetDirectory | ||
- run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }} | ||
|
||
# Publish the NuGet package as an artifact, so they can be used in the following jobs | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: nuget | ||
if-no-files-found: error | ||
retention-days: 7 | ||
path: ${{ env.NuGetDirectory }}/*.nupkg | ||
|
||
validate_nuget: | ||
runs-on: windows-latest | ||
needs: [ create_nuget ] | ||
steps: | ||
# Install the .NET SDK indicated in the global.json file | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
|
||
# Download the NuGet package created in the previous job | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: nuget | ||
path: ${{ env.NuGetDirectory }} | ||
|
||
- name: Install nuget validator | ||
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global | ||
|
||
# Validate metadata and content of the NuGet package | ||
# https://www.nuget.org/packages/Meziantou.Framework.NuGetPackageValidation.Tool#readme-body-tab | ||
# If some rules are not applicable, you can disable them | ||
# using the --excluded-rules or --excluded-rule-ids option | ||
- name: Validate package | ||
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg") | ||
|
||
run_test: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
- name: Run tests | ||
run: dotnet test --configuration Release | ||
|
||
deploy: | ||
runs-on: windows-latest | ||
needs: [ validate_nuget, run_test ] | ||
steps: | ||
# Download the NuGet package created in the previous job | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: nuget | ||
path: ${{ env.NuGetDirectory }} | ||
|
||
# Install the .NET SDK indicated in the global.json file | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
|
||
# Publish all NuGet packages to NuGet.org | ||
# Use --skip-duplicate to prevent errors if a package with the same version already exists. | ||
# If you retry a failed workflow, already published packages will be skipped without error. | ||
- name: Publish NuGet package | ||
run: | | ||
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) { | ||
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Tynamix.ObjectFiller.Test/BugfixTests/Bug143InheritedAbstractPropertiesAreNotFilled.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Tynamix.ObjectFiller.Test.BugfixTests | ||
{ | ||
internal abstract class EntityBase | ||
{ | ||
public string Name { get; set; } | ||
public abstract string AbstractName { get; set; } | ||
} | ||
|
||
internal class CustomEntity : EntityBase | ||
{ | ||
public override string AbstractName { get; set; } | ||
} | ||
|
||
[TestClass] | ||
public class Bug143InheritedAbstractPropertiesAreNotFilled | ||
{ | ||
[TestMethod] | ||
public void InheritedAbstractPropertiesShouldBeFilled() | ||
{ | ||
Filler<CustomEntity> filler = new Filler<CustomEntity>(); | ||
filler | ||
.Setup(true) | ||
.OnProperty(x => x.Name).Use("Alice") | ||
.OnProperty(x => x.AbstractName).Use("John"); | ||
var entity = filler.Create(); | ||
|
||
Assert.IsNotNull(entity); | ||
Assert.AreEqual("Alice", entity.Name); | ||
Assert.AreEqual("John", entity.AbstractName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.