Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Objects/TypeConverters
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17585/Spring/Spring.Core.Tests/Objects/TypeConverters
Added Files:
RuntimeTypeConverterTests.cs
Log Message:
Unit tests for the all of the new classes added in the previous commit.
--- NEW FILE: RuntimeTypeConverterTests.cs ---
#region Licence
/*
* Copyright 2004 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NUnit.Framework;
#endregion
namespace Spring.Objects.TypeConverters {
/// <summary>
/// Unit tests for the RuntimeTypeConverter class.
/// </summary>
[TestFixture]
public class RuntimeTypeConverterTests {
[Test]
public void CanConvertFrom () {
RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
Assert.IsTrue (cnv.CanConvertFrom (typeof (string)), "Mmm... I can't convert froma string to a Type, which is the main point of this custom converter. :(");
Assert.IsFalse (cnv.CanConvertFrom (GetType ()), "Mmm... managed to convert top a Type from a Type of this test. Boing!");
}
[Test]
public void ConvertFromString ()
{
RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
object foo = cnv.ConvertFrom ("System.String");
Assert.IsNotNull (foo);
Assert.AreEqual ("System.RuntimeType", foo.GetType ().FullName);
}
[Test]
public void ConvertToString ()
{
RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
object foo = cnv.ConvertTo (typeof (string), typeof (string));
Assert.IsNotNull (foo);
Assert.AreEqual (typeof (string).AssemblyQualifiedName, foo);
}
}
}
|