public void CanCreatePolicyWithPrivateConstructor() { var factory = new ContractLoadBalancePolicyFactory <TestPolicyPrivateCtor>(); var policy = factory.CreatePolicies(new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo") } }); }
public void CanCreatePolicyWithPrivateConstructor() { var factory = new ContractLoadBalancePolicyFactory<TestPolicyPrivateCtor>(); var policy = factory.CreatePolicies(new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo") } }); }
public void WillCreatePolicyPerContract() { var roundRobinFactory = new ContractLoadBalancePolicyFactory<RoundRobinPolicy>(); var endpoint = new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo"), new XmlQualifiedName("bar") } }; var policies = roundRobinFactory.CreatePolicies(endpoint); Assert.AreEqual(2, policies.Length); }
public void WillCreatePolicyPerContract() { var roundRobinFactory = new ContractLoadBalancePolicyFactory <RoundRobinPolicy>(); var endpoint = new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo"), new XmlQualifiedName("bar") } }; var policies = roundRobinFactory.CreatePolicies(endpoint); Assert.AreEqual(2, policies.Length); }
public void CanCreatePolicyFactory() { var roundRobinFactory = new ContractLoadBalancePolicyFactory<RoundRobinPolicy>(); var endpoint = new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo") } }; var policies = roundRobinFactory.CreatePolicies(endpoint); Assert.AreEqual(1, policies.Length); Assert.IsInstanceOf<RoundRobinPolicy>(policies[0]); Assert.IsNull(policies[0].ChooseTarget()); }
public void WillAcceptEndpointsSupportingContract() { var roundRobinFactory = new ContractLoadBalancePolicyFactory<RoundRobinPolicy>(); var endpoint = new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo") } }; var policies = roundRobinFactory.CreatePolicies(endpoint); Assert.IsTrue(policies[0].RegisterTarget(new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo") } })); }
public void CanCreatePolicyFactory() { var roundRobinFactory = new ContractLoadBalancePolicyFactory <RoundRobinPolicy>(); var endpoint = new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo") } }; var policies = roundRobinFactory.CreatePolicies(endpoint); Assert.AreEqual(1, policies.Length); Assert.IsInstanceOf <RoundRobinPolicy>(policies[0]); Assert.IsNull(policies[0].ChooseTarget()); }
public void WillRejectEndpointsNotSupportingContract() { var roundRobinFactory = new ContractLoadBalancePolicyFactory <RoundRobinPolicy>(); var endpoint = new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("foo") } }; var policies = roundRobinFactory.CreatePolicies(endpoint); Assert.IsFalse(policies[0].RegisterTarget(new EndpointDiscoveryMetadata { ContractTypeNames = { new XmlQualifiedName("bar") } })); }