return host;
}
+#if NET_4_0
+ [Test]
+ public void AddServiceEndpoint_Directly ()
+ {
+ var host = new ServiceHost (typeof (DummyService));
+ var address = new EndpointAddress ("http://localhost:8080");
+ var binding = new BasicHttpBinding ();
+ var contract = ContractDescription.GetContract (typeof (IDummyService));
+ host.AddServiceEndpoint (new ServiceEndpoint (contract, binding, address));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddServiceEndpoint_Directly_NullAddress ()
+ {
+ var host = new ServiceHost (typeof (DummyService));
+ var binding = new BasicHttpBinding ();
+ var contract = ContractDescription.GetContract (typeof (IDummyService));
+ host.AddServiceEndpoint (new ServiceEndpoint (contract, binding, null));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddServiceEndpoint_Directly_NullBinding ()
+ {
+ var host = new ServiceHost (typeof (DummyService));
+ var address = new EndpointAddress ("http://localhost:8080");
+ var contract = ContractDescription.GetContract (typeof (IDummyService));
+ host.AddServiceEndpoint (new ServiceEndpoint (contract, null, address));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddServiceMetadataEndpoint ()
+ {
+ var host = new ServiceHost (typeof (DummyService));
+ host.AddServiceEndpoint (new ServiceMetadataEndpoint ());
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void AddServiceEndpoint_Directly_ContractMismatch ()
+ {
+ var host = new ServiceHost (typeof (DummyService));
+ var address = new EndpointAddress ("http://localhost:8080");
+ var binding = new BasicHttpBinding ();
+ var contract = ContractDescription.GetContract (typeof (INotImplementedService));
+ host.AddServiceEndpoint (new ServiceEndpoint (contract, binding, address));
+ }
+#endif
+
#region helpers
public enum Stage