Handling wrong date format from XmlRpc clients

http://orchard.codeplex.com/workitem/16623

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-11-16 15:14:03 -08:00
parent 8150b36dde
commit 50da9410f5
2 changed files with 21 additions and 2 deletions
@@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Xml.Linq;
using NUnit.Framework;
using Orchard.Core.XmlRpc.Models;
@@ -87,6 +88,18 @@ namespace Orchard.Tests.Modules.XmlRpc.Services {
}
[Test]
public void StructShouldMapDefaultDateTimeWithBadFormat() {
var source = XElement.Parse(@"
<struct>
<member><name>seven</name><value><dateTime.iso8601>FOO</dateTime.iso8601></value></member>
</struct>");
var xmlStruct = _structMapper.Map(source);
Assert.That(xmlStruct["seven"], Is.GreaterThan(DateTime.Now.AddSeconds(-1)));
Assert.That(xmlStruct["seven"], Is.LessThan(DateTime.Now.AddSeconds(1)));
}
[Test]
public void ArrayShouldBringDataItemsWithCorrectType() {
var source = XElement.Parse(@"