Exemple #1
0
        /// <summary>
        /// Move item within the project from one location to where it already exists, skipping the move.
        /// </summary>
        private void MoveDuplicateFileNameSkipMove(MoveDelegate mover)
        {
            foreach (var projectType in ProjectTypes)
            {
                var testDef = new ProjectDefinition("MoveDuplicateFileName",
                                                    projectType,
                                                    ItemGroup(
                                                        Folder("Folder"),
                                                        Content("textfile.txt", "root"),
                                                        Content("Folder\\textfile.txt", "Folder")
                                                        )
                                                    );

                using (var solution = testDef.Generate().ToVs()) {
                    mover(
                        solution.FindItem("MoveDuplicateFileName", "Folder"),
                        solution.FindItem("MoveDuplicateFileName", "textfile.txt")
                        );

                    using (var dialog = OverwriteFileDialog.Wait(solution.App)) {
                        dialog.No();
                    }

                    solution.App.WaitForDialogDismissed();

                    solution.AssertFileExistsWithContent("root", "MoveDuplicateFileName", "textfile.txt");
                    solution.AssertFileExistsWithContent("Folder", "MoveDuplicateFileName", "Folder", "textfile.txt");
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Cut 2 items, paste where they exist, skip pasting the 1st one but paste the 2nd.
        ///
        /// The 1st item shouldn't be removed from the parent hierarchy, the 2nd should, and only the 2nd item should be overwritten.
        /// </summary>
        private void MoveDuplicateFileNamesCrossProjectSkipOne(MoveDelegate mover)
        {
            foreach (var projectType in ProjectTypes)
            {
                var projectDefs = new[] {
                    new ProjectDefinition("MoveDuplicateFileName",
                                          projectType,
                                          ItemGroup(
                                              Content("textfile1.txt", "textfile1 - lang"),
                                              Content("textfile2.txt", "textfile2 - lang")
                                              )
                                          ),
                    new ProjectDefinition("MoveDuplicateFileName2",
                                          projectType,
                                          ItemGroup(
                                              Folder("Folder"),
                                              Content("textfile1.txt", "textfile1 - 2"),
                                              Content("textfile2.txt", "textfile2 - 2")
                                              )
                                          )
                };

                using (var solution = SolutionFile.Generate("MoveDuplicateFileName", projectDefs).ToVs()) {
                    var item1 = solution.FindItem("MoveDuplicateFileName", "textfile1.txt");
                    var item2 = solution.FindItem("MoveDuplicateFileName", "textfile2.txt");
                    mover(
                        solution.FindItem("MoveDuplicateFileName2"),
                        item1,
                        item2
                        );

                    using (var dialog = OverwriteFileDialog.Wait(solution.App)) {
                        dialog.No();
                    }

                    System.Threading.Thread.Sleep(1000);

                    using (var dialog = OverwriteFileDialog.Wait(solution.App)) {
                        dialog.Yes();
                    }

                    solution.App.WaitForDialogDismissed();

                    solution.AssertFileExistsWithContent("textfile1 - lang", "MoveDuplicateFileName", "textfile1.txt");
                    solution.AssertFileExistsWithContent("textfile2 - lang", "MoveDuplicateFileName", "textfile2.txt");
                    solution.AssertFileExistsWithContent("textfile1 - 2", "MoveDuplicateFileName2", "textfile1.txt");
                    solution.AssertFileExistsWithContent("textfile2 - lang", "MoveDuplicateFileName2", "textfile2.txt");
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Cut 2 items, paste where they exist, skip pasting the 1st one but paste the 2nd.
        ///
        /// The 1st item shouldn't be removed from the parent hierarchy, the 2nd should, and only the 2nd item should be overwritten.
        /// </summary>
        private void MoveDuplicateFileNamesFoldersSkipOne(MoveDelegate mover)
        {
            foreach (var projectType in ProjectTypes)
            {
                var testDef = new ProjectDefinition("MoveDuplicateFileName",
                                                    projectType,
                                                    ItemGroup(
                                                        Folder("Source"),
                                                        Content("Source\\textfile1.txt", "source1"),
                                                        Content("Source\\textfile2.txt", "source2"),

                                                        Folder("Target"),
                                                        Content("Target\\textfile1.txt", "target1"),
                                                        Content("Target\\textfile2.txt", "target2")
                                                        )
                                                    );

                using (var solution = testDef.Generate().ToVs()) {
                    mover(
                        solution.FindItem("MoveDuplicateFileName", "Target"),
                        solution.FindItem("MoveDuplicateFileName", "Source", "textfile1.txt"),
                        solution.FindItem("MoveDuplicateFileName", "Source", "textfile2.txt")
                        );

                    using (var dialog = OverwriteFileDialog.Wait(solution.App)) {
                        dialog.No();
                    }

                    System.Threading.Thread.Sleep(1000);

                    using (var dialog = OverwriteFileDialog.Wait(solution.App)) {
                        dialog.Yes();
                    }

                    solution.App.WaitForDialogDismissed();

                    solution.AssertFileExistsWithContent("source1", "MoveDuplicateFileName", "Source", "textfile1.txt");
                    solution.AssertFileDoesntExist("MoveDuplicateFileName", "textfile2.txt");
                    solution.AssertFileExistsWithContent("target1", "MoveDuplicateFileName", "Target", "textfile1.txt");
                    solution.AssertFileExistsWithContent("source2", "MoveDuplicateFileName", "Target", "textfile2.txt");
                }
            }
        }