-
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.
Fixed bug with references w/ exs:member="" attributes
Fixes #407
- Loading branch information
1 parent
55d1042
commit c85bfa5
Showing
7 changed files
with
76 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
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
48 changes: 48 additions & 0 deletions
48
test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue407Tests.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,48 @@ | ||
using ExtendedXmlSerializer.Configuration; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Shared; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Support; | ||
using FluentAssertions; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
// ReSharper disable UnusedAutoPropertyAccessor.Local | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues | ||
{ | ||
public sealed class Issue407Tests | ||
{ | ||
[Fact] | ||
public void Verify() | ||
{ | ||
var type = new PathogenType{ Code = 'f', Description = "Fungus" }; | ||
var instance = new List<object> | ||
{ | ||
new LookupTable<PathogenDto> | ||
{ | ||
Models = new List<PathogenDto> | ||
{ | ||
new Pathogen{ PathogenType = type } | ||
} | ||
}, | ||
new LookupTable<PathogenTypeDto> | ||
{ | ||
Models = new List<PathogenTypeDto> { type } | ||
} | ||
}; | ||
|
||
var serializer = new ConfigurationContainer().EnableReferences().ForTesting(); | ||
|
||
var cycled = serializer.Cycle(instance); | ||
var expected = cycled[1].To<LookupTable<PathogenTypeDto>>().Models.Only(); | ||
|
||
cycled[0].To<LookupTable<PathogenDto>>() | ||
.Models[0].PathogenType.Should() | ||
.BeSameAs(expected); | ||
|
||
} | ||
|
||
sealed class LookupTable<T> | ||
{ | ||
public List<T> Models { get; set; } = new List<T>(); | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/ExtendedXmlSerializer.Tests.ReportedIssues/Shared/Pathogen.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,4 @@ | ||
namespace ExtendedXmlSerializer.Tests.ReportedIssues.Shared | ||
{ | ||
sealed class Pathogen : PathogenDto {} | ||
} |
7 changes: 7 additions & 0 deletions
7
test/ExtendedXmlSerializer.Tests.ReportedIssues/Shared/PathogenDto.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,7 @@ | ||
namespace ExtendedXmlSerializer.Tests.ReportedIssues.Shared | ||
{ | ||
class PathogenDto | ||
{ | ||
public PathogenType PathogenType { get; set; } | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/ExtendedXmlSerializer.Tests.ReportedIssues/Shared/PathogenType.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,9 @@ | ||
namespace ExtendedXmlSerializer.Tests.ReportedIssues.Shared | ||
{ | ||
sealed class PathogenType : PathogenTypeDto | ||
{ | ||
public char Code { get; set; } | ||
|
||
public string Description { get; set; } | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/ExtendedXmlSerializer.Tests.ReportedIssues/Shared/PathogenTypeDto.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,4 @@ | ||
namespace ExtendedXmlSerializer.Tests.ReportedIssues.Shared | ||
{ | ||
class PathogenTypeDto {} | ||
} |