Пример #1
0
 public async Task TrySendEmailOnTimeout()
 {
     var userId = 0;
     var user   = new User
     {
         UserId = userId
     };
     var seconds = 3;
     IEmailVerifierRepository repo = MockEmailRepo(userId, seconds);
     var emailCodeSenderService    = new EmailCodeSenderService(repo, null);
     await Assert.ThrowsAsync <TimeoutException>(() =>
                                                 emailCodeSenderService.SendCodeByEmail(user, "email", 0, "Link"));
 }
Пример #2
0
        public void GetTimeoutTests(int seconds)
        {
            // Arrange
            var userId                    = 0;
            int expectedSeconds           = EmailCodeSenderService.EMAIL_TIMEOUT * 60 - seconds;
            IEmailVerifierRepository repo = MockEmailRepo(userId, seconds);
            var emailCodeSenderService    = new EmailCodeSenderService(repo, null);
            // act
            int actualSeconds = emailCodeSenderService.GetTimeout(userId);

            // assert
            Assert.Equal(expectedSeconds, actualSeconds);
        }