-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support defining property collection as IEnumerable<> for the new sel…
…ect parser
- Loading branch information
Showing
6 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
OData.Client.UnitTests/SelectAndExpand/NestedIEnumerable/Target.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Cblx.OData.Client.Tests.SelectAndExpand.NestedIEnumerable; | ||
|
||
public class Target | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public IEnumerable<TargetChild> Children { get; set; } | ||
} |
6 changes: 6 additions & 0 deletions
6
OData.Client.UnitTests/SelectAndExpand/NestedIEnumerable/TargetChild.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Cblx.OData.Client.Tests.SelectAndExpand.NestedIEnumerable; | ||
|
||
public class TargetChild | ||
{ | ||
public Guid Id { get; set; } | ||
} |
9 changes: 9 additions & 0 deletions
9
OData.Client.UnitTests/SelectAndExpand/NestedIEnumerable/TbSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Cblx.OData.Client.Tests.SelectAndExpand.NestedIEnumerable; | ||
|
||
public class TbSource | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public Guid ChildId { get; set; } | ||
public TbSourceChild[] Children { get; set; } | ||
} |
6 changes: 6 additions & 0 deletions
6
OData.Client.UnitTests/SelectAndExpand/NestedIEnumerable/TbSourceChild.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Cblx.OData.Client.Tests.SelectAndExpand.NestedIEnumerable; | ||
|
||
public class TbSourceChild | ||
{ | ||
public Guid Id { get; set; } | ||
} |
20 changes: 20 additions & 0 deletions
20
OData.Client.UnitTests/SelectAndExpand/NestedIEnumerable/Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Cblx.OData.Client.Tests.SelectAndExpand.NestedIEnumerable; | ||
|
||
public class Tests | ||
{ | ||
[Fact] | ||
public void Old() | ||
{ | ||
string query = "$select=Id&$expand=Children($select=Id)"; | ||
var parser = new SelectAndExpandParser<TbSource, Target>(); | ||
parser.ToString().Should().Be(query); | ||
} | ||
|
||
[Fact] | ||
public void New() | ||
{ | ||
string query = "$select=Id&$expand=Children($select=Id)"; | ||
var parser = new SelectAndExpandParserV2<TbSource, Target>(); | ||
parser.ToSelectAndExpand().Query.Should().Be(query); | ||
} | ||
} |