示例#1
0
        public void GetUnLockedTimeSecound(int count, int secound)
        {
            BackOffController backOff = new BackOffController(counter.Object, dac.Object, time.Object, otp.Object);
            var result = backOff.GetUnLockedTimeSecound(count);

            result.Should().Be(secound);;
        }
        public void VertifyFail(string code, string validCode, int lastestAttempt, VerifyConfig verifyConfig, VertifyResponse expected)
        {
            this.otp.Setup(x => x.GetOTP()).Returns(validCode);
            this.counter.Setup(x => x.GetVertify()).Returns(lastestAttempt);
            this.dac.Setup(x => x.GetVerifyConfig()).Returns(verifyConfig);

            BackOffController backOffCtr = new BackOffController(counter.Object, dac.Object, time.Object, otp.Object);
            var result = backOffCtr.Vertify(code);

            result.Should().BeEquivalentTo(expected);
        }
示例#3
0
        public void SendOTPNonBackOff(int otpCount, BackOff backOff, DateTime dateTime, string code, SendOTPResponse expected)
        {
            this.counter.Setup(x => x.GetOTP()).Returns(otpCount);
            this.dac.Setup(x => x.GetBackOff()).Returns(backOff);
            this.time.Setup(x => x.GetNow()).Returns(dateTime);
            this.otp.Setup(x => x.GenerateOTP()).Returns(code);

            BackOffController backOffCtr = new BackOffController(counter.Object, dac.Object, time.Object, otp.Object);
            var result = backOffCtr.SendOTP();

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