-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2823 from Particular/hotfix-5.0.5
XmlSerializer now serializes properties of `object` type properly
- Loading branch information
Showing
5 changed files
with
62 additions
and
20 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
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,41 @@ | ||
namespace NServiceBus.Core.Tests.Serializers.XML | ||
{ | ||
using System; | ||
using System.IO; | ||
using NServiceBus.Serializers.XML.Test; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class Issue_2796 | ||
{ | ||
[Test] | ||
public void Object_property_with_primitive_or_struct_value_should_serialize_correctly() | ||
{ | ||
var serializer = SerializerFactory.Create<SerializedPair>(); | ||
var message = new SerializedPair | ||
{ | ||
Key = "AddressId", | ||
Value = new Guid("{ebdeeb33-baa7-4100-b1aa-eb4d6816fd3d}") | ||
}; | ||
|
||
object[] messageDeserialized; | ||
using (Stream stream = new MemoryStream()) | ||
{ | ||
serializer.Serialize(message, stream); | ||
|
||
stream.Position = 0; | ||
|
||
messageDeserialized = serializer.Deserialize(stream, new[] { message.GetType() }); | ||
} | ||
|
||
Assert.AreEqual(message.Key, ((SerializedPair)messageDeserialized[0]).Key); | ||
Assert.AreEqual(message.Value, ((SerializedPair)messageDeserialized[0]).Value); | ||
} | ||
|
||
public class SerializedPair | ||
{ | ||
public string Key { get; set; } | ||
public object Value { 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
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
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