From 66a1451b7a5c2191f9f75397aa6b3b360bb7cf53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Guyonnet?= Date: Sat, 22 Jun 2024 02:52:51 +0200 Subject: [PATCH 01/23] #143 Support filling inherited abstract properties --- .gitignore | 1 + ...InheritedAbstractPropertiesAreNotFilled.cs | 34 +++++++++ Tynamix.ObjectFiller/NetTypeApiExtension.cs | 69 ++++++++++++------- 3 files changed, 80 insertions(+), 24 deletions(-) create mode 100644 Tynamix.ObjectFiller.Test/BugfixTests/Bug143InheritedAbstractPropertiesAreNotFilled.cs diff --git a/.gitignore b/.gitignore index 43ffef6..3a812e3 100644 --- a/.gitignore +++ b/.gitignore @@ -180,3 +180,4 @@ ObjectFiller.Test/ObjectFiller.Test.v2.ncrunchproject .vs/config/applicationhost.config Output-Build.txt .vs/ +.idea/ diff --git a/Tynamix.ObjectFiller.Test/BugfixTests/Bug143InheritedAbstractPropertiesAreNotFilled.cs b/Tynamix.ObjectFiller.Test/BugfixTests/Bug143InheritedAbstractPropertiesAreNotFilled.cs new file mode 100644 index 0000000..fd779da --- /dev/null +++ b/Tynamix.ObjectFiller.Test/BugfixTests/Bug143InheritedAbstractPropertiesAreNotFilled.cs @@ -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 filler = new Filler(); + 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); + } + } +} diff --git a/Tynamix.ObjectFiller/NetTypeApiExtension.cs b/Tynamix.ObjectFiller/NetTypeApiExtension.cs index 9ee8050..b85ba93 100644 --- a/Tynamix.ObjectFiller/NetTypeApiExtension.cs +++ b/Tynamix.ObjectFiller/NetTypeApiExtension.cs @@ -88,6 +88,25 @@ internal static bool IsAbstract(this Type source) return source.IsAbstract; #endif } + + internal static bool IsAbstract(this PropertyInfo source) + { +#if NETSTANDARD + return source.GetMethod.IsAbstract; +#else + var methodInfo = source.GetGetMethod() ?? source.GetSetMethod(); + return methodInfo != null && methodInfo.IsAbstract; +#endif + } + + internal static Type GetBaseType(this Type source) + { +#if NETSTANDARD + return source.GetTypeInfo().BaseType; +#else + return source.BaseType; +#endif + } internal static IEnumerable GetImplementedInterfaces(this Type source) { @@ -100,50 +119,52 @@ internal static IEnumerable GetImplementedInterfaces(this Type source) internal static IEnumerable GetProperties(this Type source, bool ignoreInheritance) { -#if NETSTANDARD - if (ignoreInheritance) { - return source.GetTypeInfo().DeclaredProperties.ToList(); + return GetOwnProperties(source); } - return GetDeclaredPropertyInfosRecursive(new List(), source.GetTypeInfo()); -#else - - if (ignoreInheritance) - { - return source.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); - } - - return source.GetProperties(); -#endif - + return GetPropertiesRecursively(source, new List()); } + private static PropertyInfo[] GetOwnProperties(Type source) + { #if NETSTANDARD - - internal static List GetDeclaredPropertyInfosRecursive(List propertyInfos, TypeInfo typeInfo) + return source.GetTypeInfo().DeclaredProperties.ToArray(); +#else + return source.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); +#endif + } + + private static IEnumerable GetPropertiesRecursively(Type source, List propertyInfos) { - foreach (var property in typeInfo.DeclaredProperties) + foreach (var property in GetOwnProperties(source)) { - if (!propertyInfos.Any(x => x.Name == property.Name)) + var existingProperty = propertyInfos.FirstOrDefault(p => p.Name == property.Name); + if (existingProperty != null) + { + if (IsAbstract(property)) + { + // abstract properties take precedence over their concrete declaration counterpart + propertyInfos.Remove(existingProperty); + propertyInfos.Add(property); + } + } + else { propertyInfos.Add(property); } } - if(typeInfo.BaseType != null) + Type baseType = GetBaseType(source); + if(baseType != null) { - return GetDeclaredPropertyInfosRecursive(propertyInfos, typeInfo.BaseType.GetTypeInfo()); + return GetPropertiesRecursively(baseType, propertyInfos); } return propertyInfos; } -#endif - - - internal static Type[] GetGenericTypeArguments(this Type source) { #if NETSTANDARD From ec737d547ad1ebc130bd66adad2d6d2d8824f46f Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 08:56:13 +0200 Subject: [PATCH 02/23] Create dotnet.yml --- .github/workflows/dotnet.yml | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..b9aaab4 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,53 @@ +# 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: .NET + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + build_and_test: + name: Build and Test .NET Libraries + runs-on: windows-2019 + + strategy: + matrix: + dotnet-version: [8.0.x, 4.8.x] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.dotnet-version }} + + - 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.x' + 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.x' + run: msbuild /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.x' + run: | + vstest.console.exe Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From b0f509e6dcbff2f9db92497bf36a9861bdd26ab7 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 09:10:16 +0200 Subject: [PATCH 03/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b9aaab4..ee54476 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -12,11 +12,11 @@ on: jobs: build_and_test: name: Build and Test .NET Libraries - runs-on: windows-2019 + runs-on: windows-latest strategy: matrix: - dotnet-version: [8.0.x, 4.8.x] + dotnet-version: [8.0.x, 4.8] steps: - name: Checkout code From bb19876be6ec228b7e70f0e0a7dd2b5ada814d4a Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 09:12:03 +0200 Subject: [PATCH 04/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index ee54476..fabd8a8 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -22,11 +22,17 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Setup .NET + - 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 From 0ba3447f30217f7ed3442180c1f3f440c75aadf6 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 09:14:12 +0200 Subject: [PATCH 05/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index fabd8a8..d5b703e 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -38,7 +38,7 @@ jobs: run: dotnet restore - name: Restore dependencies .NET 4.8 - if: matrix.dotnet-version == '4.8.x' + if: matrix.dotnet-version == '4.8' run: nuget restore ObjectFillerNET.sln - name: Build .NET 8 @@ -46,7 +46,7 @@ jobs: run: dotnet build --configuration Release --no-restore - name: Build .NET 4.8 - if: matrix.dotnet-version == '4.8.x' + if: matrix.dotnet-version == '4.8' run: msbuild /p:Configuration=Release - name: Test .NET 8 @@ -54,6 +54,6 @@ jobs: run: dotnet test --configuration Release --no-build --verbosity normal - name: Test .NET 4.8 - if: matrix.dotnet-version == '4.8.x' + if: matrix.dotnet-version == '4.8' run: | vstest.console.exe Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From 99e1c9b68c3e8d4bebe97b2f0a16132b6f21cd5c Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 09:24:16 +0200 Subject: [PATCH 06/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d5b703e..80dce6a 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -47,7 +47,7 @@ jobs: - name: Build .NET 4.8 if: matrix.dotnet-version == '4.8' - run: msbuild /p:Configuration=Release + run: "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" /p:Configuration=Release - name: Test .NET 8 if: matrix.dotnet-version == '8.0.x' @@ -56,4 +56,4 @@ jobs: - name: Test .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - vstest.console.exe Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll + ""C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From ae7434b157f76a966d3ba25e48aad2d520741257 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 09:27:25 +0200 Subject: [PATCH 07/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 80dce6a..dc4a42b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -47,7 +47,7 @@ jobs: - name: Build .NET 4.8 if: matrix.dotnet-version == '4.8' - run: "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" /p:Configuration=Release + run: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\MSBuild.exe" /p:Configuration=Release - name: Test .NET 8 if: matrix.dotnet-version == '8.0.x' @@ -56,4 +56,4 @@ jobs: - name: Test .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - ""C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll + "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From 4e289690df7ceb61c0ccd77f962713388e2b8660 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 11:21:10 +0200 Subject: [PATCH 08/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index dc4a42b..0ec5ccd 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -47,7 +47,8 @@ jobs: - name: Build .NET 4.8 if: matrix.dotnet-version == '4.8' - run: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\MSBuild.exe" /p:Configuration=Release + run: | + "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe" /p:Configuration=Release - name: Test .NET 8 if: matrix.dotnet-version == '8.0.x' @@ -56,4 +57,4 @@ jobs: - name: Test .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll + "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe" Tynamix.ObjectFiller.Test\\bin\\Release\\net461\\Tynamix.ObjectFiller.Test.dll From 0a6f574f909e377a6ada0965d0acd448f7937338 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 11:25:05 +0200 Subject: [PATCH 09/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 0ec5ccd..08e2152 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -48,7 +48,7 @@ jobs: - name: Build .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe" /p:Configuration=Release + "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" ObjectFillerNET.sln /p:Configuration=Release - name: Test .NET 8 if: matrix.dotnet-version == '8.0.x' @@ -57,4 +57,4 @@ jobs: - name: Test .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe" Tynamix.ObjectFiller.Test\\bin\\Release\\net461\\Tynamix.ObjectFiller.Test.dll + "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From f491302363efad5b45943e26630b51743690c8f4 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 11:26:56 +0200 Subject: [PATCH 10/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 08e2152..daf7a84 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -48,7 +48,7 @@ jobs: - name: Build .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" ObjectFillerNET.sln /p:Configuration=Release + "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' @@ -57,4 +57,4 @@ jobs: - name: Test .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll + "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From daef687b7768fad9a8250e1b105ab0ff3eb8b097 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 13:54:33 +0200 Subject: [PATCH 11/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index daf7a84..82c1a1c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -30,8 +30,7 @@ jobs: - name: Setup .NET Framework 4.8 if: matrix.dotnet-version == '4.8' - run: | - echo "Using pre-installed .NET Framework 4.8" + run: echo "Using pre-installed .NET Framework 4.8" - name: Restore dependencies .NET 8 if: matrix.dotnet-version == '8.0.x' @@ -48,7 +47,7 @@ jobs: - 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 + &"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' @@ -57,4 +56,4 @@ jobs: - name: Test .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll + &"C:\Program Files\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From 0d26f7b0b6c8b698b135dc5096df17e8b7ebe51e Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 14:04:15 +0200 Subject: [PATCH 12/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 82c1a1c..f82fcc5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -56,4 +56,4 @@ jobs: - name: Test .NET 4.8 if: matrix.dotnet-version == '4.8' run: | - &"C:\Program Files\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll + &"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tynamix.ObjectFiller.Test\bin\Release\net461\Tynamix.ObjectFiller.Test.dll From 59da21d953ff23738b7c690935c9dca8e6bc97c4 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Tue, 23 Jul 2024 14:20:01 +0200 Subject: [PATCH 13/23] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f82fcc5..03c581c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -56,4 +56,4 @@ jobs: - 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\net461\Tynamix.ObjectFiller.Test.dll + &"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 From 9698b375ef15bf69af4262e6d96a9768ade06680 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 13:52:02 +0200 Subject: [PATCH 14/23] Create publish-to-nuget.yml --- .github/workflows/publish-to-nuget.yml | 95 ++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/publish-to-nuget.yml diff --git a/.github/workflows/publish-to-nuget.yml b/.github/workflows/publish-to-nuget.yml new file mode 100644 index 0000000..bd497ac --- /dev/null +++ b/.github/workflows/publish-to-nuget.yml @@ -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: ubuntu-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: ubuntu-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: ubuntu-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: ubuntu-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_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate + } From e1fb44efa2a644ec47595b99673a1f7c61d96ac4 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 13:56:25 +0200 Subject: [PATCH 15/23] Update publish-to-nuget.yml --- .github/workflows/publish-to-nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-nuget.yml b/.github/workflows/publish-to-nuget.yml index bd497ac..3d46d9d 100644 --- a/.github/workflows/publish-to-nuget.yml +++ b/.github/workflows/publish-to-nuget.yml @@ -91,5 +91,5 @@ jobs: - name: Publish NuGet package run: | foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) { - dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate + dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate } From ef56ea816699ca37de4e326922146a925d3c575b Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 13:57:58 +0200 Subject: [PATCH 16/23] remove appveyor. added new version info --- .../Tynamix.ObjectFiller.csproj | 120 ++++++++++-------- appveyor.yml | 12 -- 2 files changed, 64 insertions(+), 68 deletions(-) delete mode 100644 appveyor.yml diff --git a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj index 46a58f2..776a3e8 100644 --- a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj +++ b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj @@ -3,67 +3,73 @@ netstandard1.0;netstandard1.3;netstandard2.0;net35;net452; False - 1.5.7 + 1.5.9 Roman Lautner, Hendrik L., Christian Harlass, GothikX Tynamix http://objectfiller.net/ - -1.5.7 - * Fix multi inheritance bug on .NET Standard - * Add support for IDictionary (thx to wztech0192) - * Bug fixing - - -1.5.6 - * Added target framework netstandard1.3, netstandard2.0 to improve easier usage with .NET 5 - * Added Long Range plugin (thx to weitzhandler) - - -1.5.5 - * SetRandomSeed added to generate always the same random data - * URI Plugin implemented (Thx to twenzel) - * Bugfixing (thx to lichtel, jiaxuyang) - - -1.5.4.1 - * Bugfixing - * Collectionizer supports now also Arrays - - -1.5.4 - * Removed unecessary references for netstandard library - - -1.5.3 - * It is now possible to do an explicit setup (just fill properties which are configured in Filler Setup) - * IpAddress string plugin added - * Switched to .NET Core 1.0 - * Moved to VS 2017 - * Bug fixes - - -1.5.0 - * Collectionizer plugin implemented to use IRandomizer plugins in Collections - * Support for ArrayLists - * Ignore inheritance added to ignore base types of a POCO - * Optimizations in the Randomizer (thx to HerrLoesch) - * FloatRange plugin implemented (thx to HerrLoesch) - * Optimization of some Plugins - * Bug fixing - - -1.4.1 - * Fixing Bug with Multi Threaded Random Access (Thanks to blmeyers) - - -1.4.0 - * Updated to .NET Core. Now you can use ObjectFiller.NET in your .NET Core (DNX) and Windows 10 (UWP) environment! - * FillerSetup can now be used for dedicated properties or types - * Bugfixes - - -1.3.9 - * Bug fixed when creating types with a copy constructor - - -1.3.8 - * Support for Arrays and Nullable Enumerations - * Bugfixes (thx to Hendrik L.) - - -1.3.6 - * Added Randomizer<T> class to easy generate data for simple types like int, double, string + -1.5.9 + * Support filling inherited abstract properties (thx to cguyonnet) + + -1.5.8 + * add support for records + + -1.5.7 + * Fix multi inheritance bug on .NET Standard + * Add support for IDictionary (thx to wztech0192) + * Bug fixing + + -1.5.6 + * Added target framework netstandard1.3, netstandard2.0 to improve easier usage with .NET 5 + * Added Long Range plugin (thx to weitzhandler) + + -1.5.5 + * SetRandomSeed added to generate always the same random data + * URI Plugin implemented (Thx to twenzel) + * Bugfixing (thx to lichtel, jiaxuyang) + + -1.5.4.1 + * Bugfixing + * Collectionizer supports now also Arrays + + -1.5.4 + * Removed unecessary references for netstandard library + + -1.5.3 + * It is now possible to do an explicit setup (just fill properties which are configured in Filler Setup) + * IpAddress string plugin added + * Switched to .NET Core 1.0 + * Moved to VS 2017 + * Bug fixes + + -1.5.0 + * Collectionizer plugin implemented to use IRandomizer plugins in Collections + * Support for ArrayLists + * Ignore inheritance added to ignore base types of a POCO + * Optimizations in the Randomizer (thx to HerrLoesch) + * FloatRange plugin implemented (thx to HerrLoesch) + * Optimization of some Plugins + * Bug fixing + + -1.4.1 + * Fixing Bug with Multi Threaded Random Access (Thanks to blmeyers) + + -1.4.0 + * Updated to .NET Core. Now you can use ObjectFiller.NET in your .NET Core (DNX) and Windows 10 (UWP) environment! + * FillerSetup can now be used for dedicated properties or types + * Bugfixes + + -1.3.9 + * Bug fixed when creating types with a copy constructor + + -1.3.8 + * Support for Arrays and Nullable Enumerations + * Bugfixes (thx to Hendrik L.) + + -1.3.6 + * Added Randomizer<T> class to easy generate data for simple types like int, double, string * Support for complex standalone CLR types like List<T> * CityName plugin (Thx to Hendrik L.) * E-Mail-Address plugin (Thx to Hendrik L.) @@ -167,7 +173,6 @@ It supports also IEnumerables and Dictionaries and constructors WITH parameters. It is also possible to fill instances and to write private properties. https://github.com/Tynamix/ObjectFiller.NET GitHub - True Copyright ©Roman Lautner 2022 bin\Debug\Tynamix.ObjectFiller.xml 1.5.7 @@ -187,4 +192,7 @@ It is also possible to fill instances and to write private properties. + + true + \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 540cff5..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,12 +0,0 @@ -os: Visual Studio 2022 - -install: -- dotnet restore - -before_build: - - nuget restore - -build: - verbosity: minimal - -test: on From 3fbf1e22bea0b6e898f600255224d79baf9b3377 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 14:00:56 +0200 Subject: [PATCH 17/23] Update and rename dotnet.yml to build-and-test.yml --- .github/workflows/{dotnet.yml => build-and-test.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{dotnet.yml => build-and-test.yml} (98%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/build-and-test.yml similarity index 98% rename from .github/workflows/dotnet.yml rename to .github/workflows/build-and-test.yml index 03c581c..7ee911b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/build-and-test.yml @@ -1,7 +1,7 @@ # 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: .NET +name: build-and-test on: push: From 7b264a8821145496f859dd5ad996f076501024d0 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 14:01:36 +0200 Subject: [PATCH 18/23] Update publish-to-nuget.yml --- .github/workflows/publish-to-nuget.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-to-nuget.yml b/.github/workflows/publish-to-nuget.yml index 3d46d9d..d967183 100644 --- a/.github/workflows/publish-to-nuget.yml +++ b/.github/workflows/publish-to-nuget.yml @@ -18,7 +18,7 @@ defaults: jobs: create_nuget: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: checkout uses: actions/checkout@v3 @@ -39,7 +39,7 @@ jobs: path: ${{ env.NuGetDirectory }}/*.nupkg validate_nuget: - runs-on: ubuntu-latest + runs-on: windows-latest needs: [ create_nuget ] steps: # Install the .NET SDK indicated in the global.json file @@ -63,7 +63,7 @@ jobs: run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg") run_test: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v3 - name: Setup .NET @@ -72,7 +72,7 @@ jobs: run: dotnet test --configuration Release deploy: - runs-on: ubuntu-latest + runs-on: windows-latest needs: [ validate_nuget, run_test ] steps: # Download the NuGet package created in the previous job From 113a906bbfe217f0476fc72d6d98a69498259d1b Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 14:02:12 +0200 Subject: [PATCH 19/23] Update publish-to-nuget.yml --- .github/workflows/publish-to-nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-nuget.yml b/.github/workflows/publish-to-nuget.yml index d967183..178d210 100644 --- a/.github/workflows/publish-to-nuget.yml +++ b/.github/workflows/publish-to-nuget.yml @@ -1,6 +1,6 @@ # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json -name: publish-to.nuget +name: publish-to-nuget on: workflow_dispatch: # Allow running the workflow manually from the GitHub UI push: From 2aa1905e0f2ac5a8436ff1866fca9008f3206e5e Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 14:22:23 +0200 Subject: [PATCH 20/23] changed csproj --- .../Tynamix.ObjectFiller.csproj | 203 +++++++++--------- 1 file changed, 106 insertions(+), 97 deletions(-) diff --git a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj index 776a3e8..ad5aee2 100644 --- a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj +++ b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj @@ -9,6 +9,7 @@ http://objectfiller.net/ + True -1.5.9 * Support filling inherited abstract properties (thx to cguyonnet) @@ -70,100 +71,101 @@ -1.3.6 * Added Randomizer<T> class to easy generate data for simple types like int, double, string -* Support for complex standalone CLR types like List<T> -* CityName plugin (Thx to Hendrik L.) -* E-Mail-Address plugin (Thx to Hendrik L.) -* StreetName plugin (Thx to Hendrik L.) -* CountryName plugin -* Code cleanup -* Bugfixes - --1.3.2 -* Bugfixes - --1.3.1 -* Easier usage of static values in the "Use" API -* Added missing type mappings -* Some bugfixes and improvements - --1.3.0 -* Circular Reference Detection (thx to GothikX) -* Export the ObjectFiller setup and reuse it somewhere else -* Improved LoremIpsum Plugin (thx to GothikX) -* Many bugfixes and improvements - --1.2.8 -* IgnoreAllUnknownTypes added -* Usage of RandomList-Plugin improved -* IntRange-Plugin handles now also nullable int! - --1.2.4 -* Create multiple instances -* Some bugfixes and improvements - --1.2.3 -* Use enumerables to fill objects (thx to charlass) -* Its now possible to fill enum properties (thx to charlass) -* Implemented SequenceGenerator (thx to charlass) - --1.2.1 -* Complete refactoring of the FluentAPI. Read the documentation on objectfiller.net for more information! -* Properties with private setter are able to write. -* Renamed ObjectFiller to Filler to avoid NameSpace conflicts -* Order properties implemented -* IntRange Plugin implemented -* ...some more improvements and bugfixes - --1.1.8 -* Bugfix in RandomizerForProperty - --1.1.7 -* Implemented a Lorem Ipsum string plugin - --1.1.6 -* new fantastic PatternGenerator-Plugin. Thanks to charlass for this! -* Adjust namespaces from ObjectFiller to Tynamix.ObjectFiller - --1.1.4 -* IgnoreAllOfType added. -* Little changes to the main API - --1.1.2 -* moved to github - --1.1.0 -* Changed the fluent API to make it even easier than before to use. - --1.0.22 -* Bugfix when handling lists - --1.0.21 -* Constructors with parameters are now possible as long as the types of parameters are configured in the ObjectFiller.NET setup! - --1.0.16 -* RandomListItem-Plugin - --1.0.15 -* Major Bugfix - --1.0.14 -* Bugfixes - --1.0.12 -* RealNameListString Plugin -* DoubleMinMax plugin - --1.0.10 -* Its now possible to ignore properties. -* Fluent API documented. -* Better ExceptionMessages -* Bugfixes - --1.0.6 -* Its now possible to setup a randomizer to a specific property! - --1.0.0 -* Initial release + * Support for complex standalone CLR types like List<T> + * CityName plugin (Thx to Hendrik L.) + * E-Mail-Address plugin (Thx to Hendrik L.) + * StreetName plugin (Thx to Hendrik L.) + * CountryName plugin + * Code cleanup + * Bugfixes + + -1.3.2 + * Bugfixes + + -1.3.1 + * Easier usage of static values in the "Use" API + * Added missing type mappings + * Some bugfixes and improvements + + -1.3.0 + * Circular Reference Detection (thx to GothikX) + * Export the ObjectFiller setup and reuse it somewhere else + * Improved LoremIpsum Plugin (thx to GothikX) + * Many bugfixes and improvements + + -1.2.8 + * IgnoreAllUnknownTypes added + * Usage of RandomList-Plugin improved + * IntRange-Plugin handles now also nullable int! + + -1.2.4 + * Create multiple instances + * Some bugfixes and improvements + + -1.2.3 + * Use enumerables to fill objects (thx to charlass) + * Its now possible to fill enum properties (thx to charlass) + * Implemented SequenceGenerator (thx to charlass) + + -1.2.1 + * Complete refactoring of the FluentAPI. Read the documentation on objectfiller.net for more information! + * Properties with private setter are able to write. + * Renamed ObjectFiller to Filler to avoid NameSpace conflicts + * Order properties implemented + * IntRange Plugin implemented + * ...some more improvements and bugfixes + + -1.1.8 + * Bugfix in RandomizerForProperty + + -1.1.7 + * Implemented a Lorem Ipsum string plugin + + -1.1.6 + * new fantastic PatternGenerator-Plugin. Thanks to charlass for this! + * Adjust namespaces from ObjectFiller to Tynamix.ObjectFiller + + -1.1.4 + * IgnoreAllOfType added. + * Little changes to the main API + + -1.1.2 + * moved to github + + -1.1.0 + * Changed the fluent API to make it even easier than before to use. + + -1.0.22 + * Bugfix when handling lists + + -1.0.21 + * Constructors with parameters are now possible as long as the types of parameters are configured in the ObjectFiller.NET setup! + + -1.0.16 + * RandomListItem-Plugin + + -1.0.15 + * Major Bugfix + + -1.0.14 + * Bugfixes + + -1.0.12 + * RealNameListString Plugin + * DoubleMinMax plugin + + -1.0.10 + * Its now possible to ignore properties. + * Fluent API documented. + * Better ExceptionMessages + * Bugfixes + + -1.0.6 + * Its now possible to setup a randomizer to a specific property! + + -1.0.0 + * Initial release + objectfiller tynamix test testdata prototyp prototyping unittest design designviewmodel generator random data randomdata testing poco lorem ipsum fakedata fake faker The Tynamix ObjectFiller.NET fills the properties of your objects with random data. Use it for unittest, prototyping and whereever you need some random testdata. @@ -174,11 +176,9 @@ It is also possible to fill instances and to write private properties.https://github.com/Tynamix/ObjectFiller.NET GitHub Copyright ©Roman Lautner 2022 - bin\Debug\Tynamix.ObjectFiller.xml - 1.5.7 - 1.5.7 logo.png MIT + @@ -195,4 +195,13 @@ It is also possible to fill instances and to write private properties. true + + + + + + + + ..\README.md + \ No newline at end of file From 9916470072c135c15e32827cfe7aa07cad9bc4ee Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 14:27:17 +0200 Subject: [PATCH 21/23] fix readme.md path --- Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj index ad5aee2..04dd6bb 100644 --- a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj +++ b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj @@ -196,12 +196,12 @@ It is also possible to fill instances and to write private properties.true - + - ..\README.md + README.md \ No newline at end of file From ced88dc1b6446f5de80cc3b44dd535a696111540 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 14:57:09 +0200 Subject: [PATCH 22/23] fix csproj --- Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj index 04dd6bb..f773cdc 100644 --- a/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj +++ b/Tynamix.ObjectFiller/Tynamix.ObjectFiller.csproj @@ -1,6 +1,7 @@  + true netstandard1.0;netstandard1.3;netstandard2.0;net35;net452; False 1.5.9 @@ -10,6 +11,11 @@ http://objectfiller.net/ True + true + true + true + snupkg + true -1.5.9 * Support filling inherited abstract properties (thx to cguyonnet) @@ -204,4 +210,8 @@ It is also possible to fill instances and to write private properties. README.md + + + + \ No newline at end of file From dbaebaadce3f4773b52fe29dbd77fa7408e37af2 Mon Sep 17 00:00:00 2001 From: Roman Lautner Date: Fri, 2 Aug 2024 14:58:47 +0200 Subject: [PATCH 23/23] Update build-and-test.yml --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7ee911b..97cd0d5 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -7,7 +7,7 @@ on: push: branches: [ "develop" ] pull_request: - branches: [ "develop" ] + branches: [ "develop", "master" ] jobs: build_and_test: