本文整理汇总了C#中VisualStudioApp.SelectSourceControlProvider方法的典型用法代码示例。如果您正苦于以下问题:C# VisualStudioApp.SelectSourceControlProvider方法的具体用法?C# VisualStudioApp.SelectSourceControlProvider怎么用?C# VisualStudioApp.SelectSourceControlProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisualStudioApp
的用法示例。
在下文中一共展示了VisualStudioApp.SelectSourceControlProvider方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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)
);
}
}
}
}
示例2: SourceControlRenameFolder
public void SourceControlRenameFolder() {
using (var app = new VisualStudioApp()) {
foreach (var projectType in ProjectTypes) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
TestSccProvider.DocumentEvents.Clear();
using (var solution = SourceControlProject(projectType).Generate()) {
try {
var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
project.ProjectItems.Item("TestFolder").Name = "Renamed";
AssertDocumentEvents(Path.GetDirectoryName(project.FullName),
OnQueryRenameFiles("TestFolder\\", "Renamed\\", VSQUERYRENAMEFILEFLAGS_Directory),
OnAfterRenameFiles("TestFolder\\", "Renamed", VSRENAMEFILEFLAGS_Directory)
);
app.Dte.Solution.Close();
} finally {
app.SelectSourceControlProvider("None");
}
}
}
}
}
示例3: SourceControlExcludedFilesNotPresent
public void SourceControlExcludedFilesNotPresent() {
using (var app = new VisualStudioApp()) {
foreach (var projectType in ProjectTypes) {
using (var solution = SourceControlProject(projectType).Generate()) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
Assert.AreEqual(1, TestSccProvider.LoadedProjects.Count);
var sccProject = TestSccProvider.LoadedProjects.First();
foreach (var curFile in sccProject.Files) {
Assert.IsFalse(curFile.Key.EndsWith("ExcludedFile" + projectType.CodeExtension), "found excluded file");
}
}
}
app.Dte.Solution.Close();
app.SelectSourceControlProvider("None");
}
}
示例4: SourceControlNoControl
public void SourceControlNoControl() {
using (var app = new VisualStudioApp()) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
DontExpectSourceControl();
foreach (var projectType in ProjectTypes) {
var testDef = NoSourceControlProject(projectType);
using (var solution = testDef.Generate()) {
var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
Assert.AreEqual(0, TestSccProvider.LoadedProjects.Count);
app.Dte.Solution.Close();
Assert.AreEqual(0, TestSccProvider.LoadedProjects.Count);
if (TestSccProvider.Failures.Count != 0) {
Assert.Fail(String.Join(Environment.NewLine, TestSccProvider.Failures));
}
app.SelectSourceControlProvider("None");
}
}
}
}
示例5: SourceControlGlyphChanged
public void SourceControlGlyphChanged() {
using (var app = new VisualStudioApp()) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
foreach (var projectType in ProjectTypes) {
var testDef = SourceControlProject(projectType);
using (var solution = testDef.Generate()) {
var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
Assert.AreEqual(1, TestSccProvider.LoadedProjects.Count);
var sccProject = TestSccProvider.LoadedProjects.First();
Microsoft.TestSccPackage.FileInfo fileInfo = null;
foreach (var curFile in sccProject.Files) {
if (curFile.Key.EndsWith("Program" + projectType.CodeExtension)) {
fileInfo = curFile.Value;
break;
}
}
Assert.IsNotNull(fileInfo);
fileInfo.GlyphChanged(VsStateIcon.STATEICON_CHECKEDOUTEXCLUSIVEOTHER);
var programPy = project.ProjectItems.Item("Program" + projectType.CodeExtension);
Assert.AreEqual(programPy.Properties.Item("SourceControlStatus").Value, "CHECKEDOUTEXCLUSIVEOTHER");
fileInfo.StateIcon = VsStateIcon.STATEICON_READONLY;
sccProject.AllGlyphsChanged();
Assert.AreEqual(programPy.Properties.Item("SourceControlStatus").Value, "READONLY");
app.Dte.Solution.Close();
Assert.AreEqual(0, TestSccProvider.LoadedProjects.Count);
if (TestSccProvider.Failures.Count != 0) {
Assert.Fail(String.Join(Environment.NewLine, TestSccProvider.Failures));
}
app.SelectSourceControlProvider("None");
}
}
}
}
示例6: BasicSourceControl
public void BasicSourceControl() {
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 = SourceControlProject(projectType);
using (var solution = testDef.Generate()) {
var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
Assert.AreEqual(1, TestSccProvider.LoadedProjects.Count);
TestSccProvider.ExpectedAuxPath = null;
TestSccProvider.ExpectedLocalPath = null;
TestSccProvider.ExpectedProvider = null;
TestSccProvider.ExpectedProjectName = null;
TestSccProvider.LoadedProjects.First().SccProject.SetSccLocation(
"NewProjectName",
"NewAuxPath",
"NewLocalPath",
"NewProvider"
);
app.Dte.Solution.Close();
Assert.AreEqual(0, TestSccProvider.LoadedProjects.Count);
if (TestSccProvider.Failures.Count != 0) {
Assert.Fail(String.Join(Environment.NewLine, TestSccProvider.Failures));
}
app.SelectSourceControlProvider("None");
}
}
}
}
示例7: RemoveItem
public void RemoveItem() {
using (var app = new VisualStudioApp()) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
foreach (var projectType in ProjectTypes) {
var testDef = SourceControlProject(projectType);
using (var solution = testDef.Generate()) {
TestSccProvider.DocumentEvents.Clear();
var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
var window = app.SolutionExplorerTreeView;
var fileName = "Program" + projectType.CodeExtension;
var program = window.WaitForChildOfProject(project, fileName);
program.Select();
Keyboard.Type(Key.Delete);
app.WaitForDialog();
VisualStudioApp.CheckMessageBox(MessageBoxButton.Ok, "will be deleted permanently");
app.WaitForDialogDismissed();
window.WaitForChildOfProjectRemoved(project, fileName);
var projectDir = Path.GetDirectoryName(project.FullName);
AssertDocumentEvents(projectDir,
OnQueryRemoveFiles(fileName),
OnAfterRemoveFiles(fileName)
);
}
}
}
}
示例8: IncludeInProject
public void IncludeInProject() {
using (var app = new VisualStudioApp()) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
foreach (var projectType in ProjectTypes) {
var testDef = SourceControlProject(projectType);
using (var solution = testDef.Generate().ToVs()) {
TestSccProvider.DocumentEvents.Clear();
var project = app.OpenProject(solution.SolutionFilename, onDialog: OnNoSccDialog);
var window = app.SolutionExplorerTreeView;
var fileName = projectType.Code(@"ExcludedFile");
// Try to select the file. If it throws, it is likely the issue was that we weren't showing all files.
try {
window.WaitForChildOfProject(project, fileName).Select();
} catch (Exception) {
// Show all files so we can see the excluded item if we previously couldn't
solution.ExecuteCommand("Project.ShowAllFiles");
window.WaitForChildOfProject(project, fileName).Select();
}
solution.ExecuteCommand("Project.IncludeInProject");
System.Threading.Thread.Sleep(250);
AssertDocumentEvents(Path.GetDirectoryName(project.FullName),
OnQueryAddFiles(fileName),
OnAfterAddFilesEx(fileName)
);
}
}
}
}
示例9: AddExistingItem
public void AddExistingItem() {
using (var app = new VisualStudioApp()) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
foreach (var projectType in ProjectTypes) {
var testDef = SourceControlProject(projectType);
using (var solution = testDef.Generate()) {
TestSccProvider.DocumentEvents.Clear();
var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
var fileName = projectType.Code(@"ExcludedFile");
using (var newItem = AddExistingItemDialog.FromDte(app)) {
newItem.FileName = fileName;
newItem.OK();
}
System.Threading.Thread.Sleep(250);
Assert.IsNotNull(project.ProjectItems.Item(fileName));
AssertDocumentEvents(Path.GetDirectoryName(project.FullName),
OnQueryAddFiles(fileName),
OnAfterAddFilesEx(fileName)
);
}
}
}
}