-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init field only on first execution (#631)
* Init field only on first execution * Test demonstrating issue #629 Co-authored-by: Boris Breidenbach <boris.breidenbach@aquantec.de>
- Loading branch information
Showing
2 changed files
with
40 additions
and
9 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
27 changes: 27 additions & 0 deletions
27
test/System.Linq.Dynamic.Core.Tests.Net6/DynamicClassTest.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,27 @@ | ||
using System.Collections.Generic; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace System.Linq.Dynamic.Core.Tests | ||
{ | ||
public class DynamicClassTest | ||
{ | ||
[Fact] | ||
public void GetPropertiesWorks() | ||
{ | ||
// Arrange | ||
var range = new List<object> | ||
{ | ||
new { FieldName = "TestFieldName", Value = 3.14159 } | ||
}; | ||
|
||
// Act | ||
var rangeResult = range.AsQueryable().Select("new(FieldName as FieldName)").ToDynamicList(); | ||
var item = rangeResult.FirstOrDefault(); | ||
|
||
var call = () => item.GetDynamicMemberNames(); | ||
call.Should().NotThrow(); | ||
call.Should().NotThrow(); | ||
} | ||
} | ||
} |