Solution restructured to use multiple test projects
This commit is contained in:
27
test/AMWD.Common.Tests/Utils/CryptographyHelperSaltMock.cs
Normal file
27
test/AMWD.Common.Tests/Utils/CryptographyHelperSaltMock.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using ReflectionMagic;
|
||||
|
||||
namespace AMWD.Common.Tests.Utils
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
internal class CryptographyHelperSaltMock : IDisposable
|
||||
{
|
||||
private readonly int _saltLength;
|
||||
|
||||
private CryptographyHelperSaltMock(int saltLength)
|
||||
{
|
||||
_saltLength = typeof(CryptographyHelper).AsDynamicType()._saltLength;
|
||||
SetSaltLength(saltLength);
|
||||
}
|
||||
|
||||
public static IDisposable Create(int saltLength)
|
||||
=> new CryptographyHelperSaltMock(saltLength);
|
||||
|
||||
public void Dispose()
|
||||
=> SetSaltLength(_saltLength);
|
||||
|
||||
private static void SetSaltLength(int length)
|
||||
=> typeof(CryptographyHelper).AsDynamicType()._saltLength = length;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user