Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Proxy
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17146
Modified Files:
AbstractProxyTypeBuilderTests.cs
Log Message:
Refactored Stan D. contribution [SPRNET-606]
Index: AbstractProxyTypeBuilderTests.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Proxy/AbstractProxyTypeBuilderTests.cs,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** AbstractProxyTypeBuilderTests.cs 31 Jul 2007 23:37:48 -0000 1.17
--- AbstractProxyTypeBuilderTests.cs 3 Dec 2007 09:07:54 -0000 1.18
***************
*** 23,28 ****
--- 23,30 ----
using System;
using System.Reflection;
+ using System.Reflection.Emit;
using System.Collections;
using System.Diagnostics;
+ using System.Web.Services;
using System.Runtime.InteropServices;
***************
*** 65,70 ****
--- 67,74 ----
builder.TargetType = typeof(MarkerClass);
builder.TypeAttributes = new Attribute[] { new MarkerAttribute() };
+
Type proxy = builder.BuildProxyType();
Assert.IsNotNull(proxy, "The proxy generated by a (valid) call to BuildProxy() was null.");
+
object[] atts = proxy.GetCustomAttributes(false);
Assert.IsNotNull(atts, "Should have had 1 custom attribute applied to the generated proxy type.");
***************
*** 205,208 ****
--- 209,236 ----
}
+ // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=161522
+ // should not fail
+ // Use CustomAttributeData if patch applied (.NET 2.0 SP1).
+ // Use Attribute instance if patch not applied (.NET 2.0 SP1).
+ [Test]
+ public void ProxyWebServiceAttribute()
+ {
+ IProxyTypeBuilder builder = GetProxyBuilder();
+ builder.TargetType = typeof(ClassWithWebServiceAttribute);
+
+ Type proxy = builder.BuildProxyType();
+ Assert.IsNotNull(proxy, "The proxy generated by a (valid) call to BuildProxy() was null.");
+
+ object[] attrs = proxy.GetCustomAttributes(false);
+ Assert.IsNotNull(attrs, "Should have had 1 attribute applied to the target type.");
+ Assert.AreEqual(1, attrs.Length, "Should have had 1 attribute applied to the target type.");
+ Assert.AreEqual(typeof(WebServiceAttribute), attrs[0].GetType(), "Wrong System.Type of Attribute applied to the target type.");
+
+ WebServiceAttribute wsa = attrs[0] as WebServiceAttribute;
+ Assert.AreEqual("blah", wsa.Name);
+ Assert.AreEqual("http://mynamespace.com", wsa.Namespace);
+ }
+
+
[Test]
public void ProxyTargetTypeAttributes()
***************
*** 598,601 ****
--- 626,635 ----
}
+ // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=161522
+ [WebService(Namespace = "http://mynamespace.com", Name = "blah")]
+ public class ClassWithWebServiceAttribute : IMarkerInterface
+ {
+ }
+
[FakeGenerateScriptType("ScriptName")]
public class ClassWithFakeGenerateScriptTypeAttribute : IMarkerInterface
|