-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabled member comparison by base-type on EmitWhen call.
- Loading branch information
1 parent
f5a749a
commit 3a2fc2a
Showing
4 changed files
with
43 additions
and
8 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 |
---|---|---|
@@ -1,10 +1,18 @@ | ||
using ExtendedXmlSerializer.ExtensionModel.References; | ||
using ExtendedXmlSerializer.ReflectionModel; | ||
using System.Reflection; | ||
|
||
namespace ExtendedXmlSerializer.ExtensionModel | ||
{ | ||
static class Defaults | ||
{ | ||
public static TypeInfo Reference { get; } = typeof(ReferenceIdentity).GetTypeInfo(); | ||
|
||
public static ITypeComparer TypeComparer { get; } | ||
= new CompositeTypeComparer(ImplementedTypeComparer.Default, | ||
TypeIdentityComparer.Default, | ||
InheritedTypeComparer.Default); | ||
|
||
public static IMemberComparer MemberComparer { get; } = new MemberComparer(TypeComparer); | ||
} | ||
} |
9 changes: 2 additions & 7 deletions
9
src/ExtendedXmlSerializer/ExtensionModel/Xml/CustomSerializers.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
32 changes: 32 additions & 0 deletions
32
test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue411Tests.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,32 @@ | ||
using ExtendedXmlSerializer.Configuration; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Support; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues | ||
{ | ||
public sealed class Issue411Tests | ||
{ | ||
[Fact] | ||
public void Verify() | ||
{ | ||
var serializer = new ConfigurationContainer().Type<SubjectBase>() | ||
.Member(x => x.Message) | ||
.EmitWhen(x => false) | ||
.Create() | ||
.ForTesting(); | ||
|
||
serializer.Cycle(new Subject {Message = "Hello World!"}).Message.Should().BeNull(); | ||
} | ||
|
||
sealed class Subject : SubjectBase | ||
{ | ||
public override string Message { get; set; } | ||
} | ||
|
||
public abstract class SubjectBase | ||
{ | ||
public abstract string Message { get; set; } | ||
} | ||
} | ||
} |