/// <summary> /// will populate database with cert records from metadata project; cleans db prior to ensure fresh results /// </summary> protected void InitCertRecords() { List <string> certs = CertFiles.ToList <string>(); CertificateManager mgr = new CertificateManager(new ConfigStore(ConnectionString)); mgr.RemoveAll(); foreach (string s in certs) { mgr.Add(LoadAndVerifyCertFromFile(s)); } }
public void AddTest1() { CertificateManager target = CreateManager(); target.RemoveAll(); List <Certificate> certs = GetCleanEnumerable <Certificate>(TestCertificates); target.Add(certs); Certificate[] actual = target.Get(0, MAXCERTPEROWNER * MAXDOMAINCOUNT + 1); Assert.Equal(certs.Count(), actual.Length); }
public void AddTest2(Certificate cert) { CertificateManager target = CreateManager(); target.RemoveAll(); target.Add(cert); Certificate certNew = target.Get(1); //---should always be 1 (table was truncated above); Assert.NotNull(cert); Assert.Equal(cert.Owner, certNew.Owner); Assert.Equal(cert.Thumbprint, certNew.Thumbprint); }
public void AddTest(Certificate cert) { using (ConfigDatabase db = CreateConfigDatabase()) { CertificateManager target = CreateManager(); target.RemoveAll(); target.Add(db, cert); db.SubmitChanges(); Certificate certNew = target.Get(1); //---should always be 1 (table was truncated above); Assert.NotNull(cert); Assert.Equal(cert.Owner, certNew.Owner); Assert.Equal(cert.Thumbprint, certNew.Thumbprint); } }
/// <summary> /// This method will clean, load and verify Certificate records based on the certs stored in the /// metadata\certs folder into the db for testing purposes /// </summary> /// <param name="mgr">CertificateManager instance used for controlling the Certificate records</param> /// <param name="db">ConfigDatabase instance used as the target storage mechanism for the records</param> /// <remarks> /// this approach goes out to db each time it is called, however it ensures that clean records /// are present for every test that is execute, if it is taking too long, simply cut down on the /// number of items using the consts above /// </remarks> protected void InitCertRecords(CertificateManager mgr , ConfigDatabase db) { mgr.RemoveAll(db); for (int i = 1; i <= MAXDOMAINCOUNT; i++) { //---------------------------------------------------------------------------------------------------- //---cheezy but will add MAXCERTPEROWNER certs per each relative domain for (int t = 1; t <= MAXCERTPEROWNER; t++) { mgr.Add(GetCertificateFromTestCertPfx(i, t)); } } }