-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed ExpressionParser when WrappedValue-string is used for equals-op…
…erator for Enum (#672) * Fixed ExpressionParser when WrappedValue-string is used for equals-operator to compare Enum * . * . * Partial fixed ExpressionParser when WrappedValue-string is used for in-operator and left operand is enum (#668) * Fix * . --------- Co-authored-by: neilbgr <neilbgr@laposte.net>
- Loading branch information
Showing
8 changed files
with
463 additions
and
19 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
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
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
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
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
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
88 changes: 88 additions & 0 deletions
88
test/System.Linq.Dynamic.Core.Tests/Parser/WrappedValueTests.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,88 @@ | ||
using System.Linq.Dynamic.Core.Parser; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace System.Linq.Dynamic.Core.Tests.Parser; | ||
|
||
public class WrappedValueTests | ||
{ | ||
[Fact] | ||
public void WrappedValue_OfTypeString_OperatorEquals_String() | ||
{ | ||
// Arrange | ||
var wrapped = new WrappedValue<string>("str"); | ||
|
||
// Act | ||
var result1A = wrapped == "str"; | ||
var result1B = "str" == wrapped; | ||
var result2A = wrapped == "x"; | ||
var result2B = "x" == wrapped; | ||
|
||
// Assert | ||
result1A.Should().BeTrue(); | ||
result1B.Should().BeTrue(); | ||
result2A.Should().BeFalse(); | ||
result2B.Should().BeFalse(); | ||
} | ||
|
||
[Fact] | ||
public void WrappedValue_OfTypeString_OperatorNotEquals_String() | ||
{ | ||
// Arrange | ||
var wrapped = new WrappedValue<string>("str"); | ||
|
||
// Act | ||
var result1A = wrapped != "str"; | ||
var result1B = "str" != wrapped; | ||
var result2A = wrapped == "x"; | ||
var result2B = "x" == wrapped; | ||
|
||
// Assert | ||
result1A.Should().BeFalse(); | ||
result1B.Should().BeFalse(); | ||
result2A.Should().BeFalse(); | ||
result2B.Should().BeFalse(); | ||
} | ||
|
||
[Fact] | ||
public void WrappedValue_OfTypeString_OperatorEquals_WrappedValue_OfTypeString() | ||
{ | ||
// Arrange | ||
var wrapped = new WrappedValue<string>("str"); | ||
var testEqual = new WrappedValue<string>("str"); | ||
var testNotEqual = new WrappedValue<string>("x"); | ||
|
||
// Act | ||
var result1A = wrapped == testEqual; | ||
var result1B = testEqual == wrapped; | ||
var result2A = wrapped == testNotEqual; | ||
var result2B = testNotEqual == wrapped; | ||
|
||
// Assert | ||
result1A.Should().BeTrue(); | ||
result1B.Should().BeTrue(); | ||
result2A.Should().BeFalse(); | ||
result2B.Should().BeFalse(); | ||
} | ||
|
||
[Fact] | ||
public void WrappedValue_OfTypeString_OperatorNotEquals_WrappedValue_OfTypeString() | ||
{ | ||
// Arrange | ||
var wrapped = new WrappedValue<string>("str"); | ||
var testEqual = new WrappedValue<string>("str"); | ||
var testNotEqual = new WrappedValue<string>("x"); | ||
|
||
// Act | ||
var result1A = wrapped != testEqual; | ||
var result1B = testEqual != wrapped; | ||
var result2A = wrapped != testNotEqual; | ||
var result2B = testNotEqual != wrapped; | ||
|
||
// Assert | ||
result1A.Should().BeFalse(); | ||
result1B.Should().BeFalse(); | ||
result2A.Should().BeTrue(); | ||
result2B.Should().BeTrue(); | ||
} | ||
} |
Oops, something went wrong.