1 #if !MOBILE && !MONOMAC
4 using System.ServiceModel;
5 using System.ServiceModel.Activation;
6 using System.ServiceModel.Channels;
7 using System.ServiceModel.Web;
10 namespace MonoTests.System.ServiceModel.Activation
12 class MyHostFactory : WebScriptServiceHostFactory
14 public ServiceHost DoCreateServiceHost (Type type, params Uri [] baseAddresses)
16 return CreateServiceHost (type, baseAddresses);
21 public class WebScriptServiceHostFactoryTest
24 public void CreateServiceHost ()
26 var f = new MyHostFactory ();
27 var host = f.DoCreateServiceHost (typeof (TestService), new Uri [] {new Uri ("http://localhost:37564")});
28 Assert.IsFalse (host is WebServiceHost, "#1");
34 [ExpectedException (typeof (NotSupportedException))]
35 public void ResponseWrappedIsInvalid ()
37 var f = new MyHostFactory ();
38 var host = f.DoCreateServiceHost (typeof (TestService2), new Uri [] {new Uri ("http://localhost:37564")});
39 host.Open (); // should raise an error here.
43 [ExpectedException (typeof (InvalidOperationException))]
44 public void MultipleContract ()
46 var f = new MyHostFactory ();
47 var host = f.DoCreateServiceHost (typeof (TestServiceMultiple), new Uri [] {new Uri ("http://localhost:37564")});
54 public interface ITestService
57 string DoWork (string s1, string s2);
60 public class TestService : ITestService
62 public string DoWork (string s1, string s2)
69 public interface ITestService2
72 [WebGet (BodyStyle = WebMessageBodyStyle.WrappedResponse)]
73 string DoWork (string s1, string s2);
76 public class TestService2 : ITestService2
78 public string DoWork (string s1, string s2)
84 public class TestServiceMultiple : ITestService, ITestService2
86 public string DoWork (string s1, string s2)