From 915ce16e38d876039b10aa22c68928ec198b4711 Mon Sep 17 00:00:00 2001 From: Young Date: Wed, 30 Oct 2024 10:46:54 +0800 Subject: [PATCH] updated hash test --- src/Infrastructure.Tests/GenericTests.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Infrastructure.Tests/GenericTests.cs b/src/Infrastructure.Tests/GenericTests.cs index b8408ab..909d709 100644 --- a/src/Infrastructure.Tests/GenericTests.cs +++ b/src/Infrastructure.Tests/GenericTests.cs @@ -1,3 +1,6 @@ +using System.Security.Cryptography; +using Newtonsoft.Json; + namespace Infrastructure.Tests; public class GenericTests @@ -23,4 +26,14 @@ public class GenericTests Assert.Equal(default, value); Assert.Null(nullableValue); } + + [Fact] + public void HashTest() + { + var json = JsonConvert.SerializeObject(323234L); + var hashBytes = MD5.HashData(Encoding.ASCII.GetBytes(json)); + var hashString = BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant(); + Assert.NotEmpty(hashString); + Assert.NotNull(hashString); + } } \ No newline at end of file