22 lines
775 B
C#
22 lines
775 B
C#
using CertMgr.CertGen.Utils;
|
|
using CertMgr.Core.Validation;
|
|
|
|
using NUnit.Framework;
|
|
|
|
namespace certmgrTest;
|
|
|
|
public class SubjectValidatorTest
|
|
{
|
|
[TestCase("CN=www.example.com, O=Example Corp, OU=IT Department, L=Prague, ST=Czech Republic, C=CZ", true)]
|
|
[TestCase("CN=John Doe + OU=Engineering", true)]
|
|
[TestCase("1.2.3.4=John Doe", true)]
|
|
[TestCase("OID.1.2.3.4=John Doe", true)]
|
|
[TestCase("OID.1.2=John Doe", false)]
|
|
public async Task First(string subj, bool expectedSuccess)
|
|
{
|
|
SubjectValidator validator = new SubjectValidator("TestSetting");
|
|
ValidationResult result = await validator.ValidateAsync(subj, CancellationToken.None);
|
|
Assert.That(result.IsValid, Is.EqualTo(expectedSuccess), result.Justification);
|
|
}
|
|
}
|