-
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 problem with implicit type/optimized namespace scenarios. (#546)
- Loading branch information
1 parent
44a9b2f
commit 8e702ea
Showing
3 changed files
with
119 additions
and
52 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
73 changes: 73 additions & 0 deletions
73
test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue545Tests.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,73 @@ | ||
using ExtendedXmlSerializer.Configuration; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Support; | ||
using FluentAssertions; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues | ||
{ | ||
public sealed class Issue545Tests | ||
{ | ||
[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); | ||
} | ||
|
||
[Fact] | ||
public void VerifyImplicitTyping() | ||
{ | ||
var instance = new ClassWithDictionary(); | ||
instance.Dict.Add("key",123); | ||
|
||
var configuration = new ConfigurationContainer().EnableImplicitTyping(typeof(ClassWithDictionary)); | ||
var serializer = configuration.Create().ForTesting(); | ||
|
||
//serializer.WriteLine(instance); | ||
|
||
serializer.Cycle(instance).Should().BeEquivalentTo(instance); | ||
} | ||
|
||
[Fact] | ||
public void VerifyOptimizedImplicitTyping() | ||
{ | ||
var instance = new ClassWithDictionary(); | ||
instance.Dict.Add("key",123); | ||
|
||
var configuration = new ConfigurationContainer().UseOptimizedNamespaces().EnableImplicitTyping(typeof(ClassWithDictionary)); | ||
var serializer = configuration.Create().ForTesting(); | ||
|
||
//serializer.WriteLine(instance); | ||
|
||
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; } | ||
} | ||
|
||
} | ||
} |
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