Skip to content

Commit fd3abff

Browse files
committed
test: add integration test for additional parameter inlining in projections
1 parent 445b165 commit fd3abff

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using Riok.Mapperly.IntegrationTests.Mapper;
4+
using Riok.Mapperly.IntegrationTests.Models;
5+
using Shouldly;
6+
using Xunit;
7+
8+
namespace Riok.Mapperly.IntegrationTests
9+
{
10+
public class AdditionalParameterInliningMapperTest
11+
{
12+
[Fact]
13+
public void ProjectWithAdditionalParameterShouldInline()
14+
{
15+
var objects = new List<IdObject> { new() { IdValue = 42 } }.AsQueryable();
16+
var result = objects.ProjectWithAdditionalParameter(100).ToList();
17+
result.ShouldHaveSingleItem();
18+
result[0].IdValue.ShouldBe(42);
19+
result[0].ValueFromParameter.ShouldBe(100);
20+
}
21+
}
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Linq;
2+
using Riok.Mapperly.Abstractions;
3+
using Riok.Mapperly.IntegrationTests.Dto;
4+
using Riok.Mapperly.IntegrationTests.Models;
5+
6+
namespace Riok.Mapperly.IntegrationTests.Mapper
7+
{
8+
[Mapper]
9+
public static partial class AdditionalParameterInliningMapper
10+
{
11+
private static partial AdditionalParametersDto MapToDto(IdObject source, int valueFromParameter);
12+
13+
public static partial IQueryable<AdditionalParametersDto> ProjectWithAdditionalParameter(
14+
this IQueryable<IdObject> q,
15+
int valueFromParameter
16+
);
17+
}
18+
}

0 commit comments

Comments
 (0)