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,31 +1,31 @@
using ModernKeePassLib.Cryptography.Hash;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using ModernKeePassLib.Cryptography.Hash;
using ModernKeePassLib.Utility;
using NUnit.Framework;
namespace ModernKeePassLib.Test.Cryptography.Hash
{
[TestFixture]
[TestClass]
public class SHAManagedTests
{
[Test]
[TestMethod]
public void TestSha256ComputeHash()
{
var expectedHash = "B822F1CD2DCFC685B47E83E3980289FD5D8E3FF3A82DEF24D7D1D68BB272EB32";
var message = StrUtil.Utf8.GetBytes("testing123");
using (var result = new SHA256Managed())
{
Assert.That(ByteToString(result.ComputeHash(message)), Is.EqualTo(expectedHash));
Assert.AreEqual(ByteToString(result.ComputeHash(message)), expectedHash);
}
}
[Test]
[TestMethod]
public void TestSha512ComputeHash()
{
var expectedHash = "4120117B3190BA5E24044732B0B09AA9ED50EB1567705ABCBFA78431A4E0A96B1152ED7F4925966B1C82325E186A8100E692E6D2FCB6702572765820D25C7E9E";
var message = StrUtil.Utf8.GetBytes("testing123");
using (var result = new SHA512Managed())
{
Assert.That(ByteToString(result.ComputeHash(message)), Is.EqualTo(expectedHash));
Assert.AreEqual(ByteToString(result.ComputeHash(message)), expectedHash);
}
}
private static string ByteToString(byte[] buff)