sonarr-repo-only/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs

46 lines
1.4 KiB
C#
Raw Normal View History

2013-07-19 03:47:55 +00:00
using NUnit.Framework;
2013-05-19 23:17:32 +00:00
using NzbDrone.Core.Notifications.Prowl;
2011-11-03 02:44:22 +00:00
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.NotificationTests
2011-11-03 02:44:22 +00:00
{
[Explicit]
[TestFixture]
public class ProwlProviderTest : CoreTest<ProwlService>
2011-11-03 02:44:22 +00:00
{
private const string _apiKey = "66e9f688b512152eb2688f0486ae542c76e564a2";
2011-11-03 02:44:22 +00:00
private const string _badApiKey = "1234567890abcdefghijklmnopqrstuvwxyz1234";
[Test]
public void Verify_should_not_throw_for_a_valid_apiKey()
2011-11-03 02:44:22 +00:00
{
Subject.Verify(_apiKey);
ExceptionVerification.ExpectedWarns(0);
2011-11-03 02:44:22 +00:00
}
[Test]
public void Verify_should_throw_for_an_invalid_apiKey()
2011-11-03 02:44:22 +00:00
{
Assert.Throws<InvalidApiKeyException>(() => Subject.Verify(_badApiKey));
2013-03-28 22:07:09 +00:00
ExceptionVerification.ExpectedWarns(1);
2011-11-03 02:44:22 +00:00
}
[Test]
public void SendNotification_should_not_throw_for_a_valid_apiKey()
2011-11-03 02:44:22 +00:00
{
Subject.SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey);
ExceptionVerification.ExpectedWarns(0);
2011-11-03 02:44:22 +00:00
}
[Test]
public void SendNotification_should_log_a_warning_for_an_invalid_apiKey()
2011-11-03 02:44:22 +00:00
{
Subject.SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _badApiKey);
2011-11-03 02:44:22 +00:00
ExceptionVerification.ExpectedWarns(1);
2011-11-03 02:44:22 +00:00
}
}
}