public void ShouldAddRuleViaWCF() { ChannelFactory <IPolicyStore> factory = new ChannelFactory <IPolicyStore>(new BasicHttpBinding(), new EndpointAddress("http://localhost:3333/policystore")); IPolicyStore store = factory.CreateChannel(); var scope = store.RetrieveScopes().ElementAt(0); InputPolicyClaim inputClaim = new InputPolicyClaim(scope.Issuers.ElementAt(0), scope.ClaimTypes.ElementAt(0), "thevalue"); OutputPolicyClaim outputClaim = new OutputPolicyClaim(scope.ClaimTypes.ElementAt(0), CopyFromConstants.InputValue); PolicyRule rule = new PolicyRule(AssertionsMatch.All, new[] { inputClaim }, outputClaim); store.AddPolicyRule(scope.Uri, rule); var updatedScope = store.RetrieveScopes().ElementAt(0); Assert.AreEqual(3, updatedScope.Rules.Count()); }
public void ShouldRetriveScopeViaWCF() { ChannelFactory <IPolicyStore> factory = new ChannelFactory <IPolicyStore>(new BasicHttpBinding(), new EndpointAddress("http://localhost:3333/policystore")); IPolicyStore store = factory.CreateChannel(); var scopes = store.RetrieveScopes(); Assert.AreEqual(1, scopes.Count()); Assert.AreEqual(2, scopes.ElementAt(0).Rules.Count()); }