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()); }
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()); }
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. } }