Changed test project type to WIndows 8.1

Changed test project framework from Nunit to MSTest
Changed HashAlgorithm from BouncyCastle to WinRT crypto
WIP progress bar in opendatabaseusercontrol
TextBox with button made generic
WIP implement copy on button click in Entry Page
This commit is contained in:
2017-11-06 19:01:01 +01:00
committed by BONNEVILLE Geoffroy
parent 53a54252e3
commit 8e690747e2
85 changed files with 2836 additions and 672 deletions

View File

@@ -1,36 +1,32 @@
using NUnit.Framework;
using System;
using System.Text;
#if KeePassLib
using KeePassLib.Cryptography;
#else
using System.Text;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using ModernKeePassLib.Cryptography;
#endif
namespace ModernKeePassLib.Test.Cryptography
{
[TestFixture ()]
public class HmacOtpTests
{
// Using the test case from Appendix D of RFC 4226
const string secret = "12345678901234567890";
static readonly string[] expectedHOTP = new string[] {
"755224", "287082", "359152", "969429", "338314",
"254676", "287922", "162583", "399871", "520489"
};
[Test ()]
public void TestGenerate ()
[TestClass()]
public class HmacOtpTests
{
var secretBytes = Encoding.UTF8.GetBytes (secret);
// Using the test case from Appendix D of RFC 4226
for (ulong i = 0; i < 10; i++) {
var hotp = HmacOtp.Generate (secretBytes, i, 6, false, -1);
Assert.That (hotp, Is.EqualTo (expectedHOTP[i]));
}
const string secret = "12345678901234567890";
static readonly string[] expectedHOTP = new string[]
{
"755224", "287082", "359152", "969429", "338314",
"254676", "287922", "162583", "399871", "520489"
};
[TestMethod]
public void TestGenerate()
{
var secretBytes = Encoding.UTF8.GetBytes(secret);
for (ulong i = 0; i < 10; i++)
{
var hotp = HmacOtp.Generate(secretBytes, i, 6, false, -1);
Assert.AreEqual(hotp, expectedHOTP[i]);
}
}
}
}
}