private async Task RemoveApiKeys(int nationalSocietyId) { var gatewaysResult = await _smsGatewayService.List(nationalSocietyId); ThrowIfErrorResult(gatewaysResult); foreach (var gateway in gatewaysResult.Value) { var deleteResult = await _smsGatewayService.Delete(gateway.Id); ThrowIfErrorResult(deleteResult); } }
public async Task GetSmsGateways_WhenNationalSocietyIsProvided_ShouldFilterResults() { // Arrange const int nationalSocietyId = 1; var gatewaySettings = new[] { new GatewaySetting { Id = 1, NationalSocietyId = nationalSocietyId }, new GatewaySetting { Id = 2, NationalSocietyId = 2 }, new GatewaySetting { Id = 3, NationalSocietyId = nationalSocietyId } }; var gatewaySettingsMockDbSet = gatewaySettings.AsQueryable().BuildMockDbSet(); _nyssContextMock.GatewaySettings.Returns(gatewaySettingsMockDbSet); // Act var result = await _smsGatewayService.List(nationalSocietyId); // Assert result.IsSuccess.ShouldBeTrue(); result.Value.Count.ShouldBe(2); result.Value.Select(x => x.Id).ShouldBe(new[] { 1, 3 }); }
public Task <Result <List <GatewaySettingResponseDto> > > List(int nationalSocietyId) => _smsGatewayService.List(nationalSocietyId);