remove nuget dependency in tests
This commit is contained in:
parent
8a420de736
commit
a688885f21
5 changed files with 9 additions and 12 deletions
|
@ -92,12 +92,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
||||||
|
|
||||||
var defaultProjectContext = projectContexts.First();
|
var defaultProjectContext = projectContexts.First();
|
||||||
|
|
||||||
if (defaultProjectContext.LockFile == null)
|
|
||||||
{
|
|
||||||
MigrationErrorCodes.MIGRATE1012(
|
|
||||||
$"project.lock.json not found in {projectDirectory}, please run dotnet restore before doing migration").Throw();
|
|
||||||
}
|
|
||||||
|
|
||||||
var diagnostics = defaultProjectContext.ProjectFile.Diagnostics;
|
var diagnostics = defaultProjectContext.ProjectFile.Diagnostics;
|
||||||
if (diagnostics.Any())
|
if (diagnostics.Any())
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
public void It_copies_ProjectDirectory_contents_to_OutputDirectory_when_the_directories_are_different()
|
public void It_copies_ProjectDirectory_contents_to_OutputDirectory_when_the_directories_are_different()
|
||||||
{
|
{
|
||||||
var testProjectDirectory = TestAssetsManager.CreateTestInstance("TestAppSimple", callingMethod: "z")
|
var testProjectDirectory = TestAssetsManager.CreateTestInstance("TestAppSimple", callingMethod: "z")
|
||||||
.WithLockFiles().Path;
|
.Path;
|
||||||
var outputDirectory = Temp.CreateDirectory().Path;
|
var outputDirectory = Temp.CreateDirectory().Path;
|
||||||
|
|
||||||
var projectDirectoryRelativeFilePaths = EnumerateFilesWithRelativePath(testProjectDirectory);
|
var projectDirectoryRelativeFilePaths = EnumerateFilesWithRelativePath(testProjectDirectory);
|
||||||
|
@ -41,7 +41,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
{
|
{
|
||||||
var testProjectDirectory =
|
var testProjectDirectory =
|
||||||
TestAssetsManager.CreateTestInstance("TestLibraryWithDeprecatedProjectFile", callingMethod: "z")
|
TestAssetsManager.CreateTestInstance("TestLibraryWithDeprecatedProjectFile", callingMethod: "z")
|
||||||
.WithLockFiles().Path;
|
.Path;
|
||||||
|
|
||||||
var mockProj = ProjectRootElement.Create();
|
var mockProj = ProjectRootElement.Create();
|
||||||
var testSettings = new MigrationSettings(testProjectDirectory, testProjectDirectory, "1.0.0", mockProj);
|
var testSettings = new MigrationSettings(testProjectDirectory, testProjectDirectory, "1.0.0", mockProj);
|
||||||
|
@ -60,7 +60,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
{
|
{
|
||||||
var testProjectDirectory =
|
var testProjectDirectory =
|
||||||
TestAssetsManager.CreateTestInstance("FSharpTestProjects/TestApp", callingMethod: "z")
|
TestAssetsManager.CreateTestInstance("FSharpTestProjects/TestApp", callingMethod: "z")
|
||||||
.WithLockFiles().Path;
|
.Path;
|
||||||
|
|
||||||
var mockProj = ProjectRootElement.Create();
|
var mockProj = ProjectRootElement.Create();
|
||||||
var testSettings = new MigrationSettings(testProjectDirectory, testProjectDirectory, "1.0.0", mockProj);
|
var testSettings = new MigrationSettings(testProjectDirectory, testProjectDirectory, "1.0.0", mockProj);
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
public void If_a_project_dependency_is_present_DesignTimeAutoUnify_and_AutoUnify_are_present()
|
public void If_a_project_dependency_is_present_DesignTimeAutoUnify_and_AutoUnify_are_present()
|
||||||
{
|
{
|
||||||
var solutionDirectory =
|
var solutionDirectory =
|
||||||
TestAssetsManager.CreateTestInstance("TestAppWithLibrary", callingMethod: "p").WithLockFiles().Path;
|
TestAssetsManager.CreateTestInstance("TestAppWithLibrary", callingMethod: "p").Path;
|
||||||
|
|
||||||
var appDirectory = Path.Combine(solutionDirectory, "TestApp");
|
var appDirectory = Path.Combine(solutionDirectory, "TestApp");
|
||||||
var libDirectory = Path.Combine(solutionDirectory, "TestLibrary");
|
var libDirectory = Path.Combine(solutionDirectory, "TestLibrary");
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public void RuntimeOptions_are_copied_from_projectJson_to_runtimeconfig_template_json_file()
|
public void RuntimeOptions_are_copied_from_projectJson_to_runtimeconfig_template_json_file()
|
||||||
{
|
{
|
||||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithRuntimeOptions").WithLockFiles();
|
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithRuntimeOptions");
|
||||||
var projectDir = testInstance.Path;
|
var projectDir = testInstance.Path;
|
||||||
var projectPath = Path.Combine(testInstance.Path, "project.json");
|
var projectPath = Path.Combine(testInstance.Path, "project.json");
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Migrating_ProjectJson_with_no_RuntimeOptions_produces_no_runtimeconfig_template_json_file()
|
public void Migrating_ProjectJson_with_no_RuntimeOptions_produces_no_runtimeconfig_template_json_file()
|
||||||
{
|
{
|
||||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppSimple").WithLockFiles();
|
var testInstance = TestAssetsManager.CreateTestInstance("TestAppSimple");
|
||||||
var projectDir = testInstance.Path;
|
var projectDir = testInstance.Path;
|
||||||
|
|
||||||
var projectContext = ProjectContext.Create(projectDir, FrameworkConstants.CommonFrameworks.NetCoreApp10);
|
var projectContext = ProjectContext.Create(projectDir, FrameworkConstants.CommonFrameworks.NetCoreApp10);
|
||||||
|
|
|
@ -142,6 +142,9 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
var projectJsonBuildOutputs = new HashSet<string>(CollectBuildOutputs(projectDirectory));
|
var projectJsonBuildOutputs = new HashSet<string>(CollectBuildOutputs(projectDirectory));
|
||||||
CleanBinObj(projectDirectory);
|
CleanBinObj(projectDirectory);
|
||||||
|
|
||||||
|
// Remove lock file for migration
|
||||||
|
File.Delete(Path.Combine(projectDirectory, "project.lock.json"));
|
||||||
|
|
||||||
MigrateProject(projectDirectory);
|
MigrateProject(projectDirectory);
|
||||||
Restore(projectDirectory);
|
Restore(projectDirectory);
|
||||||
BuildMSBuild(projectDirectory);
|
BuildMSBuild(projectDirectory);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue