blob: 7b9d6863607d203bdd1f3da57e3e0365de6faed3 (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Xunit;
using Microsoft.DotNet.Cli.Build.Framework;
using Microsoft.DotNet.CoreSetup.Test;
using Microsoft.NET.HostModel.Bundle;
using BundleTests.Helpers;
namespace Microsoft.NET.HostModel.Tests
{
public class BundleLegacy : IClassFixture<BundleLegacy.SharedTestState>
{
private SharedTestState sharedTestState;
public BundleLegacy(SharedTestState fixture)
{
sharedTestState = fixture;
}
[InlineData(0)]
[InlineData(1)]
[Theory]
public void TestNetCoreApp3xApp(int minorVersion)
{
var fixture = (minorVersion == 0) ? sharedTestState.TestFixture30.Copy() : sharedTestState.TestFixture31.Copy();
// Targetting netcoreap3.x implies BundleOption.BundleAllContent
var singleFile = BundleHelper.BundleApp(fixture, BundleOptions.None, new Version(3, minorVersion));
Command.Create(singleFile)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World!");
}
private static TestProjectFixture CreatePublishedFixture(string netCoreAppFramework, string mnaVersion)
{
var repoDirectories = new RepoDirectoriesProvider(microsoftNETCoreAppVersion: mnaVersion);
var fixture = new TestProjectFixture("StandaloneApp3x", repoDirectories, framework: netCoreAppFramework, assemblyName: "StandaloneApp");
fixture.PublishProject(runtime: fixture.CurrentRid, outputDirectory: BundleHelper.GetPublishPath(fixture), restore: true);
return fixture;
}
public class SharedTestState : IDisposable
{
public TestProjectFixture TestFixture30 { get; set; }
public TestProjectFixture TestFixture31 { get; set; }
public SharedTestState()
{
TestFixture30 = CreatePublishedFixture("netcoreapp3.0", "3.0.0");
TestFixture31 = CreatePublishedFixture("netcoreapp3.1", "3.1.0");
}
public void Dispose()
{
TestFixture30.Dispose();
TestFixture31.Dispose();
}
}
}
}
|