First I would like to thank you for accepting my bug report #14 .
I've installed the new package and updated my code, however, I've noticed that one of my tests is now failing.
When populating the email field, the objects are populated correctly, however, the final serialized XML doesn't contain the value unless we access it first. On first look, it looks like something with the Lazy evaluation.
Here's a short snippet. In case I un-comment the var x = ... line, the code works fine and the Does.Contain assertion is successful. But in case we don't evaluate the emails and just call serialize, the final XML doesn't contain that information.
// Here the address has email set to "ben@example.com"
var otAddress = new OpenTransSharp.Address
{
...
Emails = addressInformation.ContactInfo.Emails != null ? addressInformation.ContactInfo.Emails.Select(s => new Email
{
EmailAddress = s
}).ToList() : null,
...
};
// var x = otAddress.Emails.First().EmailAddress;
var options = new OpenTransXmlSerializerOptions();
var serializerFactory = new OpenTransXmlSerializerFactory(options);
var serializer = serializerFactory.Create<OpenTransSharp.Address>();
string serializedContent = serializer.Serialize(otAddress);
Assert.Multiple(() =>
{
Assert.That(serializedContent, Is.Not.Null);
Assert.That(serializedContent, Does.Contain("ben@example.com"));
});
First I would like to thank you for accepting my bug report #14 .
I've installed the new package and updated my code, however, I've noticed that one of my tests is now failing.
When populating the email field, the objects are populated correctly, however, the final serialized XML doesn't contain the value unless we access it first. On first look, it looks like something with the Lazy evaluation.
Here's a short snippet. In case I un-comment the var x = ... line, the code works fine and the Does.Contain assertion is successful. But in case we don't evaluate the emails and just call serialize, the final XML doesn't contain that information.