2017-05-25 05:51:26 +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;
|
|
|
|
using System.IO;
|
|
|
|
using FluentAssertions;
|
|
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
|
|
using Xunit;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Clean.Tests
|
|
|
|
{
|
|
|
|
public class GivenDotnetCleanCleansBuildArtifacts : TestBase
|
|
|
|
{
|
|
|
|
[Fact]
|
|
|
|
public void ItCleansAProjectBuiltWithRuntimeIdentifier()
|
|
|
|
{
|
|
|
|
var testAppName = "MSBuildTestApp";
|
|
|
|
var testInstance = TestAssets.Get(testAppName)
|
|
|
|
.CreateInstance(testAppName)
|
|
|
|
.WithSourceFiles()
|
|
|
|
.WithRestoreFiles();
|
|
|
|
|
|
|
|
new BuildCommand()
|
|
|
|
.WithRuntime("win7-x64")
|
|
|
|
.WithWorkingDirectory(testInstance.Root)
|
|
|
|
.Execute()
|
|
|
|
.Should().Pass();
|
|
|
|
|
|
|
|
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
|
2017-08-18 22:36:01 +00:00
|
|
|
var outputFolder = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp2.1", "win7-x64");
|
2017-05-25 05:51:26 +00:00
|
|
|
|
|
|
|
outputFolder.Should().NotBeEmpty();
|
|
|
|
|
|
|
|
new CleanCommand()
|
|
|
|
.WithWorkingDirectory(testInstance.Root)
|
|
|
|
.Execute("-r win7-x64")
|
|
|
|
.Should().Pass();
|
|
|
|
|
|
|
|
outputFolder.Should().BeEmpty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|