SPRNET-989 - Avoid throwing exception in Spring's custom timespan converter when delegating to default .NET BCL implementation.

Thanks Roberto Paterlini!
This commit is contained in:
markpollack
2009-11-13 04:49:45 +00:00
parent 8b687e7d3f
commit cc6c10b0f9
2 changed files with 233 additions and 21 deletions

View File

@@ -21,7 +21,7 @@
#region Imports
using System;
using System.Reflection;
using NUnit.Framework;
#endregion
@@ -113,10 +113,16 @@ namespace Spring.Core.TypeConversion
public void ConvertFromStringWithHourSpecifier()
{
TimeSpanConverter tsc = new TimeSpanConverter();
object timeSpan = tsc.ConvertFrom("1H");
Assert.IsNotNull(timeSpan);
Assert.IsTrue(timeSpan is TimeSpan);
Assert.AreEqual(TimeSpan.FromHours(1), (TimeSpan)timeSpan);
tsc.ConvertFrom("1h");
Assert.IsNotNull(timeSpan);
Assert.IsTrue(timeSpan is TimeSpan);
Assert.AreEqual(TimeSpan.FromHours(1), (TimeSpan)timeSpan);
}
[Test]