2020-07-02 00:02:24 +00:00
|
|
|
|
// 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
|
|
|
|
|
{
|
2020-10-26 02:19:57 +00:00
|
|
|
|
public class GivenWindowsApp : TestBase
|
2020-07-02 00:02:24 +00:00
|
|
|
|
{
|
|
|
|
|
[WindowsOnlyTheory]
|
2020-08-31 22:41:21 +00:00
|
|
|
|
[InlineData("10.0.17763.0")]
|
|
|
|
|
[InlineData("10.0.18362.0")]
|
|
|
|
|
[InlineData("10.0.19041.0")]
|
2021-10-06 17:57:55 +00:00
|
|
|
|
[InlineData("10.0.20348.0")]
|
2022-06-14 08:10:25 +00:00
|
|
|
|
[InlineData("10.0.22000.0")]
|
|
|
|
|
[InlineData("10.0.22621.0")]
|
2024-07-15 21:39:34 +00:00
|
|
|
|
[InlineData("10.0.26100.0")]
|
2020-07-02 00:02:24 +00:00
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|