mirror of
https://github.com/wismna/ModernKeePassLib.git
synced 2025-10-03 15:40:20 -04:00
Removed useless Bouncy Castle package and test
Migrated to Nunit Refactor
This commit is contained in:
@@ -1,28 +1,30 @@
|
||||
using ModernKeePassLib.Cryptography;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ModernKeePassLib.Test.Cryptography
|
||||
{
|
||||
[TestFixture]
|
||||
public class CryptoRandomTests
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestAddEntropy()
|
||||
{
|
||||
// just making sure it does not throw an exception
|
||||
CryptoRandom.Instance.AddEntropy(new byte[1]);
|
||||
Assert.DoesNotThrow(() => CryptoRandom.Instance.AddEntropy(new byte[1]));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestGetRandomBytes()
|
||||
{
|
||||
const int length = 32;
|
||||
var bytes1 = CryptoRandom.Instance.GetRandomBytes(length);
|
||||
Assert.Equal(bytes1.Length, length);
|
||||
var bytes2 = CryptoRandom.Instance.GetRandomBytes(length);
|
||||
Assert.NotEqual(bytes2, bytes1);
|
||||
|
||||
Assert.That(length, Is.EqualTo(bytes1.Length));
|
||||
Assert.That(bytes1, Is.Not.EqualTo(bytes2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestGeneratedBytesCount()
|
||||
{
|
||||
const int length = 1;
|
||||
@@ -30,7 +32,8 @@ namespace ModernKeePassLib.Test.Cryptography
|
||||
var count1 = CryptoRandom.Instance.GeneratedBytesCount;
|
||||
CryptoRandom.Instance.GetRandomBytes(length);
|
||||
var count2 = CryptoRandom.Instance.GeneratedBytesCount;
|
||||
Assert.True(count2 > count1);
|
||||
|
||||
Assert.That(count2, Is.GreaterThan(count1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user