1
1
using System . Collections ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq . Dynamic . Core . Tests . Helpers . Models ;
4
+ using FluentAssertions ;
5
+ using Newtonsoft . Json . Linq ;
4
6
using Xunit ;
5
7
6
8
namespace System . Linq . Dynamic . Core . Tests
@@ -103,6 +105,22 @@ public void SelectMany_Dynamic_IntoType()
103
105
Assert . Equal ( queryNormal , queryDynamic ) ;
104
106
}
105
107
108
+ [ Fact ]
109
+ public void SelectMany_Dynamic_OverJArray_TResult ( )
110
+ {
111
+ // Arrange
112
+ var array1 = JArray . Parse ( "[1,2,3]" ) ;
113
+ var array2 = JArray . Parse ( "[4,5,6]" ) ;
114
+
115
+ // Act
116
+ var expectedResult = new [ ] { array1 , array2 } . SelectMany ( it => it ) . ToArray ( ) ;
117
+ var result = new [ ] { array1 , array2 } . AsQueryable ( ) . SelectMany ( "it" ) . ToDynamicArray < JToken > ( ) ;
118
+
119
+ // Assert
120
+ result . Should ( ) . BeEquivalentTo ( expectedResult ) ;
121
+ // result.Should().HaveCount(6).And.Subject.Select(j => j.Value).Should().ContainInOrder(new[] { 1, 2, 3, 4, 5, 6 });
122
+ }
123
+
106
124
[ Fact ]
107
125
public void SelectMany_Dynamic_OverArray_TResult ( )
108
126
{
@@ -119,6 +137,21 @@ public void SelectMany_Dynamic_OverArray_TResult()
119
137
Assert . Equal ( expectedResult , result ) ;
120
138
}
121
139
140
+ [ Fact ]
141
+ public void SelectMany_Dynamic_OverArray_Int ( )
142
+ {
143
+ var testList = new [ ]
144
+ {
145
+ new [ ] { 1 , 2 , 3 } ,
146
+ new [ ] { 4 , 5 , 6 }
147
+ } ;
148
+
149
+ var expectedResult = testList . SelectMany ( it => it ) . ToList ( ) ;
150
+ var result = testList . AsQueryable ( ) . SelectMany < int > ( "it" ) . ToList ( ) ;
151
+
152
+ Assert . Equal ( expectedResult , result ) ;
153
+ }
154
+
122
155
[ Fact ]
123
156
public void SelectMany_Dynamic_OverArray_IntoType ( )
124
157
{
0 commit comments