public OtpControllerTest()
        {
            otpRepository = new Mock <IOtpRepository>();
            otpGenerator  = new Mock <IOtpGenerator>();
            smsClient     = new Mock <ISmsClient>();
            var otpService        = new OtpSender(otpRepository.Object, otpGenerator.Object, smsClient.Object, otpProperties);
            var otpServiceFactory = new OtpSenderFactory(otpService, new FakeOtpSender(otpRepository.Object), null);

            otpController = new OtpController(otpServiceFactory,
                                              new OtpVerifier(otpRepository.Object, new OtpProperties(1)));
        }
Beispiel #2
0
        public void ShouldReturnDefaultOtpSender(string mobileNumber)
        {
            var otpSender        = new OtpSender(null, null, null, null);
            var otpSenderFactory = new OtpSenderFactory(
                otpSender,
                new FakeOtpSender(null),
                new List <string>
            {
                mobileNumber
            });

            var response = otpSenderFactory.ServiceFor(mobileNumber);

            response.As <OtpSender>().Should().NotBeNull().And.BeEquivalentTo(otpSender);
        }
Beispiel #3
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);
        }