public void DeletePolicyTest() { CertPolicyManager mgr = CreateManager(); CertPolicy policy = mgr.Get("Policy2"); mgr.Remove(policy.ID); mgr.Get("Policy2").Should().BeNull(); }
public void GetPolicyByName() { CertPolicyManager mgr = CreateManager(); CertPolicy policy = mgr.Get("Policy1"); policy.Name.Should().BeEquivalentTo("Policy1"); }
public void UpdatePolicyDescriptionTest() { CertPolicyManager mgr = CreateManager(); CertPolicy newCertPolicy = new CertPolicy("UnitTestPolicy", "UnitTest Policy Description", "1 = 1".ToBytesUtf8()); mgr.Add(newCertPolicy); CertPolicy actualCertPolicy = mgr.Get("UnitTestPolicy"); actualCertPolicy.Should().NotBeNull(); actualCertPolicy.Description = "blank"; mgr.Update(actualCertPolicy); CertPolicy updatedCertPolicy = mgr.Get("UnitTestPolicy"); updatedCertPolicy.Description.ShouldBeEquivalentTo("blank"); }
public void UpdatePolicyDataTest() { CertPolicyManager mgr = CreateManager(); CertPolicy newCertPolicy = new CertPolicy("UnitTestPolicy", "UnitTest Policy Description", "1 = 1".ToBytesUtf8()); mgr.Add(newCertPolicy); CertPolicy actualCertPolicy = mgr.Get("UnitTestPolicy"); actualCertPolicy.Should().NotBeNull(); actualCertPolicy.Data = "1 != 1".ToBytesUtf8(); mgr.Update(actualCertPolicy); CertPolicy updatedCertPolicy = mgr.Get("UnitTestPolicy"); updatedCertPolicy.Data.ToUtf8String().ShouldAllBeEquivalentTo("1 != 1"); }
public void DeletePolicyWithAssociations() { CertPolicyGroupManager groupMgr = CreatePolicyGroupManager(); CertPolicyGroup policyGroup = groupMgr.Get("PolicyGroup1"); policyGroup.CertPolicies.Count.Should().Be(0); CertPolicyManager policyMgr = CreateManager(); policyMgr.Get("Policy1").Should().NotBeNull(); groupMgr.AddPolicyUse("Policy1", "PolicyGroup1", CertPolicyUse.PRIVATE_RESOLVER, true, true); policyGroup = groupMgr.Get("PolicyGroup1"); policyGroup.CertPolicies.Count.Should().Be(1); CertPolicyManager mgr = CreateManager(); CertPolicy policy = mgr.Get("Policy1"); mgr.Remove(policy.ID); policyMgr.Get("Policy1").Should().BeNull(); }
public void AddPolicy() { CertPolicyManager mgr = CreateManager(); CertPolicy expectedPolicy = new CertPolicy("UnitTestPolicy", "", "1 = 1".ToBytesUtf8()); mgr.Add(expectedPolicy); CertPolicy actualCertPolicy = mgr.Get("UnitTestPolicy"); expectedPolicy.Name.Should().BeEquivalentTo("UnitTestPolicy"); expectedPolicy.CreateDate.Should().BeCloseTo(actualCertPolicy.CreateDate); }
public void AssociatePolicyToGroupSessionTest() { InitCertPolicyRecords(); InitCertPolicyGroupRecords(); using (ConfigDatabase db = CreateConfigDatabase(CertPolicyGroupManager.DataLoadOptions)) { CertPolicyGroupManager mgr = CreateManager(); CertPolicyGroup policyGroup = mgr.Get(db, "PolicyGroup1"); policyGroup.CertPolicies.Count.Should().Be(0); CertPolicyManager policyMgr = CreatePolicyManager(); CertPolicy certPolicy = policyMgr.Get("Policy1"); policyGroup.CertPolicies.Add(certPolicy); db.SubmitChanges(); policyGroup = mgr.Get("PolicyGroup1"); policyGroup.CertPolicies.Count.Should().Be(1); } }