Turn template test into theory (#90)

This commit is contained in:
Pavel Krymets 2017-08-23 16:44:07 -07:00 committed by GitHub
parent 9778c29007
commit 224c9898c0
1 changed files with 12 additions and 7 deletions

View File

@ -25,19 +25,24 @@ namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
_outputHelper = outputHelper; _outputHelper = outputHelper;
} }
[Fact] [Theory]
public async Task DotnetNewWebRunsInWebApp() [InlineData("web", "Hello World!")]
[InlineData("razor", "Learn how to build ASP.NET apps that can run anywhere.")]
[InlineData("mvc", "Learn how to build ASP.NET apps that can run anywhere.")]
public async Task DotnetNewWebRunsInWebApp(string template, string expected)
{ {
using (var logger = GetLogger()) var testId = nameof(DotnetNewWebRunsInWebApp) + template;
using (var logger = GetLogger(testId))
{ {
Assert.NotNull(_fixture.Azure); Assert.NotNull(_fixture.Azure);
var site = await _fixture.Deploy("Templates\\BasicAppServices.json", null); var site = await _fixture.Deploy("Templates\\BasicAppServices.json", baseName: testId);
var testDirectory = GetTestDirectory(); var testDirectory = GetTestDirectory(testId);
var dotnet = DotNet(logger, testDirectory); var dotnet = DotNet(logger, testDirectory);
var result = await dotnet.ExecuteAsync("new web"); var result = await dotnet.ExecuteAsync("new " + template);
result.AssertSuccess(); result.AssertSuccess();
await site.BuildPublishProfileAsync(testDirectory.FullName); await site.BuildPublishProfileAsync(testDirectory.FullName);
@ -49,7 +54,7 @@ namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
{ {
var getResult = await httpClient.GetAsync("/"); var getResult = await httpClient.GetAsync("/");
getResult.EnsureSuccessStatusCode(); getResult.EnsureSuccessStatusCode();
Assert.Equal("Hello World!", await getResult.Content.ReadAsStringAsync()); Assert.Contains(expected, await getResult.Content.ReadAsStringAsync());
} }
} }
} }