예제 #1
0
        public void RootCADoesntHaveParentCAAndIsProperlyInitialized()
        {
            // Arrange
            IRootCertificateAuthority rootCA = null;
            var provisioningService          = new Mock <IProvisioningService>().Object;

            // Act
            rootCA = new IoTCompany(this.config.Object,
                                    provisioningService);

            // Assert
            Assert.Null(rootCA.ParentCertificateAuthority);
            Assert.NotNull(rootCA.personalSignedX509Certificate);
        }
        public X509CertificatesChainTests(ITestOutputHelper log)
        {
            this.log = log;

            this.config = new Mock <IConfig>();
            this.config.Setup(c => c.IoTCompanyName)
            .Returns("company-x");
            this.config.Setup(c => c.IoTHardwareIntegratorName)
            .Returns("factory-y");
            this.config.Setup(c => c.IoTDeployerName)
            .Returns("technician-z");

            var config = this.config.Object;
            var provisioningService = new Mock <IProvisioningService>().Object;

            //TODO: future PR if team says "go", this needs to be tested with the Dependency Resolution
            this.rootCA      = new IoTCompany(config, provisioningService);
            this.intermed1CA = new IoTHardwareIntegrator(
                config,
                this.rootCA);
            this.intermed2CA = new IoTDeployer(
                config,
                this.intermed1CA);
        }