コード例 #1
0
        public void ValidateToken_ReturnsFalseIfTokenIsInvalidTest()
        {
            // Arrange
            TotpTokenService <StubAccount> totpTokenService = new TotpTokenService <StubAccount>();
            string token = totpTokenService.GenerateToken(_invalidPurpose, _testAccount);

            // Act
            ValidateTokenResult result = totpTokenService.ValidateToken(_validPurpose, token, _testAccount);

            // Assert
            Assert.Equal(ValidateTokenResult.Invalid, result);
        }
コード例 #2
0
        public void GenerateToken_GeneratesTokenTest()
        {
            // Arrange
            TotpTokenService <StubAccount> totpTokenService = new TotpTokenService <StubAccount>();

            // Act
            string token = totpTokenService.GenerateToken(_validPurpose, _testAccount);

            // Assert
            Assert.NotEqual(null, token);
            Assert.Equal(6, token.Length);
            int num;

            Assert.True(int.TryParse(token, out num));
        }