SEBWIN-296: Implemented unit tests for hash algorithm.
This commit is contained in:
parent
76da1f3585
commit
273e404f60
2 changed files with 35 additions and 0 deletions
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using SafeExamBrowser.Configuration.Cryptography;
|
||||||
|
|
||||||
|
namespace SafeExamBrowser.Configuration.UnitTests.Cryptography
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class HashAlgorithmTests
|
||||||
|
{
|
||||||
|
private HashAlgorithm sut;
|
||||||
|
|
||||||
|
[TestInitialize]
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
sut = new HashAlgorithm();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void MustGeneratePasswordHashCorrectly()
|
||||||
|
{
|
||||||
|
var hash = "4adfa806cb610693a6200e4cdbdafeaf352876a35f964a781d691457df9cd378";
|
||||||
|
var generated = sut.GenerateHashFor("blabbedyblubbedy");
|
||||||
|
|
||||||
|
Assert.AreEqual(hash, generated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -84,6 +84,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ConfigurationRepositoryTests.cs" />
|
<Compile Include="ConfigurationRepositoryTests.cs" />
|
||||||
|
<Compile Include="Cryptography\HashAlgorithmTests.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in a new issue