本文整理汇总了C#中TestUtilities.SharedProject.ProjectDefinition类的典型用法代码示例。如果您正苦于以下问题:C# ProjectDefinition类的具体用法?C# ProjectDefinition怎么用?C# ProjectDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectDefinition类属于TestUtilities.SharedProject命名空间,在下文中一共展示了ProjectDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: ShowAllFilesSymLinks
public void ShowAllFilesSymLinks() {
foreach (var projectType in ProjectTypes) {
var def = new ProjectDefinition(
"ShowAllFilesSymLink",
projectType,
Folder("SubFolder")
);
var userDef = new ProjectDefinition(
def.Name,
projectType,
true,
Property("ProjectView", "ShowAllFiles")
);
var solutionFile = SolutionFile.Generate(def.Name, def, userDef);
using (System.Diagnostics.Process p = System.Diagnostics.Process.Start("cmd.exe",
String.Format("/c mklink /J \"{0}\" \"{1}\"",
Path.Combine(solutionFile.Directory, @"ShowAllFilesSymLink\SymFolder"),
Path.Combine(solutionFile.Directory, @"ShowAllFilesSymLink\SubFolder")
))) {
p.WaitForExit();
}
using (System.Diagnostics.Process p = System.Diagnostics.Process.Start("cmd.exe",
String.Format("/c mklink /J \"{0}\" \"{1}\"",
Path.Combine(solutionFile.Directory, @"ShowAllFilesSymLink\SubFolder\Infinite"),
Path.Combine(solutionFile.Directory, @"ShowAllFilesSymLink\SubFolder")
))) {
p.WaitForExit();
}
try {
using (var solution = solutionFile.ToVs()) {
Assert.IsNotNull(solution.WaitForItem("ShowAllFilesSymLink", "SymFolder"));
// https://pytools.codeplex.com/workitem/1150 - infinite links, not displayed
Assert.IsNull(solution.FindItem("ShowAllFilesSymLink", "SubFolder", "Infinite"));
File.WriteAllText(
Path.Combine(solutionFile.Directory, @"ShowAllFilesSymLink\SubFolder\Foo.txt"),
"Hi!"
);
// https://pytools.codeplex.com/workitem/1152 - watching the sym link folder
Assert.IsNotNull(solution.WaitForItem("ShowAllFilesSymLink", "SubFolder", "Foo.txt"));
Assert.IsNotNull(solution.WaitForItem("ShowAllFilesSymLink", "SymFolder", "Foo.txt"));
}
} finally {
using (System.Diagnostics.Process p = System.Diagnostics.Process.Start("cmd.exe",
String.Format("/c rmdir \"{0}\" \"{1}\"",
Path.Combine(solutionFile.Directory, @"ShowAllFilesSymLink\SymFolder"),
Path.Combine(solutionFile.Directory, @"ShowAllFilesSymLink\SubFolder\Infinite")
))) {
p.WaitForExit();
}
}
}
}
开发者ID:sadapple,项目名称:PTVS,代码行数:59,代码来源:ShowAllFiles.cs
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: BasicProjectTest
public void BasicProjectTest() {
var sln = new ProjectDefinition(
"HelloWorld",
PythonProject,
Compile("server", "")
).Generate();
using (var vs = sln.ToMockVs()) {
Assert.IsNotNull(vs.WaitForItem("HelloWorld", "Python Environments"));
Assert.IsNotNull(vs.WaitForItem("HelloWorld", "References"));
Assert.IsNotNull(vs.WaitForItem("HelloWorld", "Search Paths"));
Assert.IsNotNull(vs.WaitForItem("HelloWorld", "server.py"));
var view = vs.OpenItem("HelloWorld", "server.py");
view.Invoke(() => view.Type("import "));
using (var sh = view.WaitForSession<ICompletionSession>()) {
AssertUtil.Contains(sh.Session.Completions(), "sys");
}
}
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:21,代码来源:ProjectTests.cs
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: CopyDeletePaste
public void CopyDeletePaste() {
foreach (var projectType in ProjectTypes) {
var testDef = new ProjectDefinition("DragDropCopyCutPaste",
projectType,
ItemGroup(
Folder("CopyDeletePaste"),
Compile("CopyDeletePaste\\CopyDeletePaste")
)
);
using (var solution = testDef.Generate().ToVs()) {
var file = solution.WaitForItem("DragDropCopyCutPaste", "CopyDeletePaste", "CopyDeletePaste" + projectType.CodeExtension);
var project = solution.WaitForItem("DragDropCopyCutPaste");
AutomationWrapper.Select(file);
solution.ControlC();
AutomationWrapper.Select(file);
solution.Type(Key.Delete);
solution.WaitForDialog();
solution.Type("\r");
solution.WaitForDialogDismissed();
solution.WaitForItemRemoved("DragDropCopyCutPaste", "CopyDeletePaste", "CopyDeletePaste" + projectType.CodeExtension);
AutomationWrapper.Select(project);
solution.ControlV();
solution.CheckMessageBox("The source URL 'CopyDeletePaste" + projectType.CodeExtension + "' could not be found.");
}
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:34,代码来源:DragDropCopyCutPaste.cs
示例15: 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
示例16: 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
示例17: ShouldWarnOnRun
public void ShouldWarnOnRun() {
var sln = new ProjectDefinition(
"HelloWorld",
PythonProject,
Compile("app", "print \"hello\"")
).Generate();
using (var vs = sln.ToMockVs())
using (var analyzerChanged = new AutoResetEvent(false)) {
var project = vs.GetProject("HelloWorld").GetPythonProject();
project.ProjectAnalyzerChanged += (s, e) => analyzerChanged.Set();
var uiThread = (UIThreadBase)project.GetService(typeof(UIThreadBase));
var interpreters = ((IComponentModel)project.GetService(typeof(SComponentModel)))
.GetService<IInterpreterRegistryService>()
.Interpreters;
var v27 = interpreters.Where(x => x.Configuration.Id == "Global|PythonCore|2.7|x86").First();
var v34 = interpreters.Where(x => x.Configuration.Id == "Global|PythonCore|3.4|x86").First();
var interpOptions = (UIThreadBase)project.GetService(typeof(IComponentModel));
uiThread.Invoke(() => {
project.AddInterpreter(v27.Configuration.Id);
project.AddInterpreter(v34.Configuration.Id);
});
project.SetInterpreterFactory(v27);
Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #1");
uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
Assert.IsFalse(project.ShouldWarnOnLaunch, "Should not warn on 2.7");
project.SetInterpreterFactory(v34);
Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #2");
uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
Assert.IsTrue(project.ShouldWarnOnLaunch, "Expected warning on 3.4");
project.SetInterpreterFactory(v27);
Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #3");
uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
Assert.IsFalse(project.ShouldWarnOnLaunch, "Expected warning to go away on 2.7");
}
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:42,代码来源:ProjectTests.cs
示例18: MoveDuplicateFolderName
/// <summary>
/// Drag file from another hierarchy into folder in our hierarchy, item should be added
/// Cannot move the folder 'DuplicateFolderName'. A folder with that name already exists in the destination directory.
/// </summary>
private void MoveDuplicateFolderName(MoveDelegate mover) {
foreach (var projectType in ProjectTypes) {
var testDef = new ProjectDefinition("DragDropCopyCutPaste",
projectType,
ItemGroup(
Folder("DuplicateFolderName"),
Folder("DuplicateFolderNameTarget"),
Folder("DuplicateFolderNameTarget\\DuplicateFolderName")
)
);
using (var solution = testDef.Generate().ToVs()) {
mover(
solution,
solution.WaitForItem("DragDropCopyCutPaste", "DuplicateFolderNameTarget"),
solution.WaitForItem("DragDropCopyCutPaste", "DuplicateFolderName")
);
solution.CheckMessageBox("Cannot move the folder 'DuplicateFolderName'. A folder with that name already exists in the destination directory.");
}
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:26,代码来源:DragDropCopyCutPaste.cs
示例19: 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
示例20: MoveDuplicateFileNameOverwrite
/// <summary>
/// Cuts 2 files with the same name, answers yes to overwrite them, and
/// makes sure only one file is left.
/// </summary>
/// <param name="mover"></param>
private void MoveDuplicateFileNameOverwrite(MoveDelegate mover) {
foreach (var projectType in ProjectTypes) {
var project = new ProjectDefinition(
"DragDropCopyCutPaste",
projectType,
ItemGroup(
Folder("A"),
Folder("B"),
Content("quox.txt", "top-level"),
Content("A\\quox.txt", "A")
)
);
using (var solution = project.Generate().ToVs()) {
mover(
solution,
solution.WaitForItem("DragDropCopyCutPaste", "B"),
solution.WaitForItem("DragDropCopyCutPaste", "A", "quox.txt"),
solution.WaitForItem("DragDropCopyCutPaste", "quox.txt")
);
using (var dialog = solution.WaitForOverwriteFileDialog()) {
AssertUtil.Contains(dialog.Text, "A file with the same name 'quox.txt' already exists.");
dialog.Yes();
}
solution.AssertFileExists("DragDropCopyCutPaste", "B", "quox.txt");
solution.AssertFileDoesntExist("DragDropCopyCutPaste", "quox.txt");
solution.AssertFileDoesntExist("DragDropCopyCutPaste", "A", "quox.txt");
Assert.AreEqual(1, solution.GetProject("DragDropCopyCutPaste").ProjectItems.Item("B").ProjectItems.Count);
}
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:39,代码来源:DragDropCopyCutPaste.cs
注:本文中的TestUtilities.SharedProject.ProjectDefinition类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论