当前位置: 首页>>代码示例>>C#>>正文


C# ProjectDefinition.Generate方法代码示例

本文整理汇总了C#中TestUtilities.SharedProject.ProjectDefinition.Generate方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectDefinition.Generate方法的具体用法?C# ProjectDefinition.Generate怎么用?C# ProjectDefinition.Generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestUtilities.SharedProject.ProjectDefinition的用法示例。


在下文中一共展示了ProjectDefinition.Generate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MoveToMissingFolder

        private void MoveToMissingFolder(MoveDelegate mover) {
            foreach (var projectType in ProjectTypes) {
                var testDef = new ProjectDefinition("MoveToMissingFolder",
                    projectType,
                    PropertyGroup(
                        Property("ProjectView", "ShowAllFiles")
                    ),
                    ItemGroup(
                        Folder("Fob", isExcluded: false, isMissing: true),
                        Compile("codefile", isExcluded: false)
                    )
                );

                using (var solution = testDef.Generate().ToVs()) {
                    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);
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:25,代码来源:NewDragDropCopyCutPaste.cs

示例2: CutRenamePaste

        public void CutRenamePaste() {
            foreach (var projectType in ProjectTypes) {
                var testDef = new ProjectDefinition("DragDropCopyCutPaste",
                    projectType,
                    ItemGroup(
                        Folder("CutRenamePaste"),
                        Compile("CutRenamePaste\\CutRenamePaste")
                    )
                );

                using (var solution = testDef.Generate().ToMockVs()) {
                    var project = solution.WaitForItem("DragDropCopyCutPaste");
                    var file = solution.WaitForItem("DragDropCopyCutPaste", "CutRenamePaste", "CutRenamePaste" + projectType.CodeExtension);

                    file.Select();
                    solution.ControlX();

                    file.Select();
                    solution.Type(Key.F2);
                    solution.Type("CutRenamePasteNewName");
                    solution.Type(Key.Enter);

                    solution.Sleep(1000);
                    project.Select();
                    solution.ControlV();

                    solution.CheckMessageBox("The source URL 'CutRenamePaste" + projectType.CodeExtension + "' could not be found.");
                }
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:30,代码来源:ProjectTests.cs

示例3: MoveFolderWithItem

        // Currently Fails: https://pytools.codeplex.com/workitem/2609
        public void MoveFolderWithItem() {
            using (var app = new VisualStudioApp()) {

                // close any projects before switching source control...
                app.Dte.Solution.Close();

                app.SelectSourceControlProvider("Test Source Provider");

                ExpectSourceControl();

                foreach (var projectType in ProjectTypes) {
                    var testDef = new ProjectDefinition("SourceControl", projectType,
                        PropertyGroup(
                            Property("SccProjectName", "HelloWorld"),
                            Property("SccLocalPath", "LocalPath"),
                            Property("SccAuxPath", "AuxPath"),
                            Property("SccProvider", "TestProvider")
                        ),
                        ItemGroup(
                            Folder("Fob"),
                            Folder("Fob\\Oar"),
                            Compile("Program"),
                            Compile("Fob\\Oar\\Quox")
                        )
                    );

                    using (var solution = testDef.Generate()) {
                        TestSccProvider.DocumentEvents.Clear();

                        var project = app.OpenProject(solution.Filename);
                        var window = app.OpenSolutionExplorer();
                        
                        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);

                        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)
                        );
                    }
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:54,代码来源:SourceControl.cs

示例4: RunWithoutStartupFile

        public void RunWithoutStartupFile() {
            foreach (var projectType in ProjectTypes) {
                var testDef = new ProjectDefinition("RunWithoutStartupFile", projectType);

                using (var solution = testDef.Generate().ToVs()) {
                    solution.OpenDialogWithDteExecuteCommand("Debug.Start");
                    solution.CheckMessageBox("startup file");

                    solution.OpenDialogWithDteExecuteCommand("Debug.StartWithoutDebugging");
                    solution.CheckMessageBox("startup file");
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:13,代码来源:ScriptProjectTests.cs

示例5: MultiPaste

        /// <summary>
        /// Cut item, paste into folder, paste into top-level, 2nd paste should prompt for overwrite
        /// </summary>
        private void MultiPaste(MoveDelegate mover) {
            foreach (var projectType in ProjectTypes) {
                var testDef = new ProjectDefinition("HelloWorld",
                    projectType,
                    ItemGroup(
                        Compile("server"),
                        Compile("server2"),
                        Folder("SubFolder")
                    )
                );

                using (var solution = testDef.Generate().ToVs()) {
                    var server = solution.WaitForItem("HelloWorld", "server" + projectType.CodeExtension);
                    var server2 = solution.WaitForItem("HelloWorld", "server2" + projectType.CodeExtension);

                    mover(
                        solution,
                        solution.WaitForItem("HelloWorld", "SubFolder"),
                        solution.WaitForItem("HelloWorld", "server" + projectType.CodeExtension),
                        solution.WaitForItem("HelloWorld", "server2" + projectType.CodeExtension)
                    );

                    // paste once, multiple items should be pasted
                    Assert.IsNotNull(solution.WaitForItem("HelloWorld", "SubFolder", "server" + projectType.CodeExtension));
                    Assert.IsNotNull(solution.WaitForItem("HelloWorld", "SubFolder", "server2" + projectType.CodeExtension));

                    solution.SelectSolutionNode();

                    mover(
                        solution,
                        solution.WaitForItem("HelloWorld", "SubFolder"),
                        solution.WaitForItem("HelloWorld", "server" + projectType.CodeExtension),
                        solution.WaitForItem("HelloWorld", "server2" + projectType.CodeExtension)
                    );

                    // paste again, we should get the replace prompts...
                    using (var dialog = solution.WaitForOverwriteFileDialog()) {
                        dialog.Cancel();
                    }

                    // https://pytools.codeplex.com/workitem/1154
                    // and we shouldn't get a second dialog after cancelling...
                    solution.WaitForDialogDismissed();
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:49,代码来源:DragDropCopyCutPaste.cs

示例6: ShowAllFilesToggle

        public void ShowAllFilesToggle() {
            foreach (var projectType in ProjectTypes) {
                var def = new ProjectDefinition(
                    "ShowAllFiles",
                    projectType,
                    Folder("SubFolder"),
                    Compile("SubFolder\\server"),
                    Property("ProjectView", "ProjectFiles")
                );

                using (var solution = def.Generate().ToVs()) {
                    var projectNode = solution.WaitForItem("ShowAllFiles", "SubFolder", "server" + projectType.CodeExtension);
                    AutomationWrapper.Select(projectNode);

                    solution.ExecuteCommand("Project.ShowAllFiles"); // start showing all

                    Assert.IsTrue(solution.GetProject("ShowAllFiles").GetIsFolderExpanded("SubFolder"));
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:20,代码来源:ShowAllFiles.cs

示例7: RenameStartupFile

        public void RenameStartupFile() {
            foreach (var projectType in ProjectTypes) {
                var testDef = new ProjectDefinition(
                    "RenameStartupFileFolder",
                    projectType,
                    Folder("Folder"),
                    Compile("Folder\\server"),
                    Property("StartupFile", "Folder\\server" + projectType.CodeExtension)
                );

                using (var solution = testDef.Generate().ToVs()) {
                    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
                        )
                    );
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:23,代码来源:ScriptProjectTests.cs

示例8: RenameStartupFileFolder

        public void RenameStartupFileFolder() {
            foreach (var projectType in ProjectTypes) {
                var testDef = new ProjectDefinition(
                    "RenameStartupFileFolder", 
                    projectType,
                    Folder("Folder"),
                    Compile("Folder\\server"),
                    Property("StartupFile", "Folder\\server" + projectType.CodeExtension)
                );

                using (var solution = testDef.Generate().ToVs()) {
                    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
                    );
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:23,代码来源:ScriptProjectTests.cs

示例9: ShowAllFilesRapidChanges2

        public void ShowAllFilesRapidChanges2() {
            foreach (var projectType in ProjectTypes) {
                var def = new ProjectDefinition(
                    "ShowAllFilesRapidChanges",
                    projectType,
                    Property("ProjectView", "ShowAllFiles")
                );

                using (var solution = def.Generate().ToVs()) {
                    var projectNode = solution.WaitForItem("ShowAllFilesRapidChanges");
                    AutomationWrapper.Select(projectNode);

                    HashSet<string> addedItems = new HashSet<string>();
                    for (int i = 0; i < 100; i++) {
                        var filename = Path.Combine(solution.SolutionDirectory, "ShowAllFilesRapidChanges", Path.GetRandomFileName());
                        File.WriteAllText(filename, "");
                        File.Delete(filename);
                        File.WriteAllText(filename, "");
                        addedItems.Add(filename);
                    }

                    // give some time for changes to be processed...
                    System.Threading.Thread.Sleep(10000);

                    foreach (var item in addedItems) {
                        Assert.IsNotNull(solution.WaitForItem("ShowAllFilesRapidChanges", Path.GetFileName(item)), item);
                    }
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:30,代码来源:ShowAllFiles.cs

示例10: ShowAllFilesRapidChanges

        public void ShowAllFilesRapidChanges() {
            foreach (var projectType in ProjectTypes) {
                var def = new ProjectDefinition(
                    "ShowAllFilesRapidChanges",
                    projectType,
                    Property("ProjectView", "ShowAllFiles")
                );

                using (var solution = def.Generate().ToVs()) {
                    var projectNode = solution.WaitForItem("ShowAllFilesRapidChanges");
                    AutomationWrapper.Select(projectNode);

                    List<string> addedItems = new List<string>();
                    for (int i = 0; i < 1000; i++) {
                        var filename = Path.Combine(solution.SolutionDirectory, "ShowAllFilesRapidChanges", Path.GetRandomFileName());
                        File.WriteAllText(filename, "");
                        File.Delete(filename);
                        addedItems.Add(filename);
                    }

                    foreach (var item in addedItems) {
                        Assert.IsNull(solution.WaitForItemRemoved("ShowAllFilesRapidChanges", Path.GetFileName(item)));
                    }
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:26,代码来源:ShowAllFiles.cs

示例11: ShowAllExcludeSelected

        public void ShowAllExcludeSelected() {
            foreach (var projectType in ProjectTypes) {
                var def = new ProjectDefinition(
                    "ShowAllExcludeSelected",
                    projectType,
                    ItemGroup(
                        Folder("Folder"),
                        Compile("Folder\\File1"),
                        Compile("Folder\\File2")
                    ),
                    Property("ProjectView", "ProjectFiles")
                );

                using (var solution = def.Generate().ToVs()) {
                    solution.WaitForItem("ShowAllExcludeSelected");

                    var file = solution.WaitForItem("ShowAllExcludeSelected", "Folder", "File2" + projectType.CodeExtension);
                    AutomationWrapper.Select(file);
                    solution.ExecuteCommand("Project.ExcludeFromProject");

                    solution.WaitForItemRemoved("ShowAllExcludeSelected", "Folder", "File2" + projectType.CodeExtension);

                    Assert.AreEqual("File1" + projectType.CodeExtension, Path.GetFileName(GetSelectedItemName()));

                    file = solution.WaitForItem("ShowAllExcludeSelected", "Folder", "File1" + projectType.CodeExtension);
                    AutomationWrapper.Select(file);
                    solution.ExecuteCommand("Project.ExcludeFromProject");
                    solution.WaitForItemRemoved("ShowAllExcludeSelected", "Folder", "File1" + projectType.CodeExtension);

                    Assert.AreEqual("Folder", Path.GetFileName(GetSelectedItemName().TrimEnd('\\')));
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:33,代码来源:ShowAllFiles.cs

示例12: ShowAllMoveNotInProject

        public void ShowAllMoveNotInProject() {
            foreach (var projectType in ProjectTypes) {
                var def = new ProjectDefinition(
                    "ShowAllMoveNotInProject",
                    projectType,
                    ItemGroup(
                        Folder("Folder", isExcluded: true),
                        Folder("Folder\\SubFolder", isExcluded: true),
                        Compile("NotInProject", isExcluded:true),
                        Compile("Folder\\File", isExcluded: true),
                        Content("Folder\\SubFolder\\SubFile.txt", "", isExcluded: true)
                    ),
                    Property("ProjectView", "ShowAllFiles")
                );

                using (var solution = def.Generate().ToVs()) {
                    solution.WaitForItem("ShowAllMoveNotInProject");

                    var file = solution.WaitForItem("ShowAllMoveNotInProject", "NotInProject" + projectType.CodeExtension);
                    AutomationWrapper.Select(file);
                    Keyboard.ControlX();
                    System.Threading.Thread.Sleep(1000);

                    var folder = solution.WaitForItem("ShowAllMoveNotInProject", "Folder");
                    AutomationWrapper.Select(folder);
                    Keyboard.ControlV();

                    Assert.IsNotNull(solution.WaitForItem("ShowAllMoveNotInProject", "Folder", "NotInProject" + projectType.CodeExtension));

                    solution.ExecuteCommand("Project.ShowAllFiles"); // stop showing all

                    Assert.IsNull(solution.WaitForItemRemoved("ShowAllMoveNotInProject", "Folder", "NotInProject" + projectType.CodeExtension));

                    solution.ExecuteCommand("Project.ShowAllFiles"); // start showing again

                    var subFolder = solution.WaitForItem("ShowAllMoveNotInProject", "Folder", "SubFolder");
                    AutomationWrapper.Select(subFolder);

                    Keyboard.ControlX();
                    System.Threading.Thread.Sleep(1000);
                    var projectNode = solution.WaitForItem("ShowAllMoveNotInProject");
                    AutomationWrapper.Select(projectNode);
                    Keyboard.ControlV();
                    Assert.IsNotNull(solution.WaitForItem("ShowAllMoveNotInProject", "SubFolder"));

                    solution.ExecuteCommand("Project.ShowAllFiles"); // stop showing all

                    Assert.IsNull(solution.WaitForItemRemoved("ShowAllMoveNotInProject", "SubFolder"));
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:51,代码来源:ShowAllFiles.cs

示例13: ShowAllFilesDefault

        public void ShowAllFilesDefault() {
            foreach (var projectType in ProjectTypes) {
                var def = new ProjectDefinition(
                    "ShowAllFilesDefault",
                    projectType,
                    Folder("SubFolder"),
                    Compile("SubFolder\\server"),
                    Compile("NotInProject", isExcluded: true),
                    Property("ProjectView", "")
                );

                using (var solution = def.Generate().ToVs()) {
                    var projectNode = solution.WaitForItem("ShowAllFilesDefault");
                    AutomationWrapper.Select(projectNode);


                    Assert.IsNull(solution.FindItem("ShowAllFilesDefault", "NotInProject" + projectType.CodeExtension));

                    // change setting, UI should be updated
                    solution.ExecuteCommand("Project.ShowAllFiles");

                    Assert.IsNotNull(solution.WaitForItem("ShowAllFilesDefault", "NotInProject" + projectType.CodeExtension));

                    // save setting, user project file should be updated
                    solution.GetProject("ShowAllFilesDefault").Save();

                    var projectText = File.ReadAllText(Path.Combine(solution.SolutionDirectory, @"ShowAllFilesDefault\ShowAllFilesDefault" + projectType.ProjectExtension + ".user"));
                    Assert.IsTrue(projectText.Contains("<ProjectView>ShowAllFiles</ProjectView>"));
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:31,代码来源:ShowAllFiles.cs

示例14: CopyDuplicateFolderName

        /// <summary>
        /// Copy folder to a destination where the folder already exists.  Say don't copy, nothing should be copied.
        /// </summary>
        private void CopyDuplicateFolderName(MoveDelegate mover) {
            foreach (var projectType in ProjectTypes) {
                var testDef = new ProjectDefinition("DragDropCopyCutPaste",
                    projectType,
                    ItemGroup(
                        Folder("CopyDuplicateFolderName"),
                        Compile("CopyDuplicateFolderName\\server"),
                        Folder("CopyDuplicateFolderNameTarget"),
                        Folder("CopyDuplicateFolderNameTarget\\CopyDuplicateFolderName")
                    )
                );

                using (var solution = testDef.Generate().ToVs()) {
                    mover(
                        solution,
                        solution.WaitForItem("DragDropCopyCutPaste", "CopyDuplicateFolderNameTarget"),
                        solution.WaitForItem("DragDropCopyCutPaste", "CopyDuplicateFolderName")
                    );

                    using (var dialog = solution.WaitForOverwriteFileDialog()) {
                        AssertUtil.Contains(dialog.Text, "This folder already contains a folder called 'CopyDuplicateFolderName'");
                        dialog.No();
                    }

                    solution.AssertFileDoesntExist("DragDropCopyCutPaste", "CopyDuplicateFolderNameTarget", "CopyDuplicateFolderName", "server" + projectType.CodeExtension);
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:31,代码来源:DragDropCopyCutPaste.cs

示例15: MoveDuplicateFileNameSkipMove

        /// <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,
                        solution.FindItem("MoveDuplicateFileName", "Folder"),
                        solution.FindItem("MoveDuplicateFileName", "textfile.txt")
                    );

                    using (var dialog = solution.WaitForOverwriteFileDialog()) {
                        dialog.No();
                    }

                    solution.WaitForDialogDismissed();

                    solution.AssertFileExistsWithContent("root", "MoveDuplicateFileName", "textfile.txt");
                    solution.AssertFileExistsWithContent("Folder", "MoveDuplicateFileName", "Folder", "textfile.txt");
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:32,代码来源:NewDragDropCopyCutPaste.cs


注:本文中的TestUtilities.SharedProject.ProjectDefinition.Generate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。