avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject svn commit: rev 43430 - in avalon/trunk/central/laboratory/avalon-net/DynamicProxy: . Builder/CodeGenerators DynamicProxyTest DynamicProxyTest/ClassInterfaces
Date Mon, 06 Sep 2004 21:30:02 GMT
Author: hammett
Date: Mon Sep  6 14:30:01 2004
New Revision: 43430

Modified:
   avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
   avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
   avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ClassInterfaces/MyInterfaceImpl.cs
   avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ProxyGeneratorTestCase.cs
   avalon/trunk/central/laboratory/avalon-net/DynamicProxy/README.txt
Log:
More tests.

Modified: avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
==============================================================================
--- avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
(original)
+++ avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
Mon Sep  6 14:30:01 2004
@@ -105,7 +105,7 @@
 		{
 			foreach(Type inter in interfaces)
 			{
-				GenerateTypeImplementation(inter);
+				GenerateTypeImplementation(inter, false);
 			}
 		}
 
@@ -113,8 +113,9 @@
 		/// Iterates over the interfaces and generate implementation 
 		/// for each method in it.
 		/// </summary>
-		/// <param name="type">Interface type</param>
-		protected void GenerateTypeImplementation(Type type)
+		/// <param name="type">Type class</param>
+		/// <param name="ignoreInterfaces">Interface type</param>
+		protected void GenerateTypeImplementation(Type type, bool ignoreInterfaces )
 		{
 			if (m_generated.Contains(type))
 			{
@@ -125,9 +126,12 @@
 				m_generated.Add( type );
 			}
 
-			Type[] baseInterfaces = type.FindInterfaces(new TypeFilter(NoFilterImpl), type);
+			if (!ignoreInterfaces)
+			{
+				Type[] baseInterfaces = type.FindInterfaces(new TypeFilter(NoFilterImpl), type);
+				GenerateInterfaceImplementation(baseInterfaces);
+			}
 
-			GenerateInterfaceImplementation(baseInterfaces);
 			PropertyBuilder[] propertiesBuilder = GenerateProperties(type);
 			GenerateMethods(type, propertiesBuilder);
 		}

Modified: avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
==============================================================================
--- avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
(original)
+++ avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
Mon Sep  6 14:30:01 2004
@@ -26,7 +26,7 @@
 			// TODO: interfaces of base class
 			
 			CreateTypeBuilder( baseClass, new Type[0] );
-			GenerateTypeImplementation( baseClass );
+			GenerateTypeImplementation( baseClass, true );
 
 			return MainTypeBuilder.CreateType();
 		}

Modified: avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ClassInterfaces/MyInterfaceImpl.cs
==============================================================================
--- avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ClassInterfaces/MyInterfaceImpl.cs
(original)
+++ avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ClassInterfaces/MyInterfaceImpl.cs
Mon Sep  6 14:30:01 2004
@@ -54,12 +54,12 @@
 			}
 		}
 
-		public int Calc(int x, int y)
+		public virtual int Calc(int x, int y)
 		{
 			return x + y;
 		}
 
-		public int Calc(int x, int y, int z, Single k)
+		public virtual int Calc(int x, int y, int z, Single k)
 		{
 			return x + y + z + (int)k;
 		}

Modified: avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ProxyGeneratorTestCase.cs
==============================================================================
--- avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ProxyGeneratorTestCase.cs
(original)
+++ avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/ProxyGeneratorTestCase.cs
Mon Sep  6 14:30:01 2004
@@ -62,6 +62,21 @@
 		}
 
 		[Test]
+		public void ProxyForClassWhichImplementsInterfaces()
+		{
+			object proxy = ProxyGenerator.CreateClassProxy( 
+				typeof(MyInterfaceImpl), new ResultModifiedInvocationHandler( new MyInterfaceImpl() )
);
+			
+			AssertNotNull( proxy );
+			Assert( typeof(MyInterfaceImpl).IsAssignableFrom( proxy.GetType() ) );
+			Assert( typeof(IMyInterface).IsAssignableFrom( proxy.GetType() ) );
+
+			IMyInterface inter = (IMyInterface) proxy;
+
+			AssertEquals( 44, inter.Calc( 20, 25 ) );
+		}
+
+		[Test]
 		public void ProxyingClassWithoutVirtualMethods()
 		{
 			object proxy = ProxyGenerator.CreateClassProxy( 

Modified: avalon/trunk/central/laboratory/avalon-net/DynamicProxy/README.txt
==============================================================================
--- avalon/trunk/central/laboratory/avalon-net/DynamicProxy/README.txt	(original)
+++ avalon/trunk/central/laboratory/avalon-net/DynamicProxy/README.txt	Mon Sep  6 14:30:01
2004
@@ -20,7 +20,7 @@
 
 NUnit is not a requirement as NAnt already includes it. 
 We cannot provide them for you due to licensing issues.
-Nant is a 100% .NET implmented build tool inspired by
+Nant is a 100% .NET implemented build tool inspired by
 ANT (http://ant.apache.org).  It is licensed under the
 GPL, but if you install it separately as a tool (preferred)
 then all is well.  NUnit is a testing framework inspired

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message