Update tests for non-windows platforms
This commit is contained in:
parent
45264edcd7
commit
e94748f172
2 changed files with 25 additions and 22 deletions
|
@ -214,7 +214,7 @@ Args:
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"\"{libref.CsProjPath}\"");
|
.Execute($"\"{libref.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `DotnetAddP2PProjects\Lib\Lib.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{Path.Combine(TestSetup.ProjectName, "Lib", setup.LibCsprojName)}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||||
|
@ -233,7 +233,7 @@ Args:
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
|
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `DotnetAddP2PProjects\Lib\Lib.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{Path.Combine(TestSetup.ProjectName, "Lib", setup.LibCsprojName)}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore - 1);
|
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(libref.Name, ConditionFrameworkNet451).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(libref.Name, ConditionFrameworkNet451).Should().Be(0);
|
||||||
|
@ -253,7 +253,7 @@ Args:
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"\"{libref.CsProjPath}\"");
|
.Execute($"\"{libref.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `DotnetAddP2PProjects\Lib\Lib.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{Path.Combine(TestSetup.ProjectName, "Lib", setup.LibCsprojName)}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||||
|
@ -309,7 +309,7 @@ Args:
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"\"{librefNoCond.CsProjPath}\"");
|
.Execute($"\"{librefNoCond.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `DotnetAddP2PProjects\Lib\Lib.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{Path.Combine(TestSetup.ProjectName, "Lib", setup.LibCsprojName)}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(librefNoCond.Name).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(librefNoCond.Name).Should().Be(0);
|
||||||
|
@ -334,7 +334,7 @@ Args:
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"{FrameworkNet451Arg} \"{librefCond.CsProjPath}\"");
|
.Execute($"{FrameworkNet451Arg} \"{librefCond.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `DotnetAddP2PProjects\Lib\Lib.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{Path.Combine(TestSetup.ProjectName, "Lib", setup.LibCsprojName)}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(librefNoCond.Name).Should().Be(1);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(librefNoCond.Name).Should().Be(1);
|
||||||
|
@ -359,7 +359,7 @@ Args:
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"{FrameworkNet451Arg} \"{librefCondNet451.CsProjPath}\"");
|
.Execute($"{FrameworkNet451Arg} \"{librefCondNet451.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `DotnetAddP2PProjects\Lib\Lib.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{Path.Combine(TestSetup.ProjectName, "Lib", setup.LibCsprojName)}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condNet451Before - 1);
|
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condNet451Before - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(librefCondNet451.Name, ConditionFrameworkNet451).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(librefCondNet451.Name, ConditionFrameworkNet451).Should().Be(0);
|
||||||
|
@ -371,20 +371,20 @@ Args:
|
||||||
[Fact]
|
[Fact]
|
||||||
public void WhenDuplicateReferencesArePresentItRemovesThemAll()
|
public void WhenDuplicateReferencesArePresentItRemovesThemAll()
|
||||||
{
|
{
|
||||||
const string RemovedText = @"Project reference `..\Lib\Lib.csproj` removed.
|
|
||||||
Project reference `..\Lib\Lib.csproj` removed.";
|
|
||||||
|
|
||||||
var setup = Setup();
|
var setup = Setup();
|
||||||
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithDoubledRef"));
|
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithDoubledRef"));
|
||||||
var libref = GetLibRef(setup);
|
var libref = GetLibRef(setup);
|
||||||
|
|
||||||
|
string removedText = $@"Project reference `{setup.LibCsprojRelPath}` removed.
|
||||||
|
Project reference `{setup.LibCsprojRelPath}` removed.";
|
||||||
|
|
||||||
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
|
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||||
var cmd = new RemoveP2PCommand()
|
var cmd = new RemoveP2PCommand()
|
||||||
.WithWorkingDirectory(setup.TestRoot)
|
.WithWorkingDirectory(setup.TestRoot)
|
||||||
.WithProject(proj.CsProjPath)
|
.WithProject(proj.CsProjPath)
|
||||||
.Execute($"\"{libref.CsProjPath}\"");
|
.Execute($"\"{libref.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(RemovedText);
|
cmd.StdOut.Should().Be(removedText);
|
||||||
|
|
||||||
var csproj = proj.CsProj();
|
var csproj = proj.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||||
|
@ -404,7 +404,7 @@ Project reference `..\Lib\Lib.csproj` removed.";
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `..\ValidRef\ValidRef.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||||
|
@ -423,7 +423,7 @@ Project reference `..\Lib\Lib.csproj` removed.";
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `..\ValidRef\ValidRef.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||||
|
@ -442,7 +442,7 @@ Project reference `..\Lib\Lib.csproj` removed.";
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(@"Project reference `..\ValidRef\ValidRef.csproj` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed.");
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||||
|
@ -451,21 +451,21 @@ Project reference `..\Lib\Lib.csproj` removed.";
|
||||||
[Fact]
|
[Fact]
|
||||||
public void WhenPassingMultipleReferencesItRemovesThemAll()
|
public void WhenPassingMultipleReferencesItRemovesThemAll()
|
||||||
{
|
{
|
||||||
const string OutputText = @"Project reference `DotnetAddP2PProjects\Lib\Lib.csproj` removed.
|
|
||||||
Project reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` removed.";
|
|
||||||
|
|
||||||
var lib = NewLibWithFrameworks();
|
var lib = NewLibWithFrameworks();
|
||||||
var setup = Setup();
|
var setup = Setup();
|
||||||
var libref = AddLibRef(setup, lib);
|
var libref = AddLibRef(setup, lib);
|
||||||
var validref = AddValidRef(setup, lib);
|
var validref = AddValidRef(setup, lib);
|
||||||
|
|
||||||
|
string outputText = $@"Project reference `{Path.Combine(TestSetup.ProjectName, "Lib", setup.LibCsprojName)}` removed.
|
||||||
|
Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelPath)}` removed.";
|
||||||
|
|
||||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||||
var cmd = new RemoveP2PCommand()
|
var cmd = new RemoveP2PCommand()
|
||||||
.WithWorkingDirectory(setup.TestRoot)
|
.WithWorkingDirectory(setup.TestRoot)
|
||||||
.WithProject(lib.CsProjPath)
|
.WithProject(lib.CsProjPath)
|
||||||
.Execute($"\"{libref.CsProjPath}\" \"{validref.CsProjPath}\"");
|
.Execute($"\"{libref.CsProjPath}\" \"{validref.CsProjPath}\"");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be(OutputText);
|
cmd.StdOut.Should().Be(outputText);
|
||||||
var csproj = lib.CsProj();
|
var csproj = lib.CsProj();
|
||||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||||
|
@ -481,7 +481,7 @@ Project reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` removed.";
|
||||||
var validref = AddValidRef(setup, lib);
|
var validref = AddValidRef(setup, lib);
|
||||||
|
|
||||||
string OutputText = $@"Project reference `{setup.LibCsprojPath}` could not be found.
|
string OutputText = $@"Project reference `{setup.LibCsprojPath}` could not be found.
|
||||||
Project reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` removed.";
|
Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelPath)}` removed.";
|
||||||
|
|
||||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||||
var cmd = new RemoveP2PCommand()
|
var cmd = new RemoveP2PCommand()
|
||||||
|
|
|
@ -204,11 +204,12 @@ Args:
|
||||||
slnFile.Projects.Count.Should().Be(2);
|
slnFile.Projects.Count.Should().Be(2);
|
||||||
|
|
||||||
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
|
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
|
||||||
|
var projectToRemoveNormalized = @"Lib\Lib.csproj";
|
||||||
var cmd = new DotnetCommand()
|
var cmd = new DotnetCommand()
|
||||||
.WithWorkingDirectory(projectDirectory)
|
.WithWorkingDirectory(projectDirectory)
|
||||||
.ExecuteWithCapturedOutput($"remove project {projectToRemove}");
|
.ExecuteWithCapturedOutput($"remove project {projectToRemove}");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
cmd.StdOut.Should().Be($"Project reference `{projectToRemove}` removed.");
|
cmd.StdOut.Should().Be($"Project reference `{projectToRemoveNormalized}` removed.");
|
||||||
|
|
||||||
slnFile = SlnFile.Read(solutionPath);
|
slnFile = SlnFile.Read(solutionPath);
|
||||||
slnFile.Projects.Count.Should().Be(1);
|
slnFile.Projects.Count.Should().Be(1);
|
||||||
|
@ -230,13 +231,14 @@ Args:
|
||||||
slnFile.Projects.Count.Should().Be(3);
|
slnFile.Projects.Count.Should().Be(3);
|
||||||
|
|
||||||
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
|
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
|
||||||
|
var projectToRemoveNormalized = @"Lib\Lib.csproj";
|
||||||
var cmd = new DotnetCommand()
|
var cmd = new DotnetCommand()
|
||||||
.WithWorkingDirectory(projectDirectory)
|
.WithWorkingDirectory(projectDirectory)
|
||||||
.ExecuteWithCapturedOutput($"remove project {projectToRemove}");
|
.ExecuteWithCapturedOutput($"remove project {projectToRemove}");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
|
|
||||||
string outputText = $@"Project reference `{projectToRemove}` removed.
|
string outputText = $@"Project reference `{projectToRemoveNormalized}` removed.
|
||||||
Project reference `{projectToRemove}` removed.";
|
Project reference `{projectToRemoveNormalized}` removed.";
|
||||||
cmd.StdOut.Should().Be(outputText);
|
cmd.StdOut.Should().Be(outputText);
|
||||||
|
|
||||||
slnFile = SlnFile.Read(solutionPath);
|
slnFile = SlnFile.Read(solutionPath);
|
||||||
|
@ -259,13 +261,14 @@ Project reference `{projectToRemove}` removed.";
|
||||||
slnFile.Projects.Count.Should().Be(2);
|
slnFile.Projects.Count.Should().Be(2);
|
||||||
|
|
||||||
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
|
var projectToRemove = Path.Combine("Lib", "Lib.csproj");
|
||||||
|
var projectToRemoveNormalized = @"Lib\Lib.csproj";
|
||||||
var cmd = new DotnetCommand()
|
var cmd = new DotnetCommand()
|
||||||
.WithWorkingDirectory(projectDirectory)
|
.WithWorkingDirectory(projectDirectory)
|
||||||
.ExecuteWithCapturedOutput($"remove project idontexist.csproj {projectToRemove} idontexisteither.csproj");
|
.ExecuteWithCapturedOutput($"remove project idontexist.csproj {projectToRemove} idontexisteither.csproj");
|
||||||
cmd.Should().Pass();
|
cmd.Should().Pass();
|
||||||
|
|
||||||
string outputText = $@"Project reference `idontexist.csproj` could not be found.
|
string outputText = $@"Project reference `idontexist.csproj` could not be found.
|
||||||
Project reference `{projectToRemove}` removed.
|
Project reference `{projectToRemoveNormalized}` removed.
|
||||||
Project reference `idontexisteither.csproj` could not be found.";
|
Project reference `idontexisteither.csproj` could not be found.";
|
||||||
cmd.StdOut.Should().Be(outputText);
|
cmd.StdOut.Should().Be(outputText);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue