public void SetUp() { TestHelper.LoadConfig(); serviceHost = new TCWcfServiceHost( typeof(HermesAuthorizationService), DemoEndPointAddress); BasicHttpBinding binding = new BasicHttpBinding(); ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); behavior.HttpGetEnabled = true; serviceHost.Description.Behaviors.Add(behavior); serviceHost.AddServiceEndpoint( typeof(IAuthorization), binding, ""); serviceHost.Open(); }
public void Test2() { TestHelper.LoadConfig(); serviceHost = new TCWcfServiceHost( typeof(HermesAuthorizationService), DemoEndPointAddress); BasicHttpBinding binding = new BasicHttpBinding(); ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); behavior.HttpGetEnabled = true; serviceHost.Description.Behaviors.Add(behavior); serviceHost.AddServiceEndpoint( typeof(IAuthorization), binding, ""); serviceHost.Open(); client = HermesAuthorizationServiceClient.GetClient(); Assert.IsTrue(client.CheckEntity("1", "101", "SomeEntity1", Rights.Read), "entity1 should have read rights."); Assert.IsFalse(client.CheckEntity("1", "101", "SomeEntity2", Rights.Read), "entity2 should not have read rights."); }