-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
esskar
committed
Aug 27, 2015
1 parent
05c8dfc
commit 58de914
Showing
3 changed files
with
71 additions
and
2 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,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Serialize.Linq.Serializers; | ||
|
||
namespace Serialize.Linq.Tests.Issues | ||
{ | ||
[TestClass] | ||
public class Issue56 | ||
{ | ||
[TestMethod] | ||
public void SerializeContainsWithNullablesAndWithoutNullableKey() | ||
{ | ||
var enterpriseKeys = new List<long?> {1, 2, 3, 4}; | ||
|
||
var predicatePart = | ||
(Expression<Func<GroupEntityWithoutNullable, bool>>) | ||
(groupType => | ||
enterpriseKeys.Contains(groupType.GroupEnterpriseKey)); | ||
|
||
var serializeTo = new ExpressionSerializer(new XmlSerializer()) | ||
{ | ||
AutoAddKnownTypesAsListTypes = true | ||
}; | ||
var predicatePartSerializedToString = serializeTo.SerializeText(predicatePart); | ||
|
||
Assert.IsNotNull(predicatePartSerializedToString); | ||
} | ||
|
||
[TestMethod] | ||
public void SerializeContainsWithNullablesAndWithNullableKey() | ||
{ | ||
var enterpriseKeys = new List<long?> { 1, 2, 3, 4 }; | ||
|
||
var predicatePart = | ||
(Expression<Func<GroupEntityWithNullable, bool>>) | ||
(groupType => | ||
enterpriseKeys.Contains(groupType.GroupEnterpriseKey)); | ||
|
||
var serializeTo = new ExpressionSerializer(new XmlSerializer()) | ||
{ | ||
AutoAddKnownTypesAsListTypes = true | ||
}; | ||
var predicatePartSerializedToString = serializeTo.SerializeText(predicatePart); | ||
|
||
Assert.IsNotNull(predicatePartSerializedToString); | ||
} | ||
|
||
class GroupEntityWithoutNullable | ||
{ | ||
public long GroupEnterpriseKey { get; set; } | ||
} | ||
|
||
class GroupEntityWithNullable | ||
{ | ||
public long? GroupEnterpriseKey { get; set; } | ||
} | ||
} | ||
} |
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