示例#1
0
        public void CertificateConfiguration_Should_Validate_Successfully()
        {
            var certificateConfiguration = new CertificateConfiguration(
                "TestSubjectName",
                "TestThumbprint",
                "TestAppIdentifier",
                "TestTenantId",
                "TestClientId",
                new[] { "test://testscope" });

            Assert.DoesNotThrow(() => Validator.ValidateObject(certificateConfiguration, new ValidationContext(certificateConfiguration)));
        }
示例#2
0
        public void Invalid_CertificateConfiguration_Should_Fail_Validation()
        {
            var certificateConfiguration = new CertificateConfiguration(
                string.Empty,
                "TestThumbprint",
                "TestAppIdentifier",
                "TestTenantId",
                "TestClientId",
                new[] { "TestScope" });

            Assert.Throws <ValidationException>(() => Validator.ValidateObject(certificateConfiguration, new ValidationContext(certificateConfiguration)));
        }
示例#3
0
        public void Creating_CertificateConfiguration_From_AzureADConfiguration_Should_Not_Fail()
        {
            // Arrange
            var azureADConfiguration = new AzureADConfiguration(
                "TestAppIdentifier",
                "TestTenantId",
                "TestClientId");

            // Act
            var certificateConfiguration  = new CertificateConfiguration("TestSubjectName", "TestThumbprint", azureADConfiguration);
            var certificateConfiguration2 = new CertificateConfiguration("service2AppIdentifier", certificateConfiguration);

            // Assert
            Assert.NotNull(certificateConfiguration2);
            Assert.NotNull(certificateConfiguration2.AppIdentifier);
            Assert.NotNull(certificateConfiguration2.CertificateSubjectName);
            Assert.NotNull(certificateConfiguration2.ClientId);
            Assert.NotNull(certificateConfiguration2.TenantId);
            Assert.NotNull(certificateConfiguration2.Scopes);
        }
 public CertificateConfiguration(string appIdentifier, CertificateConfiguration certificateConfiguration)
     : this(certificateConfiguration.CertificateSubjectName !, appIdentifier, certificateConfiguration)