fix errors, enable tests

This commit is contained in:
Bryan Thornbury 2016-09-22 14:30:56 -07:00
parent 3e6e1ddcd0
commit 95e0ed3713
4 changed files with 11 additions and 1 deletions

View file

@ -24,6 +24,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public static Func<string, MigrationError> MIGRATE1016
=> (message) => new MigrationError(nameof(MIGRATE1016), "Unsupported Script Variable", message);
public static Func<string, MigrationError> MIGRATE1017
=> (message) => new MigrationError(nameof(MIGRATE1017), "Multiple Xproj Files", message);
// Potentially Temporary (Point in Time) Errors
public static Func<string, MigrationError> MIGRATE20011
=> (message) => new MigrationError(nameof(MIGRATE20011), "Multi-TFM", message);

View file

@ -72,7 +72,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration
if (allXprojFiles.Count() > 1)
{
throw new Exception("Multiple xproj files found in {projectDirectory}, please specify which to use");
MigrationErrorCodes
.MIGRATE1017($"Multiple xproj files found in {projectDirectory}, please specify which to use")
.Throw();
}
return allXprojFiles.FirstOrDefault();

View file

@ -116,6 +116,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
migratedProjectReferenceItems.Select(m => m.Include).Should().BeEquivalentTo(expectedMigratedReferences);
}
[Fact]
public void It_migrates_csproj_ProjectReference_in_xproj_including_condition_on_ProjectReference()
{
var projectReference = "some/to.csproj";
@ -149,6 +150,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
migratedProjectReferenceItem.Condition.Should().Be(" '$(Foo)' == 'bar' ");
}
[Fact]
public void It_migrates_csproj_ProjectReference_in_xproj_including_condition_on_ProjectReference_parent()
{
var projectReference = "some/to.csproj";
@ -182,6 +184,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
migratedProjectReferenceItem.Condition.Should().Be(" '$(Foo)' == 'bar' ");
}
[Fact]
public void It_migrates_csproj_ProjectReference_in_xproj_including_condition_on_ProjectReference_parent_and_item()
{
var projectReference = "some/to.csproj";

View file

@ -43,6 +43,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Properties.Count(p => p.Name == "TargetFrameworkVersion").Should().Be(0);
}
[Fact]
public void Migrating_MultiTFM_project_Populates_TargetFrameworks_with_short_tfms()
{
var testDirectory = Temp.CreateDirectory().Path;
@ -67,6 +68,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
.Value.Should().Be("net20;net35;net40;net461;netstandard1.5");
}
[Fact]
public void Migrating_Single_TFM_project_Populates_TargetFrameworks_with_short_tfm()
{
var testDirectory = Temp.CreateDirectory().Path;