forked from DevExpress/DevExtreme.AspNet.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeserializeTests.cs
More file actions
26 lines (21 loc) · 1008 Bytes
/
DeserializeTests.cs
File metadata and controls
26 lines (21 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using DevExtreme.AspNet.Data.Helpers;
using System.Collections;
using System.Text.Json;
using Xunit;
namespace DevExtreme.AspNet.Data.Tests {
public class DeserializeTests {
[Theory]
[InlineData(@"[""fieldName"",""="",null]")]
[InlineData(@"[[""fieldName1"",""="",""""],""and"",[""fieldName2"",""="",null]]")]
public void FilterOperandValueCanBeNull(string rawJsonCriteria) {
var deserializedList = JsonSerializer.Deserialize<IList>(rawJsonCriteria, DataSourceLoadOptionsParser.DEFAULT_SERIALIZER_OPTIONS);
Assert.Equal(3, deserializedList.Count);
}
[Fact]
public void FilterOperandValueCanBeObject() {
var deserializedList = JsonSerializer.Deserialize<IList>(@"[""fieldName1"",""="",{""Value"":0}]", DataSourceLoadOptionsParser.DEFAULT_SERIALIZER_OPTIONS);
Assert.Equal(3, deserializedList.Count);
Assert.Equal("{\"Value\":0}", deserializedList[2].ToString());
}
}
}