Update tests for .NET 6
This commit is contained in:
parent
66318e6fc4
commit
9ec9fce35e
5 changed files with 11 additions and 19 deletions
45
test/EndToEnd/GivenWindowsApp.cs
Normal file
45
test/EndToEnd/GivenWindowsApp.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace EndToEnd
|
||||
{
|
||||
public class GivenWindowsApp : TestBase
|
||||
{
|
||||
[WindowsOnlyTheory]
|
||||
[InlineData("10.0.17763.0")]
|
||||
[InlineData("10.0.18362.0")]
|
||||
[InlineData("10.0.19041.0")]
|
||||
public void ItCanBuildAndRun(string targetPlatformVersion)
|
||||
{
|
||||
var testInstance = TestAssets.Get(TestAssetKinds.TestProjects, "UseCswinrt")
|
||||
.CreateInstance("UseCswinrt" + targetPlatformVersion)
|
||||
.WithSourceFiles();
|
||||
|
||||
var projectPath = Path.Combine(testInstance.Root.FullName, "consolecswinrt.csproj");
|
||||
var project = XDocument.Load(projectPath);
|
||||
var ns = project.Root.Name.Namespace;
|
||||
|
||||
// Update TargetFramework to the right version of .NET Core
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Add(new XElement(ns + "TargetPlatformVersion", targetPlatformVersion));
|
||||
|
||||
project.Save(projectPath);
|
||||
|
||||
new BuildCommand()
|
||||
.WithProjectFile(new FileInfo(testInstance.Root.FullName))
|
||||
.Execute()
|
||||
.Should().Pass();
|
||||
|
||||
new RunCommand().WithWorkingDirectory(testInstance.Root.FullName)
|
||||
.Execute("--no-build")
|
||||
.Should().Pass().And.HaveStdOutContaining("Hello");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue