public void Create_WhenCertificateNull_Throws() { var exception = Assert.Throws <ArgumentNullException>( () => IssuerSerial.Create(certificate: null)); Assert.Equal("certificate", exception.ParamName); }
public void Create_WithCertificate_InitializesFields() { using (var certificate = _fixture.GetDefaultCertificate()) { var issuerSerial = IssuerSerial.Create(certificate); Assert.Equal(1, issuerSerial.GeneralNames.Count); Assert.Equal(certificate.IssuerName.Name, issuerSerial.GeneralNames[0].DirectoryName.Name); SignTestUtility.VerifySerialNumber(certificate, issuerSerial); } }
public void Create_WithLargePositiveSerialNumber_ReturnsIssuerSerial() { using (var certificate = SigningTestUtility.GenerateCertificate("test", generator => { generator.SetSerialNumber(BigInteger.ValueOf(long.MaxValue)); })) { var issuerSerial = IssuerSerial.Create(certificate); SignTestUtility.VerifySerialNumber(certificate, issuerSerial); } }
public void Create_WithSmallSerialNumber_ReturnsIssuerSerial() { using (var certificate = SigningTestUtility.GenerateCertificate("test", generator => { generator.SetSerialNumber(BigInteger.One); })) { var issuerSerial = IssuerSerial.Create(certificate); SignTestUtility.VerifySerialNumber(certificate, issuerSerial); } }
public void Create_WithLargePositiveSerialNumber_ReturnsIssuerSerial() { using (var certificate = SigningTestUtility.GenerateCertificate("test", generator => { var bytes = BitConverter.GetBytes(long.MaxValue); Array.Reverse(bytes); generator.SetSerialNumber(bytes); })) { var issuerSerial = IssuerSerial.Create(certificate); SigningTestUtility.VerifySerialNumber(certificate, issuerSerial); } }