From d603515908af30a9ba6db712a6f7d32b2ecd10a0 Mon Sep 17 00:00:00 2001 From: Lars Date: Sun, 29 Sep 2024 19:37:34 +0200 Subject: [PATCH] run integration tests with .net 9.0 (#1506) --- .github/workflows/test.yml | 1 + .../BaseMapperTest.cs | 4 +++- .../Helpers/Versions.cs | 1 + .../ProjectionMapperTest.cs | 2 +- .../Riok.Mapperly.IntegrationTests.csproj | 1 + ...ShouldTranslateToQuery_NET9_0.verified.sql | 22 +++++++++++++++++++ 6 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET9_0.verified.sql diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 752dff65d8..b44e70cf30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,6 +89,7 @@ jobs: fail-fast: false matrix: dotnet: + - '9.0' - '8.0' - '7.0' - '6.0' diff --git a/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs b/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs index 2fa31df72f..d34bf0e1c0 100644 --- a/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs +++ b/test/Riok.Mapperly.IntegrationTests/BaseMapperTest.cs @@ -195,7 +195,9 @@ private static string GetSnapshotVersionSuffix(Type type, MethodInfo method) private static Versions GetCurrentVersion() { -#if NET8_0_OR_GREATER +#if NET9_0_OR_GREATER + return Versions.NET9_0; +#elif NET8_0_OR_GREATER return Versions.NET8_0; #elif NET7_0_OR_GREATER return Versions.NET7_0; diff --git a/test/Riok.Mapperly.IntegrationTests/Helpers/Versions.cs b/test/Riok.Mapperly.IntegrationTests/Helpers/Versions.cs index 294a9861c9..09269109b7 100644 --- a/test/Riok.Mapperly.IntegrationTests/Helpers/Versions.cs +++ b/test/Riok.Mapperly.IntegrationTests/Helpers/Versions.cs @@ -9,5 +9,6 @@ public enum Versions NET6_0 = 1 << 1, NET7_0 = 1 << 2, NET8_0 = 1 << 3, + NET9_0 = 1 << 4, } } diff --git a/test/Riok.Mapperly.IntegrationTests/ProjectionMapperTest.cs b/test/Riok.Mapperly.IntegrationTests/ProjectionMapperTest.cs index ca3be5f97e..1a7d234944 100644 --- a/test/Riok.Mapperly.IntegrationTests/ProjectionMapperTest.cs +++ b/test/Riok.Mapperly.IntegrationTests/ProjectionMapperTest.cs @@ -26,7 +26,7 @@ public Task SnapshotGeneratedSource() #if NET7_0_OR_GREATER [Fact] - [VersionedSnapshot(Versions.NET8_0)] + [VersionedSnapshot(Versions.NET8_0 | Versions.NET9_0)] public Task ProjectionShouldTranslateToQuery() { return RunWithDatabase(ctx => diff --git a/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj b/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj index ce0fc17dec..520e1a3b6b 100644 --- a/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj +++ b/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj @@ -36,6 +36,7 @@ + diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET9_0.verified.sql b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET9_0.verified.sql new file mode 100644 index 0000000000..0f1f197e54 --- /dev/null +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET9_0.verified.sql @@ -0,0 +1,22 @@ +SELECT "o"."CtorValue", "o"."IntValue", "o"."IntInitOnlyValue", "o"."RequiredValue", "o"."StringValue", "o"."RenamedStringValue", "i"."IdValue", "i0"."IdValue", CASE + WHEN "t"."IntValue" IS NOT NULL THEN "t"."IntValue" + ELSE 0 +END, "t"."IntValue" IS NOT NULL, "t"."IntValue", "t0"."IntValue" IS NOT NULL, "t0"."IntValue", COALESCE("o"."StringNullableTargetNotNullable", ''), "o0"."Id", "o0"."CtorValue", "o0"."DateTimeValueTargetDateOnly", "o0"."DateTimeValueTargetTimeOnly", "o0"."EnumName", "o0"."EnumRawValue", "o0"."EnumReverseStringValue", "o0"."EnumStringValue", "o0"."EnumValue", "o0"."FlatteningIdValue", "o0"."IgnoredIntValue", "o0"."IgnoredStringValue", "o0"."IntInitOnlyValue", "o0"."IntValue", "o0"."ManuallyMapped", "o0"."ManuallyMappedModified", "o0"."NestedNullableIntValue", "o0"."NestedNullableTargetNotNullableIntValue", "o0"."NullableFlatteningIdValue", "o0"."NullableUnflatteningIdValue", "o0"."RecursiveObjectId", "o0"."RenamedStringValue", "o0"."RequiredValue", "o0"."StringNullableTargetNotNullable", "o0"."StringValue", "o0"."SubObjectSubIntValue", "o0"."UnflatteningIdValue", "o"."Id", "i1"."SubIntValue", "t1"."IntValue", "t1"."TestObjectProjectionId", "t2"."IntValue", CAST("o"."EnumValue" AS INTEGER), CAST("o"."EnumName" AS INTEGER), CAST("o"."EnumRawValue" AS INTEGER), CASE "o"."EnumStringValue" + WHEN 10 THEN 'Value10' + WHEN 20 THEN 'Value20' + WHEN 30 THEN 'Value30' + ELSE CAST("o"."EnumStringValue" AS TEXT) +END, "o"."EnumReverseStringValue", "i1"."SubIntValue" IS NOT NULL, "i1"."BaseIntValue", date("o"."DateTimeValueTargetDateOnly"), "o"."DateTimeValueTargetTimeOnly", "o"."ManuallyMapped", "o"."ManuallyMappedModified" + 10, "t3"."Value", "t3"."Id", "i2"."Id", "i2"."TestObjectProjectionId", "i2"."Value", "l"."Value", "l"."Id" +FROM "Objects" AS "o" +INNER JOIN "IdObject" AS "i" ON "o"."FlatteningIdValue" = "i"."IdValue" +LEFT JOIN "IdObject" AS "i0" ON "o"."NullableFlatteningIdValue" = "i0"."IdValue" +LEFT JOIN "TestObjectNested" AS "t" ON "o"."NestedNullableIntValue" = "t"."IntValue" +LEFT JOIN "TestObjectNested" AS "t0" ON "o"."NestedNullableTargetNotNullableIntValue" = "t0"."IntValue" +LEFT JOIN "Objects" AS "o0" ON "o"."Id" = "o0"."RecursiveObjectId" +LEFT JOIN "InheritanceSubObject" AS "i1" ON "o"."SubObjectSubIntValue" = "i1"."SubIntValue" +LEFT JOIN "TestObjectNested" AS "t1" ON "o"."Id" = "t1"."TestObjectProjectionId" +LEFT JOIN "TestObjectNested" AS "t2" ON "o"."Id" = "t2"."TestObjectProjectionId" +LEFT JOIN "TestObjectProjectionEnumValue" AS "t3" ON "o"."Id" = "t3"."TestObjectProjectionId" +LEFT JOIN "IntegerValue" AS "i2" ON "o"."Id" = "i2"."TestObjectProjectionId" +LEFT JOIN "LongValue" AS "l" ON "o"."Id" = "l"."TestObjectProjectionId" +ORDER BY "o"."Id", "i"."IdValue", "i0"."IdValue", "t"."IntValue", "t0"."IntValue", "o0"."Id", "i1"."SubIntValue", "t1"."IntValue", "t2"."IntValue", "t3"."Id", "i2"."Value", "i2"."Id", "l"."Value" \ No newline at end of file