-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent DataSourceLoadOptionsParser from System.InvalidOperationExcep…
…tion on parsing binary filter with value null (#620)
- Loading branch information
1 parent
d259461
commit c94a149
Showing
4 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections; | ||
using System.Text.Json; | ||
using Xunit; | ||
|
||
namespace DevExtreme.AspNet.Data.Tests { | ||
|
||
public class DeserializeTests { | ||
static readonly JsonSerializerOptions TESTS_DEFAULT_SERIALIZER_OPTIONS = new JsonSerializerOptions(JsonSerializerDefaults.Web) { | ||
Converters = { new ListConverter() } | ||
}; | ||
|
||
[Theory] | ||
[InlineData(@"[""fieldName"",""="",null]")] | ||
[InlineData(@"[[""fieldName1"",""="",""""],""and"",[""fieldName2"",""="",null]]")] | ||
public void FilterOperandValueCanBeNull(string rawJsonCriteria) { | ||
var deserializedList = JsonSerializer.Deserialize<IList>(rawJsonCriteria, TESTS_DEFAULT_SERIALIZER_OPTIONS); | ||
Assert.Equal(3, deserializedList.Count); | ||
} | ||
} | ||
|
||
} |
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,19 @@ | ||
#if NEWTONSOFT_TESTS | ||
using System.Collections; | ||
using Newtonsoft.Json; | ||
using Xunit; | ||
|
||
namespace DevExtreme.AspNet.Data.Tests { | ||
|
||
public class DeserializeTestsEx { | ||
[Theory] | ||
[InlineData(@"[""fieldName"",""="",null]")] | ||
[InlineData(@"[[""fieldName1"",""="",""""],""and"",[""fieldName2"",""="",null]]")] | ||
public void FilterOperandValueCanBeNull(string rawJsonCriteria) { | ||
var deserializedList = JsonConvert.DeserializeObject<IList>(rawJsonCriteria); | ||
Assert.Equal(3, deserializedList.Count); | ||
} | ||
} | ||
|
||
} | ||
#endif |
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