diff --git a/TameMyCerts.Tests/CertificateContentValidatorTests.cs b/TameMyCerts.Tests/CertificateContentValidatorTests.cs
index bad9af8..6f95c34 100644
--- a/TameMyCerts.Tests/CertificateContentValidatorTests.cs
+++ b/TameMyCerts.Tests/CertificateContentValidatorTests.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
+using System.Security.AccessControl;
using System.Security.Principal;
using TameMyCerts.Enums;
using TameMyCerts.Models;
@@ -185,8 +186,8 @@ public void Does_add_static_RDN_when_not_present()
PrintResult(result);
- Assert.True(result.CertificateProperties.Any(x =>
- x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization]) && x.Value.Equals("ADCS Labor")));
+ Assert.Contains("ADCS Labor", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization])).Select(x => x.Value));
+
}
[Fact]
@@ -236,8 +237,7 @@ public void Does_not_add_static_RDN_when_present_and_not_forced()
PrintResult(result);
- Assert.False(result.CertificateProperties.Any(x =>
- x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization]) && x.Value.Equals("ADCS Labor")));
+ Assert.DoesNotContain("ADCS Labor", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization])).Select(x => x.Value));
}
[Fact]
@@ -288,8 +288,7 @@ public void Does_add_static_RDN_when_present_and_forced()
PrintResult(result);
- Assert.True(result.CertificateProperties.Any(x =>
- x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization]) && x.Value.Equals("ADCS Labor")));
+ Assert.Contains("ADCS Labor", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization])).Select(x => x.Value));
}
[Fact]
@@ -307,7 +306,7 @@ public void Does_return_if_already_denied()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.NTE_FAIL));
+ Assert.Equal(WinError.NTE_FAIL, result.StatusCode);
}
[Fact]
@@ -335,7 +334,7 @@ public void Does_not_add_static_RDN_when_length_constraint_was_violated()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.CERTSRV_E_TEMPLATE_DENIED));
+ Assert.Equal(WinError.CERTSRV_E_TEMPLATE_DENIED, result.StatusCode);
}
@@ -364,7 +363,7 @@ public void Does_add_static_RDN_when_length_constraint_was_not_violated()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
}
[Fact]
@@ -392,10 +391,8 @@ public void Does_transfer_RDN_to_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization]))
- .Any(x => x.Value.Equals("intranet.adcslabor.de")));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
+ Assert.Contains("intranet.adcslabor.de", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization])).Select(x => x.Value));
}
[Fact]
@@ -430,13 +427,20 @@ public void Does_transfer_RDN_to_RDN_and_clears_original_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
- Assert.True(result.CertificateProperties.ContainsKey(RdnTypes.NameProperty[RdnTypes.CommonName]) &&
- result.CertificateProperties[RdnTypes.NameProperty[RdnTypes.CommonName]]
- .Equals(string.Empty));
- Assert.True(result.CertificateProperties.ContainsKey(RdnTypes.NameProperty[RdnTypes.Organization]) &&
- result.CertificateProperties[RdnTypes.NameProperty[RdnTypes.Organization]]
- .Equals("intranet.adcslabor.de"));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
+
+ Assert.Multiple(() =>
+ {
+ Assert.Contains(RdnTypes.NameProperty[RdnTypes.CommonName], result.CertificateProperties.Keys.ToList());
+ Assert.Empty(result.CertificateProperties[RdnTypes.NameProperty[RdnTypes.CommonName]]);
+ }
+ );
+ Assert.Multiple(() =>
+ {
+ Assert.Contains(RdnTypes.NameProperty[RdnTypes.Organization], result.CertificateProperties.Keys.ToList());
+ Assert.Equal("intranet.adcslabor.de", result.CertificateProperties[RdnTypes.NameProperty[RdnTypes.Organization]]);
+ }
+ );
}
[Fact]
@@ -464,11 +468,13 @@ public void Does_transfer_RDN_to_SAN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
- Assert.True(
- result.CertificateExtensions.ContainsKey(WinCrypt.szOID_SUBJECT_ALT_NAME2) &&
- Convert.ToBase64String(result.CertificateExtensions[WinCrypt.szOID_SUBJECT_ALT_NAME2])
- .Equals("MBeCFWludHJhbmV0LmFkY3NsYWJvci5kZQ=="));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
+ Assert.Multiple(() =>
+ {
+ Assert.Contains(WinCrypt.szOID_SUBJECT_ALT_NAME2, result.CertificateExtensions.Keys.ToList());
+ Assert.Equal("MBeCFWludHJhbmV0LmFkY3NsYWJvci5kZQ==", Convert.ToBase64String(result.CertificateExtensions[WinCrypt.szOID_SUBJECT_ALT_NAME2]));
+ }
+ );
}
[Fact]
@@ -497,10 +503,8 @@ public void Does_transfer_inline_RDN_to_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization]))
- .Any(x => x.Value.Equals("intranet.adcslabor.de")));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
+ Assert.Contains("intranet.adcslabor.de", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.Organization])).Select(x => x.Value));
}
[Fact]
@@ -559,10 +563,8 @@ public void Does_transfer_inline_custom_RDN_to_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName]))
- .Any(x => x.Value.Equals("test")));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
+ Assert.Contains("test", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName])).Select(x => x.Value));
}
[Fact]
@@ -591,7 +593,7 @@ public void Does_transfer_inline_RDN_to_SAN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
Assert.True(
result.CertificateExtensions.ContainsKey(WinCrypt.szOID_SUBJECT_ALT_NAME2) &&
Convert.ToBase64String(result.CertificateExtensions[WinCrypt.szOID_SUBJECT_ALT_NAME2])
@@ -648,10 +650,8 @@ public void Does_transfer_SAN_to_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName]))
- .Any(x => x.Value.Equals("intranet.adcslabor.de")));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
+ Assert.Contains("intranet.adcslabor.de", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName])).Select(x => x.Value));
}
[Fact]
@@ -679,7 +679,7 @@ public void Does_not_add_static_RDN_when_field_is_invalid()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.CERTSRV_E_TEMPLATE_DENIED));
+ Assert.Equal(WinError.CERTSRV_E_TEMPLATE_DENIED, result.StatusCode);
}
[Fact]
@@ -858,10 +858,13 @@ public void Does_add_static_SAN_when_present_and_forced()
PrintResult(result);
- Assert.True(
- result.CertificateExtensions.ContainsKey(WinCrypt.szOID_SUBJECT_ALT_NAME2) &&
- Convert.ToBase64String(result.CertificateExtensions[WinCrypt.szOID_SUBJECT_ALT_NAME2])
- .Equals(expectedResult));
+ Assert.Multiple(() =>
+ {
+ Assert.Contains(WinCrypt.szOID_SUBJECT_ALT_NAME2, result.CertificateExtensions.Keys.ToList());
+ Assert.Equal(expectedResult, Convert.ToBase64String(result.CertificateExtensions[WinCrypt.szOID_SUBJECT_ALT_NAME2]));
+ }
+ );
+
}
@@ -943,10 +946,7 @@ public void Allow_and_add_one_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName]))
- .Any(x => x.Value.Equals("rudi@intra.adcslabor.de"))
- );
+ Assert.Contains("rudi@intra.adcslabor.de", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName])).Select(x => x.Value));
}
[Fact]
@@ -975,10 +975,7 @@ public void Allow_and_add_one_RDN_CI()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName]))
- .Any(x => x.Value.Equals("rudi@intra.adcslabor.de"))
- );
+ Assert.Contains("rudi@intra.adcslabor.de", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName])).Select(x => x.Value));
}
[Fact]
@@ -1007,8 +1004,8 @@ public void Does_recognize_and_deny_valid_name_for_unknown_attribute()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.CERTSRV_E_TEMPLATE_DENIED));
- Assert.True(string.Join("\n", result.Description.ToList()).Contains("test-attribute"));
+ Assert.Equal(WinError.CERTSRV_E_TEMPLATE_DENIED, result.StatusCode);
+ Assert.Contains("test-attribute", string.Join("\n", result.Description.ToList()));
}
[Fact]
@@ -1065,10 +1062,7 @@ public void Allow_and_add_one_combined_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName]))
- .Any(x => x.Value.Equals("Ratlos, Rudi"))
- );
+ Assert.Contains("Ratlos, Rudi", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName])).Select(x => x.Value));
}
[Fact]
@@ -1097,10 +1091,7 @@ public void Allow_and_add_one_combined_RDN_with_twice_the_same_value()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.CertificateProperties
- .Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName]))
- .Any(x => x.Value.Equals("Rudi is Rudi"))
- );
+ Assert.Contains("Rudi is Rudi", result.CertificateProperties.Where(x => x.Key.Equals(RdnTypes.NameProperty[RdnTypes.CommonName])).Select(x => x.Value));
}
[Fact]
@@ -1321,7 +1312,7 @@ public void Does_clear_existing_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
Assert.True(result.CertificateProperties.ContainsKey(RdnTypes.NameProperty[RdnTypes.CommonName]) &&
result.CertificateProperties[RdnTypes.NameProperty[RdnTypes.CommonName]]
.Equals(string.Empty));
@@ -1351,7 +1342,7 @@ public void Does_clear_nonexisting_RDN()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
Assert.True(result.CertificateProperties.ContainsKey(RdnTypes.NameProperty[RdnTypes.State]) &&
result.CertificateProperties[RdnTypes.NameProperty[RdnTypes.State]].Equals(string.Empty));
}
@@ -1380,7 +1371,7 @@ public void Does_not_clear_existing_RDN_if_not_mandatory()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
Assert.False(result.CertificateProperties.ContainsKey(RdnTypes.NameProperty[RdnTypes.CommonName]));
}
diff --git a/TameMyCerts.Tests/CertificateRequestValidatorTests.cs b/TameMyCerts.Tests/CertificateRequestValidatorTests.cs
index f3bbe60..e8b5e63 100644
--- a/TameMyCerts.Tests/CertificateRequestValidatorTests.cs
+++ b/TameMyCerts.Tests/CertificateRequestValidatorTests.cs
@@ -271,7 +271,7 @@ public void Deny_key_is_ECC_but_must_be_RSA()
Assert.True(result.DeniedForIssuance);
Assert.True(result.StatusCode.Equals(WinError.CERTSRV_E_KEY_LENGTH));
- Assert.True(string.Join(";", result.Description).Contains("ECC"));
+ Assert.Contains("ECC", string.Join(";", result.Description));
}
[Fact]
@@ -310,7 +310,7 @@ public void Deny_key_is_DSA_but_must_be_RSA()
Assert.True(result.DeniedForIssuance);
Assert.True(result.StatusCode.Equals(WinError.CERTSRV_E_KEY_LENGTH));
- Assert.True(string.Join(";", result.Description).Contains("DSA"));
+ Assert.Contains("DSA", string.Join(";", result.Description));
}
[Fact]
@@ -2058,7 +2058,7 @@ public void Allow_remove_sid_extension()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.DisabledCertificateExtensions.Contains(WinCrypt.szOID_NTDS_CA_SECURITY_EXT));
+ Assert.Contains(WinCrypt.szOID_NTDS_CA_SECURITY_EXT, result.DisabledCertificateExtensions);
}
[Fact]
@@ -2113,26 +2113,26 @@ public void Deny_all_known_RDN_types_identified()
Assert.True(result.DeniedForIssuance);
Assert.True(result.StatusCode.Equals(WinError.CERT_E_INVALID_NAME));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.CommonName)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.Country)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.Email)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.DomainComponent)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.Locality)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.Organization)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.OrgUnit)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.State)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.GivenName)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.Initials)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.SurName)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.StreetAddress)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.Title)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.UnstructuredName)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.UnstructuredAddress)));
- Assert.True(identities.Any(x => x.Key.Equals(RdnTypes.DeviceSerialNumber)));
- Assert.True(identities.Any(x => x.Key.Equals("postalCode")));
- Assert.True(identities.Any(x => x.Key.Equals("postOfficeBox")));
- Assert.True(identities.Any(x => x.Key.Equals("telephoneNumber")));
- Assert.True(identities.Any(x => x.Key.Equals("description")));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.CommonName));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.Country));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.Email));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.DomainComponent));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.Locality));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.Organization));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.OrgUnit));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.State));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.GivenName));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.Initials));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.SurName));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.StreetAddress));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.Title));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.UnstructuredName));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.UnstructuredAddress));
+ Assert.Contains(identities, x => x.Key.Equals(RdnTypes.DeviceSerialNumber));
+ Assert.Contains(identities, x => x.Key.Equals("postalCode"));
+ Assert.Contains(identities, x => x.Key.Equals("postOfficeBox"));
+ Assert.Contains(identities, x => x.Key.Equals("telephoneNumber"));
+ Assert.Contains(identities, x => x.Key.Equals("description"));
}
[Fact]
@@ -2226,7 +2226,7 @@ public void Deny_commonName_invalid_dnsName_invalid_PKCS7_encoded()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.CERT_E_INVALID_NAME));
+ Assert.Equal(WinError.CERT_E_INVALID_NAME, result.StatusCode);
}
[Fact]
@@ -2281,7 +2281,7 @@ public void Deny_commonName_invalid_dnsName_invalid_CMC_encoded()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.CERT_E_INVALID_NAME));
+ Assert.Equal(WinError.CERT_E_INVALID_NAME, result.StatusCode);
}
[Fact]
@@ -2312,7 +2312,7 @@ public void Deny_commonName_ip_disallowed()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.CERT_E_INVALID_NAME));
+ Assert.Equal(WinError.CERT_E_INVALID_NAME, result.StatusCode);
}
[Fact]
@@ -2345,7 +2345,7 @@ public void Deny_commonName_ip_invalid()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.CERT_E_INVALID_NAME));
+ Assert.Equal(WinError.CERT_E_INVALID_NAME, result.StatusCode);
}
[Fact]
@@ -2365,7 +2365,7 @@ public void Allow_notAfter_valid()
PrintResult(result);
Assert.False(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_SUCCESS));
+ Assert.Equal(WinError.ERROR_SUCCESS, result.StatusCode);
Assert.True(result.NotAfter.Equals(DateTimeOffset.ParseExact(notAfter, "o",
CultureInfo.InvariantCulture.DateTimeFormat,
@@ -2387,6 +2387,6 @@ public void Deny_notAfter_invalid()
PrintResult(result);
Assert.True(result.DeniedForIssuance);
- Assert.True(result.StatusCode.Equals(WinError.ERROR_INVALID_TIME));
+ Assert.Equal(WinError.ERROR_INVALID_TIME, result.StatusCode);
}
}
\ No newline at end of file
diff --git a/TameMyCerts.Tests/TameMyCerts.Tests.csproj b/TameMyCerts.Tests/TameMyCerts.Tests.csproj
index af45665..04a4034 100644
--- a/TameMyCerts.Tests/TameMyCerts.Tests.csproj
+++ b/TameMyCerts.Tests/TameMyCerts.Tests.csproj
@@ -8,6 +8,12 @@
1.0.0.0
1.0.0.0
+
+ 1701;1702;CA1416
+
+
+ 1701;1702;CA1416
+
diff --git a/TameMyCerts.Tests/X509CertificateExtensionAuthorityInformationAccessTests.cs b/TameMyCerts.Tests/X509CertificateExtensionAuthorityInformationAccessTests.cs
index 405c63b..c829d50 100644
--- a/TameMyCerts.Tests/X509CertificateExtensionAuthorityInformationAccessTests.cs
+++ b/TameMyCerts.Tests/X509CertificateExtensionAuthorityInformationAccessTests.cs
@@ -29,7 +29,7 @@ public void Building_long()
aiaExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(aiaExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(aiaExt.RawData));
}
[Fact]
@@ -44,6 +44,6 @@ public void Building_short()
aiaExt.AddUniformResourceIdentifier("http://pki.tamemycerts-tests.local/CertData/TEST-CA.crt");
aiaExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(aiaExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(aiaExt.RawData));
}
}
\ No newline at end of file
diff --git a/TameMyCerts.Tests/X509CertificateExtensionAuthorityKeyIdentifierTests.cs b/TameMyCerts.Tests/X509CertificateExtensionAuthorityKeyIdentifierTests.cs
index 3da9249..bce0759 100644
--- a/TameMyCerts.Tests/X509CertificateExtensionAuthorityKeyIdentifierTests.cs
+++ b/TameMyCerts.Tests/X509CertificateExtensionAuthorityKeyIdentifierTests.cs
@@ -19,6 +19,6 @@ public void Building()
var akiExt = new X509CertificateExtensionAuthorityKeyIdentifier(akiBytes);
- Assert.True(Convert.ToBase64String(akiExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(akiExt.RawData));
}
}
\ No newline at end of file
diff --git a/TameMyCerts.Tests/X509CertificateExtensionCrlDistributionPointTests.cs b/TameMyCerts.Tests/X509CertificateExtensionCrlDistributionPointTests.cs
index 1de56a8..7b48d6a 100644
--- a/TameMyCerts.Tests/X509CertificateExtensionCrlDistributionPointTests.cs
+++ b/TameMyCerts.Tests/X509CertificateExtensionCrlDistributionPointTests.cs
@@ -28,7 +28,7 @@ public void Building_long()
cdpExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(cdpExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(cdpExt.RawData));
}
[Fact]
@@ -43,6 +43,6 @@ public void Building_short()
cdpExt.AddUniformResourceIdentifier("http://pki.tamemycerts-tests.local/CertData/TEST-CA.crl");
cdpExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(cdpExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(cdpExt.RawData));
}
}
\ No newline at end of file
diff --git a/TameMyCerts.Tests/X509CertificateExtensionOcspMustStapleTests.cs b/TameMyCerts.Tests/X509CertificateExtensionOcspMustStapleTests.cs
index c7f2b45..d2013da 100644
--- a/TameMyCerts.Tests/X509CertificateExtensionOcspMustStapleTests.cs
+++ b/TameMyCerts.Tests/X509CertificateExtensionOcspMustStapleTests.cs
@@ -13,6 +13,6 @@ public void Building()
var ocspStaplingExt = new X509CertificateExtensionOcspMustStaple();
- Assert.True(Convert.ToBase64String(ocspStaplingExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(ocspStaplingExt.RawData));
}
}
\ No newline at end of file
diff --git a/TameMyCerts.Tests/X509CertificateExtensionSecurityIdentifierTests.cs b/TameMyCerts.Tests/X509CertificateExtensionSecurityIdentifierTests.cs
index d3a0e34..971dc33 100644
--- a/TameMyCerts.Tests/X509CertificateExtensionSecurityIdentifierTests.cs
+++ b/TameMyCerts.Tests/X509CertificateExtensionSecurityIdentifierTests.cs
@@ -18,6 +18,6 @@ public void Building()
var sidExt = new X509CertificateExtensionSecurityIdentifier(new SecurityIdentifier(sid));
- Assert.True(Convert.ToBase64String(sidExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sidExt.RawData));
}
}
\ No newline at end of file
diff --git a/TameMyCerts.Tests/X509CertificateExtensionSubjectAlternativeNameTests.cs b/TameMyCerts.Tests/X509CertificateExtensionSubjectAlternativeNameTests.cs
index 4dd12c3..e7a9e71 100644
--- a/TameMyCerts.Tests/X509CertificateExtensionSubjectAlternativeNameTests.cs
+++ b/TameMyCerts.Tests/X509CertificateExtensionSubjectAlternativeNameTests.cs
@@ -30,8 +30,8 @@ public void Builds_with_empty_content()
var sanExt = new X509CertificateExtensionSubjectAlternativeName();
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
- Assert.True(sanExt.AlternativeNames.Count.Equals(0));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
+ Assert.Empty(sanExt.AlternativeNames);
}
[Fact]
@@ -40,8 +40,8 @@ public void Builds_with_empty_string_input()
var sanExt = new X509CertificateExtensionSubjectAlternativeName(string.Empty);
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
- Assert.True(sanExt.AlternativeNames.Count.Equals(0));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
+ Assert.Empty(sanExt.AlternativeNames);
}
[Fact]
@@ -50,8 +50,8 @@ public void Builds_with_empty_binary_input()
var sanExt = new X509CertificateExtensionSubjectAlternativeName(Array.Empty());
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
- Assert.True(sanExt.AlternativeNames.Count.Equals(0));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
+ Assert.Empty(sanExt.AlternativeNames);
}
[Fact]
@@ -65,7 +65,7 @@ public void Builds_one_Uri_with_SID()
"tag:microsoft.com,2022-09-14:sid:S-1-5-21-1381186052-4247692386-135928078-1225");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -77,7 +77,7 @@ public void Builds_one_dNSName()
sanExt.AddDnsName("some-test.tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -89,7 +89,7 @@ public void Builds_one_iPAddress()
sanExt.AddIpAddress(IPAddress.Parse("192.168.0.1"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -102,7 +102,7 @@ public void Builds_one_userPrincipalName()
sanExt.AddUserPrincipalName("Administrator@tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -114,7 +114,7 @@ public void Builds_one_rfc822Name()
sanExt.AddEmailAddress(new MailAddress("Administrator@tamemycerts-tests.local"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -126,7 +126,7 @@ public void Builds_one_rfc822Name_from_string()
sanExt.AddEmailAddress("Administrator@tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -139,7 +139,7 @@ public void Builds_one_uniformResourceIdentifier()
sanExt.AddUniformResourceIdentifier(new Uri("http://some-test.tamemycerts-tests.local/"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -152,7 +152,7 @@ public void Builds_one_uniformResourceIdentifier_from_string()
sanExt.AddUniformResourceIdentifier("http://some-test.tamemycerts-tests.local/");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -164,7 +164,7 @@ public void Builds_empty_when_all_are_removed()
sanExt.RemoveDnsName("some-test.tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
[Fact]
@@ -185,8 +185,8 @@ public void Decodes_one_iPAddress()
var sanExt = new X509CertificateExtensionSubjectAlternativeName(rawData);
- Assert.True(sanExt.AlternativeNames[0].Key == SanTypes.IpAddress);
- Assert.True(sanExt.AlternativeNames[0].Value == "192.168.0.1");
+ Assert.Equal(SanTypes.IpAddress, sanExt.AlternativeNames[0].Key);
+ Assert.Equal("192.168.0.1", sanExt.AlternativeNames[0].Value);
}
[Fact]
@@ -196,8 +196,8 @@ public void Decodes_one_userPrincipalName()
var sanExt = new X509CertificateExtensionSubjectAlternativeName(rawData);
- Assert.True(sanExt.AlternativeNames[0].Key == SanTypes.UserPrincipalName);
- Assert.True(sanExt.AlternativeNames[0].Value == "Administrator@tamemycerts-tests.local");
+ Assert.Equal(SanTypes.UserPrincipalName, sanExt.AlternativeNames[0].Key);
+ Assert.Equal("Administrator@tamemycerts-tests.local", sanExt.AlternativeNames[0].Value);
}
[Fact]
@@ -218,8 +218,8 @@ public void Decodes_one_uniformResourceIdentifier()
var sanExt = new X509CertificateExtensionSubjectAlternativeName(rawData);
- Assert.True(sanExt.AlternativeNames[0].Key == SanTypes.UniformResourceIdentifier);
- Assert.True(sanExt.AlternativeNames[0].Value == "http://some-test.tamemycerts-tests.local/");
+ Assert.Equal(SanTypes.UniformResourceIdentifier, sanExt.AlternativeNames[0].Key);
+ Assert.Equal("http://some-test.tamemycerts-tests.local/", sanExt.AlternativeNames[0].Value);
}
[Fact]
@@ -232,7 +232,7 @@ public void Does_not_add_same_dNSName()
sanExt.AddDnsName("some-test.tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -242,7 +242,7 @@ public void Does_not_add_invalid_Type()
sanExt.AddAlternativeName("thisisnotvalid", "some-test.tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
[Fact]
@@ -252,7 +252,7 @@ public void Does_not_add_invalid_dNSName()
sanExt.AddAlternativeName(SanTypes.DnsName, "thisisnotvalid!?");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
[Fact]
@@ -262,7 +262,7 @@ public void Does_not_add_invalid_ipAddress()
sanExt.AddAlternativeName(SanTypes.IpAddress, "thisisnotvalid!?");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
[Fact]
@@ -272,7 +272,7 @@ public void Does_not_add_invalid_userPrincipalName()
sanExt.AddAlternativeName(SanTypes.UserPrincipalName, "thisisnotvalid!?");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
[Fact]
@@ -282,7 +282,7 @@ public void Does_not_add_invalid_rfc822Name()
sanExt.AddAlternativeName(SanTypes.Rfc822Name, "thisisnotvalid!?");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
[Fact]
@@ -292,7 +292,7 @@ public void Does_not_add_invalid_uniformResourceIdentifier()
sanExt.AddAlternativeName(SanTypes.UniformResourceIdentifier, "thisisnotvalid!?");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
[Fact]
@@ -305,7 +305,7 @@ public void Does_not_add_same_iPAddress()
sanExt.AddIpAddress(IPAddress.Parse("192.168.0.1"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -319,7 +319,7 @@ public void Does_not_add_same_userPrincipalName()
sanExt.AddUserPrincipalName("Administrator@tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -332,7 +332,7 @@ public void Does_not_add_same_rfc822Name()
sanExt.AddEmailAddress(new MailAddress("Administrator@tamemycerts-tests.local"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -345,7 +345,7 @@ public void Does_not_add_same_uniformResourceIdentifier()
sanExt.AddUniformResourceIdentifier(new Uri("http://some-test.tamemycerts-tests.local/"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -359,7 +359,7 @@ public void Adds_one_dNSName()
sanExt.AddDnsName("another-test.tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -375,7 +375,7 @@ public void Adds_one_uniformResourceIdentifier()
Console.WriteLine(Convert.ToBase64String(sanExt.RawData));
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -391,7 +391,7 @@ public void Adds_one_rfc822Name()
Console.WriteLine(Convert.ToBase64String(sanExt.RawData));
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -407,7 +407,7 @@ public void Adds_one_userPrincipalName()
Console.WriteLine(Convert.ToBase64String(sanExt.RawData));
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -420,7 +420,7 @@ public void Adds_one_iPAddress()
sanExt.AddIpAddress(IPAddress.Parse("192.168.0.1"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -434,7 +434,7 @@ public void Removes_one_dNSName()
sanExt.RemoveDnsName("another-test.tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -447,7 +447,7 @@ public void Removes_one_iPAddress()
sanExt.RemoveIpAddress(IPAddress.Parse("192.168.0.1"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -461,7 +461,7 @@ public void Removes_one_uniformResourceIdentifier()
sanExt.RemoveUniformResourceIdentifier(new Uri("http://some-test.tamemycerts-tests.local/"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -475,7 +475,7 @@ public void Removes_one_uniformResourceIdentifier_from_string()
sanExt.RemoveUniformResourceIdentifier("http://some-test.tamemycerts-tests.local/");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -489,7 +489,7 @@ public void Removes_one_rfc822Name()
sanExt.RemoveEmailAddress(new MailAddress("Administrator@tamemycerts-tests.local"));
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -503,7 +503,7 @@ public void Removes_one_rfc822Name_from_string()
sanExt.RemoveEmailAddress("Administrator@tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -517,7 +517,7 @@ public void Removes_one_userPrincipalName()
sanExt.RemoveUserPrincipalName("Administrator@tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(Convert.ToBase64String(sanExt.RawData).Equals(expectedResult));
+ Assert.Equal(expectedResult, Convert.ToBase64String(sanExt.RawData));
}
[Fact]
@@ -527,6 +527,6 @@ public void Does_not_remove_if_empty()
sanExt.RemoveUserPrincipalName("Administrator@tamemycerts-tests.local");
sanExt.InitializeEncode();
- Assert.True(sanExt.RawData.Equals(Array.Empty()));
+ Assert.Equal(Array.Empty(), sanExt.RawData);
}
}
\ No newline at end of file
diff --git a/TameMyCerts/TameMyCerts.csproj b/TameMyCerts/TameMyCerts.csproj
index 8c5bfa0..36e7dd7 100644
--- a/TameMyCerts/TameMyCerts.csproj
+++ b/TameMyCerts/TameMyCerts.csproj
@@ -12,9 +12,15 @@
true
+ 1701;1702;CA1416
true
+ git
+ https://github.com/Sleepw4lker/TameMyCerts.git
+
+
+ 1701;1702;CA1416