private void MoveExcludedFolder(VisualStudioApp app, ProjectGenerator pg, MoveDelegate mover) { foreach (var projectType in pg.ProjectTypes) { var testDef = new ProjectDefinition("MoveExcludedFolder", projectType, ProjectGenerator.PropertyGroup( ProjectGenerator.Property("ProjectView", "ShowAllFiles") ), ProjectGenerator.ItemGroup( ProjectGenerator.Folder("Fob", isExcluded: true), ProjectGenerator.Folder("Fob\\Oar", isExcluded: true), ProjectGenerator.Folder("Baz", isExcluded: true) ) ); using (var solution = testDef.Generate().ToVs(app)) { mover( solution, solution.FindItem("MoveExcludedFolder", "Baz"), solution.FindItem("MoveExcludedFolder", "Fob") ); solution.AssertFolderDoesntExist("MoveExcludedFolder", "Fob"); solution.AssertFolderExists("MoveExcludedFolder", "Baz", "Fob"); } } }
private void MoveToMissingFolder(VisualStudioApp app, ProjectGenerator pg, MoveDelegate mover) { foreach (var projectType in pg.ProjectTypes) { var testDef = new ProjectDefinition("MoveToMissingFolder", projectType, ProjectGenerator.PropertyGroup( ProjectGenerator.Property("ProjectView", "ShowAllFiles") ), ProjectGenerator.ItemGroup( ProjectGenerator.Folder("Fob", isExcluded: false, isMissing: true), ProjectGenerator.Compile("codefile", isExcluded: false) ) ); using (var solution = testDef.Generate().ToVs(app)) { mover( solution, solution.FindItem("MoveToMissingFolder", "Fob"), solution.FindItem("MoveToMissingFolder", "codefile" + projectType.CodeExtension) ); solution.AssertFileDoesntExist("MoveToMissingFolder", "codefile" + projectType.CodeExtension); solution.AssertFileExists("MoveToMissingFolder", "Fob", "codefile" + projectType.CodeExtension); } } }
public void RenameStartupFile(VisualStudioApp app, ProjectGenerator pg) { foreach (var projectType in pg.ProjectTypes) { var testDef = new ProjectDefinition( "RenameStartupFileFolder", projectType, ProjectGenerator.Folder("Folder"), ProjectGenerator.Compile("Folder\\server"), ProjectGenerator.Property("StartupFile", "Folder\\server" + projectType.CodeExtension) ); using (var solution = testDef.Generate().ToVs(app)) { var file = solution.GetProject("RenameStartupFileFolder").ProjectItems.Item("Folder").ProjectItems.Item("server" + projectType.CodeExtension); file.Name = "server2" + projectType.CodeExtension; Assert.AreEqual( "server2" + projectType.CodeExtension, Path.GetFileName( (string)solution.GetProject("RenameStartupFileFolder").Properties.Item("StartupFile").Value ) ); } } }
/// <summary> /// Renaming the folder containing the startup script should update the startup script /// https://nodejstools.codeplex.com/workitem/476 /// </summary> public void RenameStartupFileFolder(VisualStudioApp app, ProjectGenerator pg) { foreach (var projectType in pg.ProjectTypes) { var testDef = new ProjectDefinition( "RenameStartupFileFolder", projectType, ProjectGenerator.Folder("Folder"), ProjectGenerator.Compile("Folder\\server"), ProjectGenerator.Property("StartupFile", "Folder\\server" + projectType.CodeExtension) ); using (var solution = testDef.Generate().ToVs(app)) { var folder = solution.GetProject("RenameStartupFileFolder").ProjectItems.Item("Folder"); folder.Name = "FolderNew"; string startupFile = (string)solution.GetProject("RenameStartupFileFolder").Properties.Item("StartupFile").Value; Assert.IsTrue( startupFile.EndsWith(projectType.Code("FolderNew\\server")), "Expected FolderNew in path, got {0}", startupFile ); } } }
/// <summary> /// https://nodejstools.codeplex.com/workitem/194 /// /// Verifies that we deliver the right set of track events to the source /// when we move a folder with a file in it. /// /// The right set of events are based upon matching the same events the C# /// project system delivers. Those can be using the TestSccPackage with a /// C# project. Once enables in Tools->Options->Source Control you can get /// the list of events from Tools->Show Scc Track Document Events. /// </summary> // Currently Fails: https://pytools.codeplex.com/workitem/2609 public void MoveFolderWithItem(VisualStudioApp app, ProjectGenerator pg) { // close any projects before switching source control... app.Dte.Solution.Close(); app.SelectSourceControlProvider("Test Source Provider"); ExpectSourceControl(); foreach (var projectType in pg.ProjectTypes) { var testDef = new ProjectDefinition("SourceControl", projectType, ProjectGenerator.PropertyGroup( ProjectGenerator.Property("SccProjectName", "HelloWorld"), ProjectGenerator.Property("SccLocalPath", "LocalPath"), ProjectGenerator.Property("SccAuxPath", "AuxPath"), ProjectGenerator.Property("SccProvider", "TestProvider") ), ProjectGenerator.ItemGroup( ProjectGenerator.Folder("Fob"), ProjectGenerator.Folder("Fob\\Oar"), ProjectGenerator.Compile("Program"), ProjectGenerator.Compile("Fob\\Oar\\Quox") ) ); using (var solution = testDef.Generate()) { TestSccProvider.DocumentEvents.Clear(); var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog); var window = app.SolutionExplorerTreeView; var folder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl", "Fob", "Oar"); var point = folder.GetClickablePoint(); Mouse.MoveTo(point); Mouse.Down(MouseButton.Left); var destFolder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl"); Mouse.MoveTo(destFolder.GetClickablePoint()); Mouse.Up(MouseButton.Left); app.MaybeCheckMessageBox(MessageBoxButton.Ok, "One or more files will be"); window.AssertFileExists(Path.GetDirectoryName(solution.Filename), "Solution 'SourceControl' (1 project)", "SourceControl", "Oar", "Quox" + projectType.CodeExtension); var projectDir = Path.GetDirectoryName(project.FullName); AssertDocumentEvents(projectDir, OnQueryRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSQUERYRENAMEFILEFLAGS_NoFlags), OnQueryRenameFiles("Fob\\Oar\\", "Oar", VSQUERYRENAMEFILEFLAGS_Directory), OnAfterRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSRENAMEFILEFLAGS_NoFlags), OnAfterRenameFiles("Fob\\Oar\\", "Oar", VSRENAMEFILEFLAGS_Directory) ); } } }
private static ProjectDefinition SourceControlProject(ProjectType projectType) { return(new ProjectDefinition("SourceControl", projectType, ProjectGenerator.PropertyGroup( ProjectGenerator.Property("SccProjectName", "HelloWorld"), ProjectGenerator.Property("SccLocalPath", "LocalPath"), ProjectGenerator.Property("SccAuxPath", "AuxPath"), ProjectGenerator.Property("SccProvider", "TestProvider") ), ProjectGenerator.ItemGroup( ProjectGenerator.Folder("TestFolder"), ProjectGenerator.Compile("Program"), ProjectGenerator.Compile("TestFolder\\SubItem"), ProjectGenerator.Compile("ExcludedFile", isExcluded: true) ) )); }