public void CreateDatasourceCredentialValidatesArguments() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); Assert.That(() => adminClient.CreateDatasourceCredentialAsync(null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDatasourceCredential(null), Throws.InstanceOf <ArgumentNullException>()); }
public void CreateDatasourceCredentialRespectsTheCancellationToken() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); var credential = new ServicePrincipalDatasourceCredential("credentialName", "clientId", "clientSecret", "tenantId"); using var cancellationSource = new CancellationTokenSource(); cancellationSource.Cancel(); Assert.That(() => adminClient.CreateDatasourceCredentialAsync(credential, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>()); Assert.That(() => adminClient.CreateDatasourceCredential(credential, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>()); }