This repository has been archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
When_addons_fail_to_install.cs
53 lines (48 loc) · 1.74 KB
/
When_addons_fail_to_install.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections.Generic;
using Apphbify.Data;
using Apphbify.Services;
using Apphbify.Tests.Helpers;
using Moq;
using Nancy.Testing;
using Xunit;
namespace Apphbify.Tests.Pages.Deploy
{
public class When_addons_fail_to_install
{
private Browser _Browser;
private BrowserResponse _Response;
private Mock<IDeploymentService> _Deploy;
public When_addons_fail_to_install()
{
_Deploy = new Mock<IDeploymentService>(MockBehavior.Strict);
string slug;
_Deploy.Setup(d => d.Deploy(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<App>(), It.IsAny<Dictionary<string, string>>(), out slug)).Returns(DeploymentResult.ErrorInstallingAddons);
_Browser = Testing.CreateBrowser<SecuredPagesModule>(with =>
{
with.LoggedInUser();
with.Deployment(_Deploy);
});
_Response = _Browser.Post("/Deploy/jabbr", with =>
{
with.FormValue("application_name", "JabbR Test");
with.FormValue("region_id", "amazon-web-services::us-east-1");
});
}
[Fact]
public void It_should_redirect_to_sites()
{
_Response.ShouldHaveRedirectedTo("/Sites");
}
[Fact]
public void It_should_have_an_error_message()
{
_Response.ShouldHaveErrorMessage();
}
[Fact]
public void It_should_have_fired_the_deployment()
{
string slug;
_Deploy.Verify(d => d.Deploy(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<App>(), It.IsAny<Dictionary<string, string>>(), out slug), Times.Once());
}
}
}