コード例 #1
0
        public void Setup()
        {
            (_otpService, _userRepository, _otpRepository, _otpGenerator, _smsSender) =
                MoqMockHelper.Create <OtpService, IUserRepository, IOtpRepository, IOtpGenerator, ISmsSender>();

            var request = CreateRequest();

            _userRepository.Setup(r => r.Exists(request.User.GetId())).Returns(Task.FromResult(true));
            _otpGenerator.Setup(o => o.Generate()).Returns(DefaultOtp);
            _smsSender.Setup(r => r.SendAsync(It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(true));
        }
コード例 #2
0
        public void Setup()
        {
            _defaultRequest = CreateRequest();
            _defaultOtpDoc  = CreateOtpDocument();

            (_otpService, _userRepository, _otpRepository, _, _) =
                MoqMockHelper.Create <OtpService, IUserRepository, IOtpRepository, IOtpGenerator, ISmsSender>();

            _userRepository
            .Setup(r => r.Exists(_defaultRequest.User.GetId()))
            .Returns(Task.FromResult(true));
            _otpRepository
            .Setup(r => r.GetOtpRequestOfUser(_defaultRequest.User.UserUuid))
            .Returns(Task.FromResult(_defaultOtpDoc));
        }