public void DefaultConfiguration() { Poker host = new Poker(); host.OnApplyConfiguration += delegate(object sender, EventArgs e) { Assert.AreEqual(1, host.Description.Behaviors.Count, "Description.Behaviors.Count #1"); }; host.CallInitializeDescription(); Assert.AreEqual(true, host.Description.Behaviors.Count > 1, "Description.Behaviors.Count #2"); Assert.IsNotNull(host.Description.Behaviors.Find <ServiceDebugBehavior> (), "ServiceDebugBehavior"); Assert.IsNotNull(host.Description.Behaviors.Find <ServiceAuthorizationBehavior> (), "ServiceDebugBehavior"); Assert.IsNotNull(host.Authorization, "Authorization #1"); Assert.AreEqual(host.Description.Behaviors.Find <ServiceAuthorizationBehavior> (), host.Authorization, "Authorization #2"); }
public void InitializeRuntime() { Poker host = new Poker(); host.CallInitializeDescription(); EndpointAddress address = new EndpointAddress("http://localhost:8090/"); ContractDescription contract = ContractDescription.GetContract(typeof(IMyContract)); ServiceEndpoint endpoint = new ServiceEndpoint(contract, new BasicHttpBinding(), address); endpoint.ListenUri = address.Uri; host.Description.Endpoints.Add(endpoint); Assert.AreEqual(0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1"); host.CallInitializeRuntime(); Assert.AreEqual(1, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1"); Assert.AreEqual(CommunicationState.Created, host.ChannelDispatchers [0].State, "ChannelDispatchers.Count #1"); }