Skip to content

Commit

Permalink
Fixed Issue 613 with ReaderFormatter returning wrong object name
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoHilmert authored and Mike-E-angelo committed Mar 23, 2024
1 parent 7c6245a commit e82c063
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ sealed class ReaderFormatter : IReaderFormatter

ReaderFormatter() {}

public string Get(IFormatReader parameter) => ((System.Xml.XmlReader)parameter.Get()).Name;
public string Get(IFormatReader parameter) => ((System.Xml.XmlReader)parameter.Get()).LocalName;
}
}
39 changes: 39 additions & 0 deletions test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue613Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using ExtendedXmlSerializer.Configuration;
using ExtendedXmlSerializer.Tests.ReportedIssues.Support;
using FluentAssertions;
using Xunit;

namespace ExtendedXmlSerializer.Tests.ReportedIssues
{
public sealed class Issue613Tests
{
[Fact]
public void Verify()
{
var serializer = new ConfigurationContainer().Type<BaseNamespace.Container>()
.AddMigration(EmptyMigration.Default)
.Create()
.ForTesting();

var container = new BaseNamespace.Container();
container.Content.Add(new InheritNamespace.Inherit() { Check = new BaseNamespace.BaseCheck() });
container.Content.Add(new BaseNamespace.Base() { Check = new InheritNamespace.InheritCheck() });
serializer.Cycle(container).Should().BeEquivalentTo(container);
}

[Fact]
public void VerifyWithoutMigration()
{
var serializer = new ConfigurationContainer().Type<BaseNamespace.Container>()
.Create()
.ForTesting();

var container = new BaseNamespace.Container();
container.Content.Add(new InheritNamespace.Inherit() { Check = new BaseNamespace.BaseCheck() });
container.Content.Add(new BaseNamespace.Base() { Check = new InheritNamespace.InheritCheck() });
serializer.Cycle(container).Should().BeEquivalentTo(container);
}

}
}

0 comments on commit e82c063

Please sign in to comment.