aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordkanada <dkanada@users.noreply.github.com>2019-11-02 04:03:36 +0900
committerGitHub <noreply@github.com>2019-11-02 04:03:36 +0900
commit3bfb36a67d1ace11b73c25699efe3136025cf2ed (patch)
treed3b16b8897929eab3abd8ab2cd8cc8fc1e8c1dad /tests
parent48a99366b6bd0fea13fb40c6c16374052d5adb6d (diff)
parent60cb256835ff7601ee8ad7deefe52c1ef1c3b305 (diff)
Merge pull request #1915 from Bond-009/hex
Rewrite hex encoder/decoder
Diffstat (limited to 'tests')
-rw-r--r--tests/Jellyfin.Common.Tests/HexTests.cs19
-rw-r--r--tests/Jellyfin.Common.Tests/PasswordHashTests.cs6
2 files changed, 22 insertions, 3 deletions
diff --git a/tests/Jellyfin.Common.Tests/HexTests.cs b/tests/Jellyfin.Common.Tests/HexTests.cs
new file mode 100644
index 000000000..5b578d38c
--- /dev/null
+++ b/tests/Jellyfin.Common.Tests/HexTests.cs
@@ -0,0 +1,19 @@
+using MediaBrowser.Common;
+using Xunit;
+
+namespace Jellyfin.Common.Tests
+{
+ public class HexTests
+ {
+ [Theory]
+ [InlineData("")]
+ [InlineData("00")]
+ [InlineData("01")]
+ [InlineData("000102030405060708090a0b0c0d0e0f")]
+ [InlineData("0123456789abcdef")]
+ public void RoundTripTest(string data)
+ {
+ Assert.Equal(data, Hex.Encode(Hex.Decode(data)));
+ }
+ }
+}
diff --git a/tests/Jellyfin.Common.Tests/PasswordHashTests.cs b/tests/Jellyfin.Common.Tests/PasswordHashTests.cs
index 5fa86f3bd..03523dbc4 100644
--- a/tests/Jellyfin.Common.Tests/PasswordHashTests.cs
+++ b/tests/Jellyfin.Common.Tests/PasswordHashTests.cs
@@ -1,6 +1,6 @@
+using MediaBrowser.Common;
using MediaBrowser.Common.Cryptography;
using Xunit;
-using static MediaBrowser.Common.HexHelper;
namespace Jellyfin.Common.Tests
{
@@ -15,8 +15,8 @@ namespace Jellyfin.Common.Tests
{
var pass = PasswordHash.Parse(passwordHash);
Assert.Equal(id, pass.Id);
- Assert.Equal(salt, ToHexString(pass.Salt));
- Assert.Equal(hash, ToHexString(pass.Hash));
+ Assert.Equal(salt, Hex.Encode(pass.Salt, false));
+ Assert.Equal(hash, Hex.Encode(pass.Hash, false));
}
[Theory]