using System.IO; using MfGames.Cryptography; using MfGames.Cryptography.Hashes; using MfGames.IO.Extensions; using Xunit; namespace MfGames.IO.Tests; public class CryptographyFileInfoTests { [Fact] public void HashPasswordFileAsLowercaseHexSha256() { FileInfo file = this.GetType() .GetDirectory() .FindGitRoot()! .GetFile("tests", "MfGames.IO.Tests", "password.txt"); Assert.Equal( "6b3a55e0261b0304143f805a24924d0c1c44524821305f31d9277843b8a10f4e", file.ToHashString(HashType.Sha256, ByteStringFormat.LowercaseHex) ); } [Fact] public void HashPasswordFileAsUppercaseHexMd5() { FileInfo file = this.GetType() .GetDirectory() .FindGitRoot()! .GetFile("tests", "MfGames.IO.Tests", "password.txt"); Assert.Equal( "286755FAD04869CA523320ACCE0DC6A4", file.ToHashString(HashType.Md5, ByteStringFormat.UppercaseHex) ); } }