Removed useless Bouncy Castle package and test

Migrated to Nunit
Refactor
This commit is contained in:
Geoffroy BONNEVILLE
2019-07-29 17:30:15 +02:00
parent 26e8e5c223
commit c4de2dd594
23 changed files with 381 additions and 423 deletions

View File

@@ -1,30 +1,30 @@
using System.Text;
using ModernKeePassLib.Cryptography;
using Xunit;
using NUnit.Framework;
namespace ModernKeePassLib.Test.Cryptography
{
[TestFixture]
public class HmacOtpTests
{
// Using the test case from Appendix D of RFC 4226
const string secret = "12345678901234567890";
private const string Secret = "12345678901234567890";
static readonly string[] expectedHOTP = new string[]
{
private static readonly string[] ExpectedHotp = {
"755224", "287082", "359152", "969429", "338314",
"254676", "287922", "162583", "399871", "520489"
};
[Fact]
[Test]
public void TestGenerate()
{
var secretBytes = Encoding.UTF8.GetBytes(secret);
var secretBytes = Encoding.UTF8.GetBytes(Secret);
for (ulong i = 0; i < 10; i++)
{
var hotp = HmacOtp.Generate(secretBytes, i, 6, false, -1);
Assert.Equal(hotp, expectedHOTP[i]);
Assert.That(ExpectedHotp[i], Is.EqualTo(hotp));
}
}
}