Beispiel #1
0
        public void ThenTheTenantCalledShouldContainBlobStorageConfigurationForABlobStorageContainerDefinitionWithContainerName(
            string tenantName,
            string containerName)
        {
            InMemoryTenantProvider tenantProvider =
                ContainerBindings.GetServiceProvider(this.scenarioContext).GetRequiredService <InMemoryTenantProvider>();

            ITenant tenant = tenantProvider.GetTenantByName(tenantName)
                             ?? throw new TenantNotFoundException($"Could not find tenant with name '{tenantName}'");

            var containerDefinition = new BlobStorageContainerDefinition(containerName);

            BlobStorageConfiguration tenantConfigItem = tenant.GetBlobStorageConfiguration(containerDefinition);

            // GetBlobStorageConfiguration would have thrown an exception if the config didn't exist, but we'll do a
            // not null assertion anyway...
            Assert.IsNotNull(tenantConfigItem);
        }
Beispiel #2
0
        public void ThenTheTenantCalledShouldNotContainBlobStorageConfigurationForABlobStorageContainerDefinitionWithContainerName(
            string tenantName,
            string containerName)
        {
            InMemoryTenantProvider tenantProvider =
                ContainerBindings.GetServiceProvider(this.scenarioContext).GetRequiredService <InMemoryTenantProvider>();

            ITenant enrolledTenant = tenantProvider.GetTenantByName(tenantName)
                                     ?? throw new TenantNotFoundException($"Could not find tenant with name '{tenantName}'");

            var containerDefinition = new BlobStorageContainerDefinition(containerName);

            try
            {
                // This should throw. If it doesn't, then the config exists and the test fails.
                enrolledTenant.GetBlobStorageConfiguration(containerDefinition);
                Assert.Fail($"Did not expect to find blob storage configuration in tenant '{tenantName}' for container definition with container name '{containerName}', but it was present.");
            }
            catch (ArgumentException)
            {
                // This is what's expected - all is well.
            }
        }