Skip to content

Commit 4ef648a

Browse files
Ethan CrawfordEthan Crawford
authored andcommitted
detabify
1 parent 74fb716 commit 4ef648a

File tree

1 file changed

+172
-172
lines changed

1 file changed

+172
-172
lines changed

src/ServiceManagement/Services/Commands.Test/Websites/PublishAzureWebsiteProjectTests.cs

Lines changed: 172 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -13,176 +13,176 @@
1313

1414
namespace Microsoft.WindowsAzure.Commands.Test.Websites
1515
{
16-
public class PublishAzureWebsiteProjectTests : WebsitesTestBase
17-
{
18-
[Fact]
19-
[Trait(Category.AcceptanceType, Category.CheckIn)]
20-
public void PublishFromPackageWithoutSetParameters()
21-
{
22-
const string websiteName = "test-site";
23-
const string package = "test-package";
24-
string slot = null;
25-
var connectionStrings = new Hashtable();
26-
connectionStrings["DefaultConnection"] = "test-connection-string";
27-
28-
var publishProfile = new WebSiteGetPublishProfileResponse.PublishProfile
29-
{
30-
UserName = "test-user-name",
31-
UserPassword = "test-password",
32-
PublishUrl = "test-publish-url"
33-
};
34-
35-
var published = false;
36-
37-
var clientMock = new Mock<IWebsitesClient>();
38-
39-
clientMock.Setup(c => c.GetWebDeployPublishProfile(websiteName, slot)).Returns(publishProfile);
40-
clientMock.Setup(c => c.PublishWebProject(websiteName, slot, package, null, connectionStrings, false, false))
41-
.Callback((string n, string s, string p, string spf, Hashtable cs, bool skipAppData, bool doNotDelete) =>
42-
{
43-
Assert.Equal(websiteName, n);
44-
Assert.Equal(slot, s);
45-
Assert.Equal(package, p);
46-
Assert.Equal(connectionStrings, cs);
47-
Assert.False(skipAppData);
48-
Assert.False(doNotDelete);
49-
published = true;
50-
});
51-
52-
var powerShellMock = new Mock<ICommandRuntime>();
53-
54-
var command = new PublishAzureWebsiteProject
55-
{
56-
CommandRuntime = powerShellMock.Object,
57-
Name = websiteName,
58-
Package = package,
59-
ConnectionString = connectionStrings,
60-
WebsitesClient = clientMock.Object,
61-
SetParametersFile = null
62-
};
63-
64-
command.ExecuteCmdlet();
65-
66-
powerShellMock.Verify(f => f.WriteVerbose(string.Format("[Complete] Publishing package {0}", package)), Times.Once());
67-
Assert.True(published);
68-
}
69-
70-
[Fact]
71-
[Trait(Category.AcceptanceType, Category.CheckIn)]
72-
public void PublishFromPackage()
73-
{
74-
var websiteName = "test-site";
75-
string slot = null;
76-
var package = "test-package";
77-
var connectionStrings = new Hashtable();
78-
connectionStrings["DefaultConnection"] = "test-connection-string";
79-
string setParametersFile = "testfile.xml";
80-
81-
var publishProfile = new WebSiteGetPublishProfileResponse.PublishProfile()
82-
{
83-
UserName = "test-user-name",
84-
UserPassword = "test-password",
85-
PublishUrl = "test-publlish-url"
86-
};
87-
88-
var published = false;
89-
90-
Mock<IWebsitesClient> clientMock = new Mock<IWebsitesClient>();
91-
92-
clientMock.Setup(c => c.GetWebDeployPublishProfile(websiteName, slot)).Returns(publishProfile);
93-
clientMock.Setup(c => c.PublishWebProject(websiteName, slot, package, setParametersFile, connectionStrings, false, false))
94-
.Callback((string n, string s, string p, string spf, Hashtable cs, bool skipAppData, bool doNotDelete) =>
95-
{
96-
Assert.Equal(websiteName, n);
97-
Assert.Equal(slot, s);
98-
Assert.Equal(package, p);
99-
Assert.Equal(setParametersFile, spf);
100-
Assert.Equal(connectionStrings, cs);
101-
Assert.False(skipAppData);
102-
Assert.False(doNotDelete);
103-
published = true;
104-
});
105-
106-
Mock<ICommandRuntime> powerShellMock = new Mock<ICommandRuntime>();
107-
108-
var command = new PublishAzureWebsiteProject()
109-
{
110-
CommandRuntime = powerShellMock.Object,
111-
Name = websiteName,
112-
Package = package,
113-
ConnectionString = connectionStrings,
114-
WebsitesClient = clientMock.Object,
115-
SetParametersFile = setParametersFile
116-
};
117-
118-
command.ExecuteCmdlet();
119-
120-
powerShellMock.Verify(f => f.WriteVerbose(string.Format("[Complete] Publishing package {0}", package)), Times.Once());
121-
Assert.True(published);
122-
}
123-
124-
[Fact]
125-
[Trait(Category.AcceptanceType, Category.CheckIn)]
126-
public void PublishFromProjectFile()
127-
{
128-
var websiteName = "test-site";
129-
string slot = null;
130-
var projectFile = string.Format(@"{0}\Resources\MyWebApplication\WebApplication4.csproj", AppDomain.CurrentDomain.BaseDirectory);
131-
var configuration = "Debug";
132-
var logFile = string.Format(@"{0}\build.log", AppDomain.CurrentDomain.BaseDirectory);
133-
var connectionStrings = new Hashtable();
134-
connectionStrings["DefaultConnection"] = "test-connection-string";
135-
string setParametersFile = "testfile.xml";
136-
137-
using (FileSystemHelper files = new FileSystemHelper(this))
138-
{
139-
string originalDirectory = AppDomain.CurrentDomain.BaseDirectory;
140-
}
141-
142-
var publishProfile = new WebSiteGetPublishProfileResponse.PublishProfile()
143-
{
144-
UserName = "test-user-name",
145-
UserPassword = "test-password",
146-
PublishUrl = "test-publlish-url"
147-
};
148-
var package = "test-package.zip";
149-
150-
var published = false;
151-
152-
Mock<IWebsitesClient> clientMock = new Mock<IWebsitesClient>();
153-
154-
clientMock.Setup(c => c.GetWebDeployPublishProfile(websiteName, slot)).Returns(publishProfile);
155-
clientMock.Setup(c => c.BuildWebProject(projectFile, configuration, logFile)).Returns(package);
156-
clientMock.Setup(c => c.PublishWebProject(websiteName, slot, package, setParametersFile, connectionStrings, false, false))
157-
.Callback((string n, string s, string p, string spf, Hashtable cs, bool skipAppData, bool doNotDelete) =>
158-
{
159-
Assert.Equal(websiteName, n);
160-
Assert.Equal(slot, s);
161-
Assert.Equal(package, p);
162-
Assert.Equal(setParametersFile, spf);
163-
Assert.Equal(connectionStrings, cs);
164-
Assert.False(skipAppData);
165-
Assert.False(doNotDelete);
166-
published = true;
167-
});
168-
169-
Mock<ICommandRuntime> powerShellMock = new Mock<ICommandRuntime>();
170-
TestMockSupport.TestExecutionFolder = AppDomain.CurrentDomain.BaseDirectory;
171-
var command = new PublishAzureWebsiteProject()
172-
{
173-
CommandRuntime = powerShellMock.Object,
174-
WebsitesClient = clientMock.Object,
175-
Name = websiteName,
176-
ProjectFile = projectFile,
177-
Configuration = configuration,
178-
ConnectionString = connectionStrings,
179-
SetParametersFile = setParametersFile
180-
};
181-
182-
command.ExecuteCmdlet();
183-
184-
powerShellMock.Verify(f => f.WriteVerbose(string.Format("[Complete] Publishing package {0}", package)), Times.Once());
185-
Assert.True(published);
186-
}
187-
}
16+
public class PublishAzureWebsiteProjectTests : WebsitesTestBase
17+
{
18+
[Fact]
19+
[Trait(Category.AcceptanceType, Category.CheckIn)]
20+
public void PublishFromPackageWithoutSetParameters()
21+
{
22+
const string websiteName = "test-site";
23+
const string package = "test-package";
24+
string slot = null;
25+
var connectionStrings = new Hashtable();
26+
connectionStrings["DefaultConnection"] = "test-connection-string";
27+
28+
var publishProfile = new WebSiteGetPublishProfileResponse.PublishProfile
29+
{
30+
UserName = "test-user-name",
31+
UserPassword = "test-password",
32+
PublishUrl = "test-publish-url"
33+
};
34+
35+
var published = false;
36+
37+
var clientMock = new Mock<IWebsitesClient>();
38+
39+
clientMock.Setup(c => c.GetWebDeployPublishProfile(websiteName, slot)).Returns(publishProfile);
40+
clientMock.Setup(c => c.PublishWebProject(websiteName, slot, package, null, connectionStrings, false, false))
41+
.Callback((string n, string s, string p, string spf, Hashtable cs, bool skipAppData, bool doNotDelete) =>
42+
{
43+
Assert.Equal(websiteName, n);
44+
Assert.Equal(slot, s);
45+
Assert.Equal(package, p);
46+
Assert.Equal(connectionStrings, cs);
47+
Assert.False(skipAppData);
48+
Assert.False(doNotDelete);
49+
published = true;
50+
});
51+
52+
var powerShellMock = new Mock<ICommandRuntime>();
53+
54+
var command = new PublishAzureWebsiteProject
55+
{
56+
CommandRuntime = powerShellMock.Object,
57+
Name = websiteName,
58+
Package = package,
59+
ConnectionString = connectionStrings,
60+
WebsitesClient = clientMock.Object,
61+
SetParametersFile = null
62+
};
63+
64+
command.ExecuteCmdlet();
65+
66+
powerShellMock.Verify(f => f.WriteVerbose(string.Format("[Complete] Publishing package {0}", package)), Times.Once());
67+
Assert.True(published);
68+
}
69+
70+
[Fact]
71+
[Trait(Category.AcceptanceType, Category.CheckIn)]
72+
public void PublishFromPackage()
73+
{
74+
var websiteName = "test-site";
75+
string slot = null;
76+
var package = "test-package";
77+
var connectionStrings = new Hashtable();
78+
connectionStrings["DefaultConnection"] = "test-connection-string";
79+
string setParametersFile = "testfile.xml";
80+
81+
var publishProfile = new WebSiteGetPublishProfileResponse.PublishProfile()
82+
{
83+
UserName = "test-user-name",
84+
UserPassword = "test-password",
85+
PublishUrl = "test-publlish-url"
86+
};
87+
88+
var published = false;
89+
90+
Mock<IWebsitesClient> clientMock = new Mock<IWebsitesClient>();
91+
92+
clientMock.Setup(c => c.GetWebDeployPublishProfile(websiteName, slot)).Returns(publishProfile);
93+
clientMock.Setup(c => c.PublishWebProject(websiteName, slot, package, setParametersFile, connectionStrings, false, false))
94+
.Callback((string n, string s, string p, string spf, Hashtable cs, bool skipAppData, bool doNotDelete) =>
95+
{
96+
Assert.Equal(websiteName, n);
97+
Assert.Equal(slot, s);
98+
Assert.Equal(package, p);
99+
Assert.Equal(setParametersFile, spf);
100+
Assert.Equal(connectionStrings, cs);
101+
Assert.False(skipAppData);
102+
Assert.False(doNotDelete);
103+
published = true;
104+
});
105+
106+
Mock<ICommandRuntime> powerShellMock = new Mock<ICommandRuntime>();
107+
108+
var command = new PublishAzureWebsiteProject()
109+
{
110+
CommandRuntime = powerShellMock.Object,
111+
Name = websiteName,
112+
Package = package,
113+
ConnectionString = connectionStrings,
114+
WebsitesClient = clientMock.Object,
115+
SetParametersFile = setParametersFile
116+
};
117+
118+
command.ExecuteCmdlet();
119+
120+
powerShellMock.Verify(f => f.WriteVerbose(string.Format("[Complete] Publishing package {0}", package)), Times.Once());
121+
Assert.True(published);
122+
}
123+
124+
[Fact]
125+
[Trait(Category.AcceptanceType, Category.CheckIn)]
126+
public void PublishFromProjectFile()
127+
{
128+
var websiteName = "test-site";
129+
string slot = null;
130+
var projectFile = string.Format(@"{0}\Resources\MyWebApplication\WebApplication4.csproj", AppDomain.CurrentDomain.BaseDirectory);
131+
var configuration = "Debug";
132+
var logFile = string.Format(@"{0}\build.log", AppDomain.CurrentDomain.BaseDirectory);
133+
var connectionStrings = new Hashtable();
134+
connectionStrings["DefaultConnection"] = "test-connection-string";
135+
string setParametersFile = "testfile.xml";
136+
137+
using (FileSystemHelper files = new FileSystemHelper(this))
138+
{
139+
string originalDirectory = AppDomain.CurrentDomain.BaseDirectory;
140+
}
141+
142+
var publishProfile = new WebSiteGetPublishProfileResponse.PublishProfile()
143+
{
144+
UserName = "test-user-name",
145+
UserPassword = "test-password",
146+
PublishUrl = "test-publlish-url"
147+
};
148+
var package = "test-package.zip";
149+
150+
var published = false;
151+
152+
Mock<IWebsitesClient> clientMock = new Mock<IWebsitesClient>();
153+
154+
clientMock.Setup(c => c.GetWebDeployPublishProfile(websiteName, slot)).Returns(publishProfile);
155+
clientMock.Setup(c => c.BuildWebProject(projectFile, configuration, logFile)).Returns(package);
156+
clientMock.Setup(c => c.PublishWebProject(websiteName, slot, package, setParametersFile, connectionStrings, false, false))
157+
.Callback((string n, string s, string p, string spf, Hashtable cs, bool skipAppData, bool doNotDelete) =>
158+
{
159+
Assert.Equal(websiteName, n);
160+
Assert.Equal(slot, s);
161+
Assert.Equal(package, p);
162+
Assert.Equal(setParametersFile, spf);
163+
Assert.Equal(connectionStrings, cs);
164+
Assert.False(skipAppData);
165+
Assert.False(doNotDelete);
166+
published = true;
167+
});
168+
169+
Mock<ICommandRuntime> powerShellMock = new Mock<ICommandRuntime>();
170+
TestMockSupport.TestExecutionFolder = AppDomain.CurrentDomain.BaseDirectory;
171+
var command = new PublishAzureWebsiteProject()
172+
{
173+
CommandRuntime = powerShellMock.Object,
174+
WebsitesClient = clientMock.Object,
175+
Name = websiteName,
176+
ProjectFile = projectFile,
177+
Configuration = configuration,
178+
ConnectionString = connectionStrings,
179+
SetParametersFile = setParametersFile
180+
};
181+
182+
command.ExecuteCmdlet();
183+
184+
powerShellMock.Verify(f => f.WriteVerbose(string.Format("[Complete] Publishing package {0}", package)), Times.Once());
185+
Assert.True(published);
186+
}
187+
}
188188
}

0 commit comments

Comments
 (0)