-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When serialising SearchConditionsJA / SearchConditions, json exceptio…
…ns occur (#121) Added unit test showing issue. Altered serialisation process to deal with search conditions.
- Loading branch information
1 parent
edaaafe
commit 080c29c
Showing
2 changed files
with
93 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using MFiles.VAF.Configuration.JsonAdaptor; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MFiles.VAF.Extensions.Tests | ||
{ | ||
[TestClass] | ||
public class NewtonsoftJsonConvertTests | ||
{ | ||
[DataContract] | ||
public class Configuration | ||
{ | ||
[DataMember] | ||
public SearchConditionsJA SearchConditions { get; set; } | ||
} | ||
|
||
[TestMethod] | ||
public void SearchConditions() | ||
{ | ||
Configuration config = new Configuration(); | ||
config.SearchConditions = new SearchConditionsJA(); | ||
config.SearchConditions.Add(new SearchConditionJA() | ||
{ | ||
ConditionType = MFilesAPI.MFConditionType.MFConditionTypeEqual, | ||
Expression = new ExpressionJA() | ||
{ | ||
PropertyDef = 0, | ||
DataType = MFilesAPI.MFDataType.MFDatatypeText | ||
}, | ||
TypedValue = new TypedValueJA() | ||
{ | ||
DataType = MFilesAPI.MFDataType.MFDatatypeText, | ||
Value = "hello world" | ||
} | ||
}); | ||
config.SearchConditions.Add(new SearchConditionJA() | ||
{ | ||
ConditionType = MFilesAPI.MFConditionType.MFConditionTypeEqual, | ||
Expression = new ExpressionJA() | ||
{ | ||
PropertyDef = 123, | ||
DataType = MFilesAPI.MFDataType.MFDatatypeBoolean | ||
}, | ||
TypedValue = new TypedValueJA() | ||
{ | ||
DataType = MFilesAPI.MFDataType.MFDatatypeBoolean, | ||
Value = true | ||
} | ||
}); | ||
|
||
var serializer = new NewtonsoftJsonConvert(); | ||
var x = serializer.Serialize(config); | ||
Assert.IsNotNull(x); | ||
|
||
} | ||
} | ||
} |
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