public RbacServiceTests() { _identityProvider = GetIdentityProvider("aad", "test", "https://microsoft.onmicrosoft.com/common/"); _controlPlaneDataStore = Substitute.For <IControlPlaneDataStore>(); _controlPlaneDataStore.GetIdentityProviderAsync(_identityProvider.Name, Arg.Any <CancellationToken>()).Returns(_identityProvider); _controlPlaneDataStore.UpsertIdentityProviderAsync(_identityProvider, Arg.Any <string>(), Arg.Any <CancellationToken>()).Returns(new UpsertResponse <IdentityProvider>(_identityProvider, UpsertOutcome.Updated, "testEtag")); IList <ResourcePermission> resourcePermissions = new List <ResourcePermission>(); _role = GetRole("clinician", resourcePermissions); _controlPlaneDataStore.GetRoleAsync(_role.Name, Arg.Any <CancellationToken>()).Returns(_role); _controlPlaneDataStore.UpsertRoleAsync(_role, Arg.Any <string>(), Arg.Any <CancellationToken>()).Returns(new UpsertResponse <Role>(_role, UpsertOutcome.Updated, "testEtag")); _controlPlaneDataStore.DeleteRoleAsync(_role.Name, Arg.Any <string>(), Arg.Any <CancellationToken>()); _rbacService = new RbacService(_controlPlaneDataStore); }
public async Task DeleteRoleAsync(string name, string eTag, CancellationToken cancellationToken) { EnsureArg.IsNotNullOrWhiteSpace(name, nameof(name)); await _controlPlaneDataStore.DeleteRoleAsync(name, eTag, cancellationToken); }