Пример #1
0
        public void CertificateSubject_ToString_CommonNameOnly_CreatesValidDistinguishedName()
        {
            string             commonName = "domain.com";
            string             expectedDn = String.Format("CN={0}", commonName);
            CertificateSubject subject    = new CertificateSubject(commonName);

            string dn = subject.ToString();

            Assert.AreEqual(expectedDn, dn);
        }
Пример #2
0
        public void CertificateSubject_ToString_CommonNameDepartmentOrganization_CreatesValidDistinguishedName()
        {
            string commonName   = "domain.com";
            string department   = "engineering";
            string organization = "microsoft";
            string expectedDn   = String.Format("CN={0},OU={1},O={2}", commonName, department, organization);

            CertificateSubject subject = new CertificateSubject(commonName, department, organization);

            string dn = subject.ToString();

            Assert.AreEqual(expectedDn, dn);
        }
Пример #3
0
        public void CertificateSubject_ToString_FactoryCreateFromDistinguishedName_CreatesValidDistinguishedName()
        {
            string commonName   = "domain.com";
            string department   = "engineering";
            string organization = "microsoft";
            string city         = "redmond";
            string state        = "WA";
            string country      = "US";

            string inputDn = String.Format("CN={0},OU={1},O={2},L={3},S={4},C={5}", commonName, department, organization, city, state, country);

            CertificateSubject subject = CertificateSubject.CreateFromDistinguishedName(inputDn);

            string resultDn = subject.ToString();

            Assert.AreEqual(inputDn, resultDn);
        }
Пример #4
0
        public void CertificateSubject_ToString_AllComponents_CreatesValidDistinguishedName()
        {
            string commonName   = "domain.com";
            string department   = "engineering";
            string organization = "microsoft";
            string city         = "redmond";
            string state        = "WA";
            string country      = "US";

            string expectedDn = String.Format("CN={0},OU={1},O={2},L={3},S={4},C={5}", commonName, department, organization, city, state, country);

            CertificateSubject subject = new CertificateSubject(commonName, department, organization, city, state, country);

            string dn = subject.ToString();

            Assert.AreEqual(expectedDn, dn);
        }