-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Hey,
I think there is an issue with xml Serialization of bool. a boolean
IsCool = true
when serialized, the value becomes
True
I don't think this is valid (I'm using openrasta which won't deserialize this...) Further, I think the valid version of booleans according to xml schema are: true and false
here's a test:
[Fact]
public void Can_serialize_simple_POCO_With_XmlFormat_Specified()
{
var poco = new Person
{
Name = "Foo",
Age = 50,
Price = 19.95m,
StartDate = new DateTime(2009, 12, 18, 10, 2, 23),
IsCool = false
};
var xml = new XmlSerializer();
xml.DateFormat = DateFormat.Iso8601;
var doc = xml.Serialize(poco);
var expected = GetSimplePocoXDocWithXmlProperty();
Assert.Equal(expected.ToString(), doc.ToString());
}
private XDocument GetSimplePocoXDocWithXmlProperty()
{
var doc = new XDocument();
var root = new XElement("Person");
root.Add(new XElement("Name", "Foo"),
new XElement("Age", 50),
new XElement("Price", 19.95m),
new XElement("StartDate", new DateTime(2009, 12, 18, 10, 2, 23).ToString("s")),
new XElement("IsCool", false));
doc.Add(root);
return doc;
}
Not sure what the policy is with fixes, but I will chuck across a pull request too...
Metadata
Metadata
Assignees
Labels
No labels