diff --git a/src/NzbDrone.Core.Test/SecurityTests/ProtectionServiceFixture.cs b/src/NzbDrone.Core.Test/SecurityTests/ProtectionServiceFixture.cs new file mode 100644 index 000000000..1030ecaba --- /dev/null +++ b/src/NzbDrone.Core.Test/SecurityTests/ProtectionServiceFixture.cs @@ -0,0 +1,36 @@ +using System; +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.Configuration; +using NzbDrone.Core.Security; +using NzbDrone.Core.Test.Framework; + +namespace NzbDrone.Core.Test.SecurityTests +{ + [TestFixture] + public class ProtectionServiceFixture : CoreTest + { + private string _protectionKey; + + [SetUp] + public void Setup() + { + _protectionKey = Guid.NewGuid().ToString().Replace("-", ""); + + Mocker.GetMock() + .SetupGet(s => s.DownloadProtectionKey) + .Returns(_protectionKey); + } + + [Test] + public void should_encrypt_and_decrypt_string() + { + const string plainText = "https://prowlarr.com"; + + var encrypted = Subject.Protect(plainText); + var decrypted = Subject.UnProtect(encrypted); + + decrypted.Should().Be(plainText); + } + } +}