-
Notifications
You must be signed in to change notification settings - Fork 46
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
Showing
3 changed files
with
58 additions
and
18 deletions.
There are no files selected for viewing
10 changes: 3 additions & 7 deletions
10
src/ExtendedXmlSerializer/ContentModel/Format/FormattedContent.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 |
---|---|---|
@@ -1,18 +1,14 @@ | ||
using System; | ||
using ExtendedXmlSerializer.Core.Sources; | ||
using System; | ||
|
||
namespace ExtendedXmlSerializer.ContentModel.Format | ||
{ | ||
sealed class FormattedContent<T> : IFormattedContent<T> | ||
{ | ||
readonly Func<IFormatWriter, IFormatter<T>> _source; | ||
|
||
public FormattedContent(Func<IFormatWriter, IFormatter<T>> source) | ||
{ | ||
_source = source; | ||
} | ||
public FormattedContent(Func<IFormatWriter, IFormatter<T>> source) => _source = source; | ||
|
||
public string Get(IFormatWriter writer, T instance) => _source(writer) | ||
.Get(instance); | ||
public string Get(IFormatWriter writer, T instance) => _source(writer).Get(instance); | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue528Tests.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,43 @@ | ||
using ExtendedXmlSerializer.Configuration; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Support; | ||
using FluentAssertions; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues | ||
{ | ||
public sealed class Issue528Tests | ||
{ | ||
[Fact] | ||
public void Verify() | ||
{ | ||
var instance = new ClassWithDictionary(); | ||
instance.Dict.Add("key",123); | ||
|
||
var configuration = new ConfigurationContainer(); | ||
var serializer = configuration.Create().ForTesting(); | ||
serializer.Cycle(instance).Should().BeEquivalentTo(instance); | ||
} | ||
|
||
public class ClassWithDictionary | ||
{ | ||
public ClassWithDictionary() | ||
{ | ||
Dict = new Dictionary<string, object>(); | ||
|
||
ListWithItems = new List<ClassWithProperty>(); | ||
ListWithItems.Add(new ClassWithProperty()); | ||
} | ||
|
||
public Dictionary<string,object> Dict { get; set; } | ||
|
||
public IList<ClassWithProperty> ListWithItems { get; set; } | ||
} | ||
|
||
public class ClassWithProperty | ||
{ | ||
public string Text { get; set; } | ||
} | ||
|
||
} | ||
} |