コード例 #1
0
        public void ShouldReturnFakeOtpSender(string mobileNumber)
        {
            var fakeOtpSender    = new FakeOtpSender(null);
            var otpSenderFactory = new OtpSenderFactory(
                new OtpSender(null, null, null, null),
                fakeOtpSender,
                new List <string>
            {
                "+91-9999999999"
            });

            var otpSender = otpSenderFactory.ServiceFor(mobileNumber);

            otpSender.As <FakeOtpSender>().Should().NotBeNull().And.BeEquivalentTo(fakeOtpSender);
        }
コード例 #2
0
        public async Task ShouldSaveOtp()
        {
            var otpRepository = new Mock <IOtpRepository>();
            var sessionId     = TestBuilder.Faker().Random.Hash();
            var expectation   = new Response(ResponseType.Success, "");

            otpRepository.Setup(e => e.Save("666666", sessionId)).ReturnsAsync(expectation);
            var fakeOtpSender = new FakeOtpSender(otpRepository.Object);

            var result = await fakeOtpSender.GenerateOtp(new OtpGenerationRequest(
                                                             sessionId,
                                                             new Communication(TestBuilder.Faker().Random.String(), TestBuilder.Faker().Random.String()),
                                                             new OtpGenerationDetail(TestBuilder.Faker().Random.Word(), Action.REGISTRATION.ToString())));

            result.Should().BeEquivalentTo(expectation);
        }