Пример #1
0
        public async Task ThenThereIsAServiceTenantWithId(string expectedServiceTenantId)
        {
            ITenantProvider tenantProvider = ContainerBindings.GetServiceProvider(this.scenarioContext).GetRequiredService <ITenantProvider>();
            ITenant         tenant         = await tenantProvider.GetTenantAsync(expectedServiceTenantId).ConfigureAwait(false);

            Assert.AreEqual(WellKnownTenantIds.ServiceTenantParentId, tenant.GetRequiredParentId());
        }
Пример #2
0
        public async Task ThenThereIsATenantWithIdAsAChildOfTheRootTenant(string tenantId)
        {
            ITenantProvider tenantProvider = ContainerBindings.GetServiceProvider(this.scenarioContext).GetRequiredService <ITenantProvider>();

            // A TenantNotFound exception will be thrown if the tenant doesn't exist
            ITenant tenant = await tenantProvider.GetTenantAsync(tenantId).ConfigureAwait(false);

            Assert.AreEqual(tenantProvider.Root.Id, tenant.GetRequiredParentId());
        }
Пример #3
0
        public async Task ThenThereIsNoTenantWithIdAsAChildOfTheRootTenant(string tenantId)
        {
            ITenantProvider tenantProvider = ContainerBindings.GetServiceProvider(this.scenarioContext).GetRequiredService <ITenantProvider>();

            try
            {
                ITenant tenant = await tenantProvider.GetTenantAsync(tenantId).ConfigureAwait(false);

                // The tenant exists. If it's a child of the root tenant, the test is failed.
                Assert.AreNotEqual(
                    tenantProvider.Root.Id,
                    tenant.GetRequiredParentId(),
                    $"A tenant with Id '{tenantId}' does exist and is a child of the root tenant.");
            }
            catch (TenantNotFoundException)
            {
                // This means the test has passed.
            }
        }