Add kestrel tests.

Tests will 'build', 'run', 'publish' and 'execute' a Kestrel Hello World server as a PortableFatApp and as a Standalone app.
This commit is contained in:
Sridhar Periyasamy 2016-04-04 17:51:36 -07:00
parent f665c28173
commit 8f00b95783
17 changed files with 766 additions and 25 deletions

View file

@ -0,0 +1,48 @@
using System.IO;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
using Microsoft.DotNet.TestFramework;
namespace Microsoft.DotNet.Kestrel.Tests
{
public class DotnetBuildTest : TestBase
{
public static string KestrelPortableApp { get; } = "KestrelPortable";
[Fact]
public void BuildingKestrelPortableFatAppProducesExpectedArtifacts()
{
var testInstance = TestAssetsManager.CreateTestInstance("KestrelSample")
.WithLockFiles();
BuildAndTest(Path.Combine(testInstance.TestRoot, KestrelPortableApp));
}
private static void BuildAndTest(string testRoot)
{
string appName = Path.GetFileName(testRoot);
var result = new BuildCommand(
projectPath: testRoot)
.ExecuteWithCapturedOutput();
result.Should().Pass();
var outputBase = new DirectoryInfo(Path.Combine(testRoot, "bin", "Debug"));
var netstandardappOutput = outputBase.Sub("netstandard1.5");
netstandardappOutput.Should()
.Exist().And
.OnlyHaveFiles(new[]
{
$"{appName}.deps.json",
$"{appName}.dll",
$"{appName}.pdb",
$"{appName}.runtimeconfig.json",
$"{appName}.runtimeconfig.dev.json"
});
}
}
}