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>()); }
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>()); }
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>()); }