Skip to content

Commit 3fd479e

Browse files
committed
Fix conditional compilation for mapping methods and tests in .NET 9.0+
1 parent c4c1177 commit 3fd479e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/Linqraft.Tests/LinqraftMappingGenerateTest.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ this IQueryable<MappingTestSampleClass> source
2020
ChildName = x.Child?.ChildName,
2121
});
2222

23+
#if NET9_0_OR_GREATER
2324
[LinqraftMappingGenerate("ProjectToDtoWithChildren")]
2425
internal static IQueryable<MappingTestParentDto> DummyWithChildren(
2526
this IQueryable<MappingTestParentClass> source
@@ -32,6 +33,7 @@ this IQueryable<MappingTestParentClass> source
3233
c => new { c.ChildId, c.ChildName }
3334
),
3435
});
36+
#endif
3537
}
3638

3739
public class LinqraftMappingGenerateTest
@@ -76,6 +78,7 @@ public void MappingGenerate_BasicTest()
7678
Assert.Null(result[1].ChildName);
7779
}
7880

81+
#if NET9_0_OR_GREATER
7982
[Fact]
8083
public void MappingGenerate_WithNestedCollection_Test()
8184
{
@@ -117,6 +120,7 @@ public void MappingGenerate_WithNestedCollection_Test()
117120
Assert.Equal("Parent2", result[1].Title);
118121
Assert.Empty(result[1].Children);
119122
}
123+
#endif
120124
}
121125

122126
// Test source classes - consolidated at the end of the file

0 commit comments

Comments
 (0)