Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28257
Modified Files:
ExpressionEvaluatorTests.cs
Log Message:
additional fix for SPRNET-499 (enable static inherited method calls)
Index: ExpressionEvaluatorTests.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions/ExpressionEvaluatorTests.cs,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** ExpressionEvaluatorTests.cs 24 Aug 2007 22:44:26 -0000 1.66
--- ExpressionEvaluatorTests.cs 26 Aug 2007 02:00:00 -0000 1.67
***************
*** 622,630 ****
Assert.AreEqual(typeof (DateTime), exp.GetValue());
! Assert.AreEqual(typeof (DateTime), ExpressionEvaluator.GetValue(null, "T(System.DateTime)"));
! Assert.AreEqual(typeof (DateTime[]), ExpressionEvaluator.GetValue(null, "T(System.DateTime[], mscorlib)"));
! Assert.AreEqual(typeof (ExpressionEvaluator),
! ExpressionEvaluator.GetValue(null, "T(Spring.Expressions.ExpressionEvaluator, Spring.Core)"));
! Assert.IsTrue((bool) ExpressionEvaluator.GetValue(tesla, "T(System.DateTime) == DOB.GetType()"));
}
--- 622,639 ----
Assert.AreEqual(typeof (DateTime), exp.GetValue());
! Assert.AreEqual(typeof(DateTime), ExpressionEvaluator.GetValue(null, "T(System.DateTime)"));
! Assert.AreEqual(typeof(DateTime[]), ExpressionEvaluator.GetValue(null, "T(System.DateTime[], mscorlib)"));
! Assert.AreEqual(typeof(ExpressionEvaluator), ExpressionEvaluator.GetValue(null, "T(Spring.Expressions.ExpressionEvaluator, Spring.Core)"));
! Assert.IsTrue((bool)ExpressionEvaluator.GetValue(tesla, "T(System.DateTime) == DOB.GetType()"));
! }
!
! /// <summary>
! /// Tests type node
! /// </summary>
! [Test]
! [Ignore("does not work yet due to parser expecting ID production within T(ID)")]
! public void TestTypeNodeWithAssemblyQualifiedName()
! {
! Assert.AreEqual(typeof(ExpressionEvaluator), ExpressionEvaluator.GetValue(null, string.Format("T({0})", typeof(ExpressionEvaluator).AssemblyQualifiedName)));
}
***************
*** 2549,2552 ****
--- 2558,2574 ----
Assert.AreEqual("Hello World", ExpressionEvaluator.GetValue(testClass, "#root.GetString()"));
}
+
+ [Test]
+ public void TestStaticInheritedMethodInvocation()
+ {
+ Assert.AreEqual("Hello Static World from SingleMethodTestClass", DerivedSingleMethodTestClass.StaticMethod());
+ Assert.AreEqual("Hello Static World from SingleMethodTestClass", ExpressionEvaluator.GetValue(null, string.Format("T({0}).StaticMethod()", typeof(DerivedSingleMethodTestClass).FullName)));
+
+ Assert.AreEqual("SingleMethodTestClass.ShadowedStaticMethod", SingleMethodTestClass.ShadowedStaticMethod());
+ Assert.AreEqual("DerivedSingleMethodTestClass.ShadowedStaticMethod", DerivedSingleMethodTestClass.ShadowedStaticMethod());
+ Assert.AreEqual("SingleMethodTestClass.ShadowedStaticMethod", ExpressionEvaluator.GetValue(null, string.Format("T({0}).ShadowedStaticMethod()", typeof(SingleMethodTestClass).FullName)));
+ Assert.AreEqual("DerivedSingleMethodTestClass.ShadowedStaticMethod", ExpressionEvaluator.GetValue(null, string.Format("T({0}).ShadowedStaticMethod()", typeof(DerivedSingleMethodTestClass).FullName)));
+ }
+
#endregion
***************
*** 2572,2585 ****
internal class SingleMethodTestClass
{
! public string GetString()
! {
! return "Hello World";
! }
}
internal class DerivedSingleMethodTestClass : SingleMethodTestClass
{
!
}
--- 2594,2624 ----
internal class SingleMethodTestClass
{
! protected static string GetMethodName(MethodBase method)
! {
! return method.DeclaringType.Name + "." + method.Name;
! }
!
! public static string StaticMethod()
! {
! return "Hello Static World from SingleMethodTestClass";
! }
+ public static string ShadowedStaticMethod()
+ {
+ return GetMethodName(MethodInfo.GetCurrentMethod());
+ }
+
+ public string GetString()
+ {
+ return "Hello World";
+ }
}
internal class DerivedSingleMethodTestClass : SingleMethodTestClass
{
! public new static string ShadowedStaticMethod()
! {
! return GetMethodName(MethodInfo.GetCurrentMethod());
! }
}
|