예제 #1
0
        public void DonateServer_TokenHasExpired_ThrowTokenExpiredException()
        {
            database.Setup(d =>
                           d.TokenRepository.GetTokenByCodeAndType(It.IsNotNull <string>(), TokenType.Payment, UserId))
            .ReturnsAsync(() => { return(token.ChangeCreationDate(-3)); });

            Assert.That(() => donationManager.DonateServer(DonationType.FiftyPLN, "code"),
                        Throws.Exception.TypeOf <TokenExpiredException>());
        }
예제 #2
0
        public void ChangePassword_ExpiredToken_ThrowTokenExpiredException()
        {
            var testToken = new TestToken();

            testToken.ChangeCreationDate(-2);
            user.SetToken(testToken);
            Assert.That(() => accountManager.ChangePassword(It.IsAny <string>(), It.IsAny <string>(), testToken.Code),
                        Throws.TypeOf <TokenExpiredException>());
        }
예제 #3
0
        public void ConfirmAccount_UserTokenHasExpired_ThrowTokenExpiredException()
        {
            var token = new TestToken();

            token.ChangeCreationDate(-2);
            user.SetToken(token);

            database.Setup(d => d.UserRepository.GetUserByEmailWithTokenType(It.IsAny <string>(), TokenType.Register))
            .ReturnsAsync(user);

            Assert.That(() => authService.ConfirmAccount(It.IsAny <string>(), token.Code),
                        Throws.TypeOf <TokenExpiredException>());
        }