Skip to content

Commit

Permalink
Merge c560a2a into 02adccc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-E-angelo authored Aug 14, 2020
2 parents 02adccc + c560a2a commit 30e1efc
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue427Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using ExtendedXmlSerializer.Configuration;
using ExtendedXmlSerializer.Tests.ReportedIssues.Support;
using FluentAssertions;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace ExtendedXmlSerializer.Tests.ReportedIssues
{
public sealed class Issue427Tests
{
[Fact]
public void Verify()
{
var config = new NewFieldInfo(FieldType.OptionSet)
{
Name = "ASDF",
TargetName = "What?"
};
var element = new[] {config};

var serializer = new ConfigurationContainer().UseOptimizedNamespaces()
.EnableImplicitTypingFromPublicNested<Issue427Tests>()
.EnableParameterizedContentWithPropertyAssignments()
.Create()
.ForTesting();

serializer.Cycle(config).Should().BeEquivalentTo(config);
serializer.Cycle(element).Should().BeEquivalentTo(element.Cast<NewFieldInfo>());

}

public class ExistingOptionSetFieldInfo : NewFieldInfo
{
public ExistingOptionSetFieldInfo() : base(FieldType.OptionSet)
{
IsExistsOnSource = true;
}

public bool IsExistsOnSource { get; protected set; }

public string OptionSetName { get; set; }
}

public enum FieldType
{
OptionSet
}

public class NewFieldInfo
{
public NewFieldInfo(FieldType type)
{
Type = type;
}

public FieldType Type { get; }

public string Name { get; set; }

public string Description { get; set; } = null;

public bool IsRequired { get; set; }

public string TargetName { get; set; }

public bool ShouldCreateFieldOnTarget { get; set; }
}

public class NewOptionSetFieldInfo : ExistingOptionSetFieldInfo
{
public NewOptionSetFieldInfo()
{
IsExistsOnSource = false;
}

public Dictionary<int, string> Values { get; } = new Dictionary<int, string>();
}

}
}

0 comments on commit 30e1efc

Please sign in to comment.