-
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.
Added ordering to parameterized content members.
- Loading branch information
1 parent
4f84d01
commit 9a5b3a9
Showing
2 changed files
with
72 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
70 changes: 70 additions & 0 deletions
70
test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue355Tests.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,70 @@ | ||
using ExtendedXmlSerializer.Configuration; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Support; | ||
using Xunit; | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues | ||
{ | ||
public sealed class Issue355Tests | ||
{ | ||
[Fact] | ||
void Verify() | ||
{ | ||
var container = ConfiguredContainer.New<CombinedProfile>(); | ||
var serializer = container.UseOptimizedNamespaces() | ||
.EnableParameterizedContent() | ||
.EnableImplicitTyping(typeof(Outer)) | ||
// | ||
|
||
.Create() | ||
.ForTesting(); | ||
|
||
serializer.Assert(new Outer("A", "B", "C"), @"<?xml version=""1.0"" encoding=""utf-8""?><OuterDataThings><Cc>C</Cc><Bb>B</Bb><Aa>A</Aa></OuterDataThings>"); | ||
} | ||
|
||
public class Outer | ||
{ | ||
public Outer(string a, string b, string c) | ||
{ | ||
A = a; | ||
B = b; | ||
C = c; | ||
} | ||
|
||
public string C { get; } | ||
|
||
public string B { get; } | ||
|
||
public string A { get; } | ||
} | ||
|
||
sealed class CombinedProfile : CompositeConfigurationProfile | ||
{ | ||
public static CombinedProfile Default { get; } = new CombinedProfile(); | ||
|
||
CombinedProfile() : base(OuterProfile.Default) {} | ||
} | ||
|
||
sealed class OuterProfile : IConfigurationProfile | ||
{ | ||
public static OuterProfile Default { get; } = new OuterProfile(); | ||
|
||
OuterProfile() {} | ||
|
||
public IConfigurationContainer Get(IConfigurationContainer parameter) | ||
=> parameter.Type<Outer>() | ||
.Name("OuterDataThings") | ||
// | ||
.Member(x => x.C) | ||
.Name("Cc") | ||
.Order(0) | ||
// | ||
.Member(x => x.B) | ||
.Name("Bb") | ||
.Order(1) | ||
// | ||
.Member(x => x.A) | ||
.Name("Aa") | ||
.Order(2); | ||
} | ||
} | ||
} |