A lot of works different areas... no plan
This commit is contained in:
parent
087f8ce0e9
commit
1aea1e894a
16 changed files with 1433 additions and 131 deletions
|
|
@ -5,12 +5,35 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Core.Telemetry;
|
||||
using Core.Entities.Users;
|
||||
using System.Diagnostics;
|
||||
using Sodium;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class PasswordHasherTests : TestFixture
|
||||
{
|
||||
|
||||
[TestMethod]
|
||||
public void MyTestMethod()
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
|
||||
byte[] salt = PasswordHash.ScryptGenerateSalt();
|
||||
|
||||
// 2. Konverter password til byte[]
|
||||
byte[] passwordBytes = System.Text.Encoding.UTF8.GetBytes("password123");
|
||||
|
||||
// 3. Kald ScryptHashBinary korrekt
|
||||
byte[] hash = PasswordHash.ScryptHashBinary(
|
||||
password: passwordBytes,
|
||||
salt: salt, // 32-byte array
|
||||
limit: PasswordHash.Strength.Interactive,
|
||||
outputLength: 32
|
||||
);
|
||||
|
||||
stopwatch.Stop();
|
||||
}
|
||||
[TestMethod]
|
||||
public void HashPassword_ShouldCreateValidHashFormat()
|
||||
{
|
||||
|
|
@ -23,7 +46,7 @@ namespace Tests
|
|||
|
||||
// Assert
|
||||
Assert.AreEqual(3, parts.Length);
|
||||
Assert.AreEqual("100000", parts[0]);
|
||||
Assert.AreEqual("600000", parts[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
|||
|
|
@ -39,10 +39,12 @@ namespace Tests
|
|||
);
|
||||
}
|
||||
var logger = Container.Resolve<Microsoft.ApplicationInsights.TelemetryClient>();
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
logger.TrackTrace("Hello 23" , Microsoft.ApplicationInsights.DataContracts.SeverityLevel.Information);
|
||||
|
||||
logger.TrackTrace("Hello 23", Microsoft.ApplicationInsights.DataContracts.SeverityLevel.Information);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
11
Tests/SecureConnectionStringTests.cs
Normal file
11
Tests/SecureConnectionStringTests.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using Autofac;
|
||||
using System.Data;
|
||||
using Insight.Database;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Core.Telemetry;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -26,19 +26,12 @@ namespace Tests
|
|||
return configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should not be overriden. Rather override PreArrangeAll to setup data needed for a test class.
|
||||
/// Override PrebuildContainer with a method that does nothing to prevent early build of IOC container
|
||||
/// </summary>
|
||||
[TestInitialize]
|
||||
public void Setup()
|
||||
protected TestFixture()
|
||||
{
|
||||
CreateContainerBuilder();
|
||||
Container = ContainerBuilder.Build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected virtual void CreateContainerBuilder()
|
||||
{
|
||||
IConfigurationRoot configuration = Configuration();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue