예제 #1
0
        public async Task GetSmsGateway_WhenSmsGatewayExists_ShouldReturnSuccess()
        {
            // Arrange
            const int existingNationalSocietyId = 3;

            var gatewaySettings = new[]
            {
                new GatewaySetting
                {
                    Id = 1,
                    NationalSocietyId = 1
                },
                new GatewaySetting
                {
                    Id = 2,
                    NationalSocietyId = 2
                },
                new GatewaySetting
                {
                    Id                = existingNationalSocietyId,
                    Name              = "Name",
                    ApiKey            = "api-key",
                    NationalSocietyId = 1,
                    GatewayType       = GatewayType.SmsEagle
                }
            };

            var gatewaySettingsMockDbSet = gatewaySettings.AsQueryable().BuildMockDbSet();

            _nyssContextMock.GatewaySettings.Returns(gatewaySettingsMockDbSet);

            // Act
            var result = await _smsGatewayService.Get(existingNationalSocietyId);

            // Assert
            result.IsSuccess.ShouldBeTrue();
            result.Value.Id.ShouldBe(3);
            result.Value.Name.ShouldBe("Name");
            result.Value.ApiKey.ShouldBe("api-key");
            result.Value.GatewayType.ShouldBe(GatewayType.SmsEagle);
        }
예제 #2
0
 public Task <Result <GatewaySettingResponseDto> > Get(int smsGatewayId) =>
 _smsGatewayService.Get(smsGatewayId);