public void Constructors () { var de = CreateDynamicEndpoint (); var be = new DiscoveryClientBindingElement (de.DiscoveryEndpointProvider, de.FindCriteria); Assert.IsNotNull (be.FindCriteria, "#1"); Assert.IsNotNull (be.DiscoveryEndpointProvider, "#2"); var die = be.DiscoveryEndpointProvider.GetDiscoveryEndpoint (); Assert.AreEqual (DiscoveryVersion.WSDiscovery11, die.DiscoveryVersion, "#3"); Assert.IsTrue (die is UdpDiscoveryEndpoint, "#3-2"); Assert.AreEqual (ServiceDiscoveryMode.Adhoc, die.DiscoveryMode, "#4"); Assert.AreEqual ("urn:docs-oasis-open-org:ws-dd:ns:discovery:2009:01", die.Address.Uri.ToString (), "#5"); Assert.IsNotNull (die.Contract, "#6"); Assert.AreEqual ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01", die.Contract.Namespace, "#6-2"); Assert.AreEqual ("TargetService", die.Contract.Name, "#6-3"); // could be either IPv4 or IPv6 Assert.AreEqual (new UdpDiscoveryEndpoint ().MulticastAddress, die.ListenUri, "#7"); Assert.AreEqual (ListenUriMode.Explicit, die.ListenUriMode, "#8"); // FIXME: enable (but the number should not matter; the functionality should rather matter. Those behaviors are internal in .NET) // Assert.AreEqual (5, die.Behaviors.Count, "#9"); // default constructor be = new DiscoveryClientBindingElement (); Assert.IsNotNull (be.FindCriteria, "#11"); Assert.IsNotNull (be.DiscoveryEndpointProvider, "#12"); die = be.DiscoveryEndpointProvider.GetDiscoveryEndpoint (); Assert.AreEqual (DiscoveryVersion.WSDiscovery11, die.DiscoveryVersion, "#13"); Assert.IsTrue (die is UdpDiscoveryEndpoint, "#13-2"); }
public void BuildChannelFactory_OnlyTransport() { var be = new DiscoveryClientBindingElement(); var bc = new BindingContext(new CustomBinding(new HttpTransportBindingElement()), new BindingParameterCollection()); be.BuildChannelFactory <IRequestChannel> (bc); }
void UseCase1Core(Uri serviceUri, AnnouncementEndpoint aEndpoint, DiscoveryEndpoint dEndpoint) { // actual service, announcing to 4989 var host = new ServiceHost(typeof(TestService)); var sdb = new ServiceDiscoveryBehavior(); sdb.AnnouncementEndpoints.Add(aEndpoint); host.Description.Behaviors.Add(sdb); host.AddServiceEndpoint(typeof(ITestService), new BasicHttpBinding(), serviceUri); host.Open(); // It does not start announcement very soon, so wait for a while. Thread.Sleep(1000); try { // actual client, with DiscoveryClientBindingElement var be = new DiscoveryClientBindingElement() { DiscoveryEndpointProvider = new SimpleDiscoveryEndpointProvider(dEndpoint) }; var clientBinding = new CustomBinding(new BasicHttpBinding()); clientBinding.Elements.Insert(0, be); var cf = new ChannelFactory <ITestService> (clientBinding, DiscoveryClientBindingElement.DiscoveryEndpointAddress); var ch = cf.CreateChannel(); Assert.AreEqual("TEST", ch.Echo("TEST"), "#1"); cf.Close(); } finally { host.Close(); } }
void UseCase1Core (Uri serviceUri, AnnouncementEndpoint aEndpoint, DiscoveryEndpoint dEndpoint) { // actual service, announcing to 4989 var host = new ServiceHost (typeof (TestService)); var sdb = new ServiceDiscoveryBehavior (); sdb.AnnouncementEndpoints.Add (aEndpoint); host.Description.Behaviors.Add (sdb); host.AddServiceEndpoint (typeof (ITestService), new BasicHttpBinding (), serviceUri); host.Open (); // It does not start announcement very soon, so wait for a while. Thread.Sleep (1000); foreach (var edm in host.Extensions.Find<DiscoveryServiceExtension> ().PublishedEndpoints) TextWriter.Null.WriteLine ("Published Endpoint: " + edm.Address); try { // actual client, with DiscoveryClientBindingElement var be = new DiscoveryClientBindingElement () { DiscoveryEndpointProvider = new ManagedDiscoveryEndpointProvider (dEndpoint) }; var clientBinding = new CustomBinding (new BasicHttpBinding ()); clientBinding.Elements.Insert (0, be); var cf = new ChannelFactory<ITestService> (clientBinding, DiscoveryClientBindingElement.DiscoveryEndpointAddress); var ch = cf.CreateChannel (); Assert.AreEqual ("TEST", ch.Echo ("TEST"), "#1"); } finally { host.Close (); } }
protected internal override BindingElement CreateBindingElement() { var be = new DiscoveryClientBindingElement(); ApplyConfiguration(be); return(be); }
public void CanBuildChannels() { var de = CreateDynamicEndpoint(); // it is channel dependent - i.e. this binding element does not affect. var be = new DiscoveryClientBindingElement(de.DiscoveryEndpointProvider, de.FindCriteria); var bc = new BindingContext(new CustomBinding(new TcpTransportBindingElement()), new BindingParameterCollection()); Assert.IsTrue(be.CanBuildChannelFactory <IDuplexSessionChannel> (bc), "#0"); Assert.IsFalse(be.CanBuildChannelFactory <IDuplexChannel> (bc), "#1"); Assert.IsFalse(be.CanBuildChannelFactory <IOutputChannel> (bc), "#2"); Assert.IsFalse(be.CanBuildChannelFactory <IRequestChannel> (bc), "#3"); // It always return false. Assert.IsFalse(be.CanBuildChannelListener <IDuplexSessionChannel> (bc), "#4"); // false! Assert.IsFalse(be.CanBuildChannelListener <IDuplexChannel> (bc), "#5"); Assert.IsFalse(be.CanBuildChannelListener <IRequestChannel> (bc), "#6"); Assert.IsFalse(be.CanBuildChannelListener <IReplyChannel> (bc), "#7"); bc = new BindingContext(new CustomBinding(new HttpTransportBindingElement()), new BindingParameterCollection()); Assert.IsFalse(be.CanBuildChannelFactory <IDuplexSessionChannel> (bc), "#10"); Assert.IsFalse(be.CanBuildChannelFactory <IDuplexChannel> (bc), "#11"); Assert.IsFalse(be.CanBuildChannelFactory <IOutputChannel> (bc), "#12"); Assert.IsTrue(be.CanBuildChannelFactory <IRequestChannel> (bc), "#13"); // It always return false. Assert.IsFalse(be.CanBuildChannelListener <IDuplexSessionChannel> (bc), "#14"); Assert.IsFalse(be.CanBuildChannelListener <IDuplexChannel> (bc), "#15"); Assert.IsFalse(be.CanBuildChannelListener <IRequestChannel> (bc), "#16"); Assert.IsFalse(be.CanBuildChannelListener <IReplyChannel> (bc), "#17"); }
public void Constructors() { var de = CreateDynamicEndpoint(); var be = new DiscoveryClientBindingElement(de.DiscoveryEndpointProvider, de.FindCriteria); Assert.IsNotNull(be.FindCriteria, "#1"); Assert.IsNotNull(be.DiscoveryEndpointProvider, "#2"); var die = be.DiscoveryEndpointProvider.GetDiscoveryEndpoint(); Assert.AreEqual(DiscoveryVersion.WSDiscovery11, die.DiscoveryVersion, "#3"); Assert.IsTrue(die is UdpDiscoveryEndpoint, "#3-2"); Assert.AreEqual(ServiceDiscoveryMode.Adhoc, die.DiscoveryMode, "#4"); Assert.AreEqual("urn:docs-oasis-open-org:ws-dd:ns:discovery:2009:01", die.Address.Uri.ToString(), "#5"); Assert.IsNotNull(die.Contract, "#6"); Assert.AreEqual("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01", die.Contract.Namespace, "#6-2"); Assert.AreEqual("TargetService", die.Contract.Name, "#6-3"); // could be either IPv4 or IPv6 Assert.AreEqual(new UdpDiscoveryEndpoint().MulticastAddress, die.ListenUri, "#7"); Assert.AreEqual(ListenUriMode.Explicit, die.ListenUriMode, "#8"); // FIXME: enable (but the number should not matter; the functionality should rather matter. Those behaviors are internal in .NET) // Assert.AreEqual (5, die.Behaviors.Count, "#9"); // default constructor be = new DiscoveryClientBindingElement(); Assert.IsNotNull(be.FindCriteria, "#11"); Assert.IsNotNull(be.DiscoveryEndpointProvider, "#12"); die = be.DiscoveryEndpointProvider.GetDiscoveryEndpoint(); Assert.AreEqual(DiscoveryVersion.WSDiscovery11, die.DiscoveryVersion, "#13"); Assert.IsTrue(die is UdpDiscoveryEndpoint, "#13-2"); }
protected internal override BindingElement CreateBindingElement() { DiscoveryClientBindingElement discoveryClientBindingElement = new DiscoveryClientBindingElement(); this.ApplyConfiguration(discoveryClientBindingElement); return(discoveryClientBindingElement); }
public void RequestChannelOpenFails2() { var be = new DiscoveryClientBindingElement(); var bc = new BindingContext(new CustomBinding(be, new TcpTransportBindingElement()), new BindingParameterCollection()); var cf = be.BuildChannelFactory <IDuplexSessionChannel> (bc); cf.Open(); var ch = cf.CreateChannel(DiscoveryClientBindingElement.DiscoveryEndpointAddress); ch.Open(TimeSpan.FromSeconds(80)); }
public void BuildChannelFactory_CreateNonDynamicUriChannel() { var be = new DiscoveryClientBindingElement(); var bc = new BindingContext(new CustomBinding(be, new HttpTransportBindingElement()), new BindingParameterCollection()); var cf = be.BuildChannelFactory <IRequestChannel> (bc); cf.Open(); var uri = new Uri("http://localhost:37564"); cf.CreateChannel(new EndpointAddress(uri)); }
public void BuildChannelFactory() { var be = new DiscoveryClientBindingElement(); var bc = new BindingContext(new CustomBinding(be, new HttpTransportBindingElement()), new BindingParameterCollection()); var cf = be.BuildChannelFactory <IRequestChannel> (bc); cf.Open(); var ch = cf.CreateChannel(DiscoveryClientBindingElement.DiscoveryEndpointAddress); Assert.AreEqual(DiscoveryClientBindingElement.DiscoveryEndpointAddress, ch.RemoteAddress, "#1"); }
public void GetProperty() { var be = new DiscoveryClientBindingElement(); var bc = new BindingContext(new CustomBinding(new HttpTransportBindingElement()), new BindingParameterCollection()); // so, they are not part of GetProperty<T>() return values. Assert.IsNull(be.GetProperty <FindCriteria> (bc), "#1"); Assert.IsNull(be.GetProperty <DiscoveryEndpointProvider> (bc), "#2"); Assert.IsNull(be.GetProperty <DiscoveryEndpoint> (bc), "#3"); }
static void UseCase1Core (Uri serviceUri, DiscoveryEndpoint dEndpoint) { // actual client, with DiscoveryClientBindingElement var be = new DiscoveryClientBindingElement () { DiscoveryEndpointProvider = new ManagedDiscoveryEndpointProvider (dEndpoint) }; var clientBinding = new CustomBinding (new BasicHttpBinding ()); clientBinding.Elements.Insert (0, be); clientBinding.SendTimeout = TimeSpan.FromSeconds (10); clientBinding.ReceiveTimeout = TimeSpan.FromSeconds (10); var cf = new ChannelFactory<ITestService> (clientBinding, DiscoveryClientBindingElement.DiscoveryEndpointAddress); var ch = cf.CreateChannel (); Console.WriteLine (ch.Echo ("TEST")); }
public void RequestChannelOpenFails() { var be = new DiscoveryClientBindingElement(); var bc = new BindingContext(new CustomBinding(be, new HttpTransportBindingElement()), new BindingParameterCollection()); var cf = be.BuildChannelFactory <IRequestChannel> (bc); cf.Open(); Assert.IsNull(cf.GetProperty <DiscoveryEndpoint> (), "#1"); var ch = cf.CreateChannel(DiscoveryClientBindingElement.DiscoveryEndpointAddress); Assert.IsNull(ch.GetProperty <DiscoveryEndpoint> (), "#2"); ch.Open(TimeSpan.FromSeconds(80)); }
public void CanBuildChannels () { var de = CreateDynamicEndpoint (); // it is channel dependent - i.e. this binding element does not affect. var be = new DiscoveryClientBindingElement (de.DiscoveryEndpointProvider, de.FindCriteria); var bc = new BindingContext (new CustomBinding (new TcpTransportBindingElement ()), new BindingParameterCollection ()); Assert.IsTrue (be.CanBuildChannelFactory<IDuplexSessionChannel> (bc), "#0"); Assert.IsFalse (be.CanBuildChannelFactory<IDuplexChannel> (bc), "#1"); bc = new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), new BindingParameterCollection ()); Assert.IsTrue (be.CanBuildChannelFactory<IRequestChannel> (bc), "#2"); Assert.IsFalse (be.CanBuildChannelFactory<IDuplexSessionChannel> (bc), "#3"); }
static CustomBinding CreateCustomBindingWithDiscoveryElement() { DiscoveryClientBindingElement discoveryBindingElement = new DiscoveryClientBindingElement(); // Provide the search criteria and the endpoint over which the probe will be sent discoveryBindingElement.FindCriteria = new FindCriteria(typeof(ICalculatorService)); discoveryBindingElement.DiscoveryEndpointProvider = new UdpDiscoveryEndpointProvider(); CustomBinding customBinding = new CustomBinding(new NetTcpBinding()); // Insert DiscoveryClientBindingElement at the top of the BindingElement stack. // An exception will be thrown if this binding element is not at the top customBinding.Elements.Insert(0, discoveryBindingElement); return customBinding; }
static CustomBinding CreateCustomBindingWithDiscoveryElement() { DiscoveryClientBindingElement discoveryBindingElement = new DiscoveryClientBindingElement(); // Provide the search criteria and the endpoint over which the probe will be sent discoveryBindingElement.FindCriteria = new FindCriteria(typeof(ICalculatorService)); discoveryBindingElement.DiscoveryEndpointProvider = new UdpDiscoveryEndpointProvider(); CustomBinding customBinding = new CustomBinding(new NetTcpBinding()); // Insert DiscoveryClientBindingElement at the top of the BindingElement stack. // An exception will be thrown if this binding element is not at the top customBinding.Elements.Insert(0, discoveryBindingElement); return(customBinding); }
static void UseCase1Core(Uri serviceUri, DiscoveryEndpoint dEndpoint) { // actual client, with DiscoveryClientBindingElement var be = new DiscoveryClientBindingElement() { DiscoveryEndpointProvider = new ManagedDiscoveryEndpointProvider(dEndpoint) }; var clientBinding = new CustomBinding(new BasicHttpBinding()); clientBinding.Elements.Insert(0, be); clientBinding.SendTimeout = TimeSpan.FromSeconds(10); clientBinding.ReceiveTimeout = TimeSpan.FromSeconds(10); var cf = new ChannelFactory <ITestService> (clientBinding, DiscoveryClientBindingElement.DiscoveryEndpointAddress); var ch = cf.CreateChannel(); Console.WriteLine(ch.Echo("TEST")); }
public void RequestChannelOpenFails2() { var be = new DiscoveryClientBindingElement(); // (The comment on RequestChannelOpenFails() applies here too.) be.FindCriteria.Duration = TimeSpan.FromSeconds(3); var bc = new BindingContext(new CustomBinding(be, new TcpTransportBindingElement()), new BindingParameterCollection()); var cf = be.BuildChannelFactory <IDuplexSessionChannel> (bc); cf.Open(); var ch = cf.CreateChannel(DiscoveryClientBindingElement.DiscoveryEndpointAddress); var sw = Stopwatch.StartNew(); ch.Open(TimeSpan.FromSeconds(5)); Assert.IsTrue(sw.Elapsed < TimeSpan.FromSeconds(15), "It is likely that FindCriteria.Duration is ignored"); }
public override void ApplyConfiguration(BindingElement bindingElement) { base.ApplyConfiguration(bindingElement); DiscoveryClientBindingElement discoveryClientBindingElement = (DiscoveryClientBindingElement)bindingElement; if (PropertyValueOrigin.Default == this.ElementInformation.Properties[ConfigurationStrings.Endpoint].ValueOrigin) { discoveryClientBindingElement.DiscoveryEndpointProvider = new ConfigurationDiscoveryEndpointProvider(); } else { discoveryClientBindingElement.DiscoveryEndpointProvider = new ConfigurationDiscoveryEndpointProvider(this.DiscoveryEndpoint); } this.FindCriteria.ApplyConfiguration(discoveryClientBindingElement.FindCriteria); }
public void CustomDiscoveryEndpointProvider() { var be = new DiscoveryClientBindingElement() { DiscoveryEndpointProvider = new MyDiscoveryEndpointProvider() }; var bc = new BindingContext(new CustomBinding(be, new HttpTransportBindingElement()), new BindingParameterCollection()); var cf = be.BuildChannelFactory <IRequestChannel> (bc); cf.Open(); var ch = cf.CreateChannel(DiscoveryClientBindingElement.DiscoveryEndpointAddress); try { ch.Open(); Assert.Fail("Should try to use failing endpoint provider."); } catch (MyException) { } }
public DynamicEndpoint(ContractDescription contract, Binding binding) : base(contract, binding, DiscoveryClientBindingElement.DiscoveryEndpointAddress) { if (binding == null) { throw FxTrace.Exception.ArgumentNull("binding"); } this.discoveryClientBindingElement = new DiscoveryClientBindingElement(); if (this.ValidateAndInsertDiscoveryClientBindingElement(binding)) { this.FindCriteria.ContractTypeNames.Add( new XmlQualifiedName(contract.Name, contract.Namespace)); } else { throw FxTrace.Exception.Argument( "binding", SR.DiscoveryClientBindingElementPresentInDynamicEndpoint); } }
public void RequestChannelOpenFails() { var be = new DiscoveryClientBindingElement(); // Note that this explicitly sets shorter timeout than open timeout for the channel. // If it is longer, then TimeoutException will occur instgead, // as the client doesn't expect longer than FindCriteria.Duration. be.FindCriteria.Duration = TimeSpan.FromSeconds(3); var bc = new BindingContext(new CustomBinding(be, new HttpTransportBindingElement()), new BindingParameterCollection()); var cf = be.BuildChannelFactory <IRequestChannel> (bc); cf.Open(); Assert.IsNull(cf.GetProperty <DiscoveryEndpoint> (), "#1"); var ch = cf.CreateChannel(DiscoveryClientBindingElement.DiscoveryEndpointAddress); Assert.IsNull(ch.GetProperty <DiscoveryEndpoint> (), "#2"); var sw = Stopwatch.StartNew(); ch.Open(TimeSpan.FromSeconds(5)); Assert.IsTrue(sw.Elapsed < TimeSpan.FromSeconds(15), "It is likely that FindCriteria.Duration is ignored"); }
protected internal override BindingElement CreateBindingElement() { DiscoveryClientBindingElement discoveryClientBindingElement = new DiscoveryClientBindingElement(); this.ApplyConfiguration(discoveryClientBindingElement); return discoveryClientBindingElement; }
public void BuildChannelFactory () { var be = new DiscoveryClientBindingElement (); var bc = new BindingContext (new CustomBinding (be, new HttpTransportBindingElement ()), new BindingParameterCollection ()); var cf = be.BuildChannelFactory<IRequestChannel> (bc); cf.Open (); var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress); Assert.AreEqual (DiscoveryClientBindingElement.DiscoveryEndpointAddress, ch.RemoteAddress, "#1"); }
internal DynamicEndpoint(ContractDescription contract) : base(contract, null, DiscoveryClientBindingElement.DiscoveryEndpointAddress) { this.discoveryClientBindingElement = new DiscoveryClientBindingElement(); }
public void RequestChannelOpenFails2 () { var be = new DiscoveryClientBindingElement (); var bc = new BindingContext (new CustomBinding (be, new TcpTransportBindingElement ()), new BindingParameterCollection ()); var cf = be.BuildChannelFactory<IDuplexSessionChannel> (bc); cf.Open (); var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress); ch.Open (); }
static void Main(string[] args) { var discoveryClient = new DiscoveryClientBindingElement(); }
public void BuildChannelFactory_CreateNonDynamicUriChannel () { var be = new DiscoveryClientBindingElement (); var bc = new BindingContext (new CustomBinding (be, new HttpTransportBindingElement ()), new BindingParameterCollection ()); var cf = be.BuildChannelFactory<IRequestChannel> (bc); cf.Open (); var uri = new Uri ("http://localhost:37564"); cf.CreateChannel (new EndpointAddress (uri)); }
public void CustomDiscoveryEndpointProvider () { var be = new DiscoveryClientBindingElement () { DiscoveryEndpointProvider = new MyDiscoveryEndpointProvider () }; var bc = new BindingContext (new CustomBinding (be, new HttpTransportBindingElement ()), new BindingParameterCollection ()); var cf = be.BuildChannelFactory<IRequestChannel> (bc); cf.Open (); var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress); try { ch.Open (); Assert.Fail ("Should try to use failing endpoint provider."); } catch (MyException) { } }
public void GetProperty () { var be = new DiscoveryClientBindingElement (); var bc = new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), new BindingParameterCollection ()); // so, they are not part of GetProperty<T>() return values. Assert.IsNull (be.GetProperty<FindCriteria> (bc), "#1"); Assert.IsNull (be.GetProperty<DiscoveryEndpointProvider> (bc), "#2"); Assert.IsNull (be.GetProperty<DiscoveryEndpoint> (bc), "#3"); }
public void RequestChannelOpenFails () { var be = new DiscoveryClientBindingElement (); var bc = new BindingContext (new CustomBinding (be, new HttpTransportBindingElement ()), new BindingParameterCollection ()); var cf = be.BuildChannelFactory<IRequestChannel> (bc); cf.Open (); Assert.IsNull (cf.GetProperty<DiscoveryEndpoint> (), "#1"); var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress); Assert.IsNull (ch.GetProperty<DiscoveryEndpoint> (), "#2"); ch.Open (); }
public void RequestChannelOpenFails () { var be = new DiscoveryClientBindingElement (); // Note that this explicitly sets shorter timeout than open timeout for the channel. // If it is longer, then TimeoutException will occur instgead, // as the client doesn't expect longer than FindCriteria.Duration. be.FindCriteria.Duration = TimeSpan.FromSeconds (3); var bc = new BindingContext (new CustomBinding (be, new HttpTransportBindingElement ()), new BindingParameterCollection ()); var cf = be.BuildChannelFactory<IRequestChannel> (bc); cf.Open (); Assert.IsNull (cf.GetProperty<DiscoveryEndpoint> (), "#1"); var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress); Assert.IsNull (ch.GetProperty<DiscoveryEndpoint> (), "#2"); DateTime start = DateTime.Now; ch.Open (TimeSpan.FromSeconds (5)); Assert.IsTrue (DateTime.Now - start < TimeSpan.FromSeconds (15), "It is likely that FindCriteria.Duration is ignored"); }
public void BuildChannelFactory_OnlyTransport () { var be = new DiscoveryClientBindingElement (); var bc = new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), new BindingParameterCollection ()); be.BuildChannelFactory<IRequestChannel> (bc); }
protected internal override BindingElement CreateBindingElement () { var be = new DiscoveryClientBindingElement (); ApplyConfiguration (be); return be; }
public void RequestChannelOpenFails2 () { var be = new DiscoveryClientBindingElement (); // (The comment on RequestChannelOpenFails() applies here too.) be.FindCriteria.Duration = TimeSpan.FromSeconds (3); var bc = new BindingContext (new CustomBinding (be, new TcpTransportBindingElement ()), new BindingParameterCollection ()); var cf = be.BuildChannelFactory<IDuplexSessionChannel> (bc); cf.Open (); var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress); DateTime start = DateTime.Now; ch.Open (TimeSpan.FromSeconds (5)); Assert.IsTrue (DateTime.Now - start < TimeSpan.FromSeconds (15), "It is likely that FindCriteria.Duration is ignored"); }