Another Plex test, slight name change for some.

This commit is contained in:
Mark McDowall 2012-02-21 16:55:21 -08:00
parent 219ea364a9
commit b2a042bd30
1 changed files with 23 additions and 4 deletions

View File

@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.ProviderTests
} }
[Test] [Test]
public void Notify_should_send_update_for_single_client_when_only_one_is_configured() public void Notify_should_send_notification_for_single_client_when_only_one_is_configured()
{ {
//Setup //Setup
WithSingleClient(); WithSingleClient();
@ -144,7 +144,7 @@ namespace NzbDrone.Core.Test.ProviderTests
} }
[Test] [Test]
public void Notify_should_send_update_to_all_configured_clients() public void Notify_should_send_notifcation_to_all_configured_clients()
{ {
//Setup //Setup
WithMultipleClients(); WithMultipleClients();
@ -152,8 +152,6 @@ namespace NzbDrone.Core.Test.ProviderTests
const string header = "Test Header"; const string header = "Test Header";
const string message = "Test Message"; const string message = "Test Message";
var expectedUrl = String.Format("http://localhost:3000/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification({0}, {1}))", header, message);
var fakeHttp = Mocker.GetMock<HttpProvider>(); var fakeHttp = Mocker.GetMock<HttpProvider>();
fakeHttp.Setup(s => s.DownloadString(It.IsAny<string>())) fakeHttp.Setup(s => s.DownloadString(It.IsAny<string>()))
.Returns("ok"); .Returns("ok");
@ -187,5 +185,26 @@ namespace NzbDrone.Core.Test.ProviderTests
//Assert //Assert
fakeHttp.Verify(v => v.DownloadString(expectedUrl, "plex", "plex"), Times.Once()); fakeHttp.Verify(v => v.DownloadString(expectedUrl, "plex", "plex"), Times.Once());
} }
[Test]
public void Notify_should_send_notification_with_credentials_when_configured_for_all_clients()
{
//Setup
WithMultipleClients();
WithClientCredentials();
const string header = "Test Header";
const string message = "Test Message";
var fakeHttp = Mocker.GetMock<HttpProvider>();
fakeHttp.Setup(s => s.DownloadString(It.IsAny<string>(), "plex", "plex"))
.Returns("ok");
//Act
Mocker.Resolve<PlexProvider>().Notify(header, message);
//Assert
fakeHttp.Verify(v => v.DownloadString(It.IsAny<string>(), "plex", "plex"), Times.Exactly(2));
}
} }
} }