using dk.nsi.seal.Federation; using NUnit.Framework; using SealTest.Certificate; namespace SealTest.IntegrationTests; [TestFixture(typeof(CertificateOces3Voces), "DK", "Testorganisation nr. 94354969", "UI:DK-O:G:c70b0207-162e-4d3d-a7f1-a19a8e07d99b", "VOCES_gyldig")] [TestFixture(typeof(CertificateOces3MocesCpr), "DK", "Testorganisation nr. 91026150", "UI:DK-E:G:dc7f4a98-d4f9-4d77-84f9-ae83c4e0bf61", "Thormund Nissen")] public class DistinguishedNameTest where CERTIFICATE : ICertificate, new() { private readonly string expectedCountry; private readonly string expectedOrganisation; private readonly string expectedSerial; private readonly string expectedCommonName; private CERTIFICATE certificate; private Oces3DistinguishedName distinguishedNameFromX500DistinguishedName; private Oces3DistinguishedName distinguishedNameFromString; public DistinguishedNameTest(string expectedCountry, string expectedOrganisation, string expectedSerial, string expectedCommonName) { this.expectedCountry = expectedCountry; this.expectedOrganisation = expectedOrganisation; this.expectedSerial = expectedSerial; this.expectedCommonName = expectedCommonName; certificate = new CERTIFICATE(); } [SetUp] public void setup() { distinguishedNameFromX500DistinguishedName = new Oces3DistinguishedName(certificate.Certificate.SubjectName); distinguishedNameFromString = new Oces3DistinguishedName(certificate.Certificate.SubjectName.Name); } [Test] public void TestParseDistinguishedNameFromCertificate() { var dn = distinguishedNameFromX500DistinguishedName; Assert.AreEqual(expectedCountry, dn.Country); Assert.AreEqual(expectedOrganisation, dn.Organization); Assert.AreEqual(expectedSerial, dn.SubjectSerialNumber); Assert.AreEqual(expectedCommonName, dn.CommonName); } [Test] public void TestParseDistinguishedNameFromString() { var dn = distinguishedNameFromString; Assert.AreEqual(expectedCountry, dn.Country); Assert.AreEqual(expectedOrganisation, dn.Organization); Assert.AreEqual(expectedSerial, dn.SubjectSerialNumber); Assert.AreEqual(expectedCommonName, dn.CommonName); } }