Пример #1
0
        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");
                }
            }
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
        /// <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)
                                         );
                }
            }
        }
Пример #4
0
 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)
                                      )
                                  ));
 }