dotnet-installer/test/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs
Krzysztof Wicher a6bc22e499 Remove TAM (#5670)
* remove reference to TestAssetsManager in dotnet-add-reference

* remove TestAssetsManager dependency from dotnet-build

* remove TAM ref from dotnet-list-reference

* remove TAM dependency from dotnet-msbuild

* remove TAM dependency from ProjectJsonMigration tests

* remove TAM dependency from dotnet.Tests

* remove TAM dependency from dotnet-new.Tests

* remove TAM from dotnet-pack.Tests

* remove TAM from dotnet-publish.Tests

* remove TAM from dotnet-restore.Tests

* remove TAM dependency from dotnet-remove-reference.Tests

* remove TAM dependency from dotnet-run.Tests

* remove TAM dependency from dotnet-test.Tests

* remove TAM dependency from Microsoft.DotNet.Cli.Utils.Tests

* remove TAM from TestBase

* remove TAM

* remove newly introduced dependency on TAM
2017-02-15 15:35:03 -08:00

91 lines
3.1 KiB
C#

// 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.Collections.Generic;
using System.IO;
using Microsoft.Build.Construction;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
using FluentAssertions;
using System.Linq;
namespace Microsoft.DotNet.Restore.Tests
{
public class GivenThatIWantToRestoreApp : TestBase
{
[Fact]
public void ItRestoresAppToSpecificDirectory()
{
var rootPath = TestAssets.CreateTestDirectory().FullName;
string dir = "pkgs";
string fullPath = Path.GetFullPath(Path.Combine(rootPath, dir));
string newArgs = $"console -o \"{rootPath}\"";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)
.Should()
.Pass();
string args = $"--packages \"{dir}\"";
new RestoreCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput(args)
.Should()
.Pass()
.And.NotHaveStdErr();
Directory.Exists(fullPath).Should().BeTrue();
Directory.EnumerateFiles(fullPath, "*.dll", SearchOption.AllDirectories).Count().Should().BeGreaterThan(0);
}
[Fact]
public void ItRestoresLibToSpecificDirectory()
{
var rootPath = TestAssets.CreateTestDirectory().FullName;
string dir = "pkgs";
string fullPath = Path.GetFullPath(Path.Combine(rootPath, dir));
string newArgs = $"classlib -o \"{rootPath}\"";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)
.Should()
.Pass();
string args = $"--packages \"{dir}\"";
new RestoreCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput(args)
.Should()
.Pass()
.And.NotHaveStdErr();
Directory.Exists(fullPath).Should().BeTrue();
Directory.EnumerateFiles(fullPath, "*.dll", SearchOption.AllDirectories).Count().Should().BeGreaterThan(0);
}
[Fact]
public void ItRestoresTestAppToSpecificDirectory()
{
var rootPath = TestAssets.Get("VSTestDotNetCore").CreateInstance().WithSourceFiles().Root.FullName;
string dir = "pkgs";
string fullPath = Path.GetFullPath(Path.Combine(rootPath, dir));
string args = $"--packages \"{dir}\"";
new RestoreCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput(args)
.Should()
.Pass()
.And.NotHaveStdErr();
Directory.Exists(fullPath).Should().BeTrue();
Directory.EnumerateFiles(fullPath, "*.dll", SearchOption.AllDirectories).Count().Should().BeGreaterThan(0);
}
}
}