public void CanExplicitlyRemoveAReference() { var fileSystem = new CsprojDefaultingFileSystem(ExampleCsprojFiles.dynamicProxyTests); fileSystem.SetSolutionText( @"D:\envision\CastleCore\Castle.Core\Castle.Core-Modified.sln", ExampleSolutionFiles.strippedCoreSolutionMar2010); Program.Main(fileSystem, new[] { "ModifyProject", "--solution", @"D:\envision\CastleCore\Castle.Core\Castle.Core-Modified.sln", "--project", "Castle.DynamicProxy.Tests-Modified", "--removeAssembly", "Rhino.Mocks.CPP.Interfaces" }); var touched = fileSystem.LoadAsDocument( @"D:\envision\CastleCore\Castle.Core\src\Castle.DynamicProxy.Tests\Castle.DynamicProxy.Tests-Modified.csproj"); var untouched = fileSystem.LoadAsDocument( @"D:\envision\CastleCore\Castle.Core\src\Castle.Core.Tests\Castle.Core.Tests-Modified.csproj)"); Assert.That(untouched.OuterXml, Contains.Substring("Rhino.Mocks.CPP.Interfaces"), "Core tests should still have Rhino Mocks reference."); Assert.IsFalse(touched.OuterXml.Contains("Rhino.Mocks.CPP.Interfaces"), "DynamicProxy tests should not have Rhino Mocks reference."); }
public void SyncBackDoesntDuplicate() { var fileSystem = new CsprojDefaultingFileSystem(); string solutionFileName = @"C:\Projects\MicroKernel.sln"; var filePath = new FilePath(solutionFileName, false); var originalLines = iocSolutionJan2010.AsLines(); fileSystem.Save(filePath, originalLines); Program.Main(fileSystem, new[] { "Modify", "--solution", solutionFileName, "--add", @"C:\TestAssembly.csproj" }); Program.Main(fileSystem, new[] { "Sync", "--fromSolution", @"C:\Projects\MicroKernel-Modified.sln", "--toSolution", solutionFileName, "--rename", "", "--assemblyPaths", "lib" }); var roundTripped = fileSystem.LoadAsLines(filePath); var roundTrippedString = ToSolutionString(roundTripped); // Assert.That(roundTrippedString, Is.EqualTo(iocSolutionJan2010)); Assert.That(roundTripped.Last(), Is.EqualTo("EndGlobal")); // Should end with the global section var projectCount = roundTripped.Count(x => x == "EndProject"); Assert.That(projectCount, Is.EqualTo(originalLines.Count(x => x == "EndProject"))); // var parser = new SolutionFileParser(fileSystem); // var solution = parser.Parse(filePath, roundTripped); }
public void SyncBackDoesntDuplicate() { var fileSystem = new CsprojDefaultingFileSystem(); IEnumerable<string> originalLines = fileSystem.SetSolutionText( @"C:\dev\Castle\git\Core\Castle.Core-vs2008.sln", castleCoreWithLogging); Program.Main(fileSystem, new[] { "Modify", "--solution", @"C:\dev\Castle\git\Core\Castle.Core-vs2008.sln", "--rename", "-vs2008sl", "--remove", "Castle.Services.Logging.log4netIntegration-vs2008" }); var silverlightSolutionPath = new FilePath(@"C:\dev\Castle\git\Core\Castle.Core-vs2008SL.sln", false); var silverlightLines = fileSystem.LoadAsLines(silverlightSolutionPath); var projectCount = silverlightLines.Count(x => x == "EndProject"); Assert.That(projectCount, Is.EqualTo(originalLines.Count(x => x == "EndProject") - 1)); Program.Main(fileSystem, new[] { "Modify", "--solution", @"C:\dev\Castle\git\Core\Castle.Core-vs2008.sln", "--rename", "-vs2008sl", "--remove", "Castle.Services.Logging.log4netIntegration-vs2008", "Castle.Services.Logging.NLogIntegration-vs2008" }); var silverlightLines2 = fileSystem.LoadAsLines(silverlightSolutionPath); var projectCount2 = silverlightLines2.Count(x => x == "EndProject"); Assert.That(projectCount2, Is.EqualTo(originalLines.Count(x => x == "EndProject") - 2)); }
public void ModifyDeleteShouldNotRemoveAllProjectReferences() { var fileSystem = new CsprojDefaultingFileSystem(ExampleCsprojFiles.dynamicProxyTests); IEnumerable<string> originalLines = fileSystem.SetSolutionText( @"C:\dev\Castle\git\Core\Castle.Core-vs2008.sln", castleCoreWithLogging); Program.Main(fileSystem, new[] { "Modify", "--solution", @"C:\dev\Castle\git\Core\Castle.Core-vs2008.sln", "--rename", "-vs2008sl", "--remove", "Castle.Services.Logging.log4netIntegration-vs2008" }); var csproj = fileSystem.LoadAsDocument( @"c:\dev\castle\git\core\src\Castle.Core.Tests\Castle.Core.Tests-vs2008sl.csproj"); Assert.That(csproj.OuterXml, Contains.Substring("ProjectReference"), "The command incorrectly removed a project reference."); }