public void CleaningFileTypesXML_DisablesForDocumentWhenSettingIsDisabled() { Settings.Default.Cleaning_IncludeXML = false; UIThreadInvoker.Invoke(new Action(() => { // Make sure the document is the active document for the environment. var document = TestOperations.GetActivatedDocument(_projectItem); Assert.AreEqual(document, TestEnvironment.Package.ActiveDocument); // Confirm the code cleanup availability logic is in the expected state. Assert.IsFalse(_codeCleanupAvailabilityLogic.CanCleanupDocument(document)); })); }
public void CleaningFileTypesCPlusPlus_EnablesForDocument() { Settings.Default.Cleaning_IncludeCPlusPlus = true; UIThreadInvoker.Invoke(new Action(() => { // Make sure the document is the active document for the environment. var document = TestOperations.GetActivatedDocument(_projectItem); Assert.AreEqual(document, TestEnvironment.Package.ActiveDocument); // Confirm the code cleanup availability logic is in the expected state. Assert.IsTrue(_codeCleanupAvailabilityLogic.ShouldCleanup(document)); })); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(Company.VisualStudioHaskell.GuidList.guidVisualStudioHaskellPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void BetweenDiffFolders1() { //"Program3.fs" //"Folder1\\File3.fs" //"Folder1\\File4.fs" //"Folder1\\Sub1\File2.fs" //"Folder1\\Sub1\\SubSub1\\File1.fs" //"Folder1\\Sub2\\File1.fs" //"Folder1\\File1.fs" //"Folder2\\File1.fs" //"Program.fs" //"Program2.fs" //"Folder3\\CompileFile1.fs", //"Folder3\\ContentFile1.fs", //"Folder3\\NoneFile1.fs" UIThreadInvoker.Invoke((ThreadInvoker) delegate() { new SwapConfig("BetweenDiffFolders", ref testContext) .Move( new MoveOp { Index = 3, Dir = CompileOrderViewer.Direction.Up }, new MoveOp { Index = 2, Dir = CompileOrderViewer.Direction.Up }, new MoveOp { Index = 1, Dir = CompileOrderViewer.Direction.Up } ) .ExpectedOrder( "Folder1\\Sub1\\File2.fs", "Program3.fs", "Folder1\\File3.fs", "Folder1\\File4.fs", "Folder1\\Sub1\\SubSub1\\File1.fs", "Folder1\\Sub2\\File1.fs", "Folder1\\File1.fs", "Folder2\\File1.fs", "Program.fs", "Program2.fs", "Folder3\\CompileFile1.fs" //, //"Folder3\\ContentFile1.fs", //"Folder3\\NoneFile1.fs" ) .Run(); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(Predelnik.RemoveTrailingWhitespaces.GuidList.guidRemoveTrailingWhitespacesPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(SmallSharpTools.JavaScriptBrowser.VSPackage.GuidList.guidJavaScriptBrowserPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void CreateRustLibraryProject() { UIThreadInvoker.Invoke((Action) delegate() { string projName = Utils.GetCallingFunction(); Utils.CreateEmptySolution(TestContext.TestDir, projName); Utils.CreateProjectFromTemplate(projName, "Rust Library", "Rust", false); ProjectNode root = Utils.GetProject(projName); Assert.IsNotNull(root); new HierarchyCheck(root) .Child <FolderNode>("src") .Child <FileNode>("lib.rs") .Run(); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(KittyAltruistic.CPlusPlusTestRunner.GuidList.GUIDTestPackagePkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void WinformsApplication() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { TestUtils.CreateEmptySolution(TestContext.TestDir, "CSWinApp"); Assert.AreEqual <int>(0, TestUtils.ProjectCount()); //Create Winforms application project //TestUtils.CreateProjectFromTemplate("MyWindowsApp", "Windows Application", "CSharp", false); //Assert.AreEqual<int>(1, TestUtils.ProjectCount()); //TODO Verify that we can debug launch the application //TODO Set Break point and verify that will hit //TODO Verify Adding new project item to project }); }
public void TestHasProjectOpened() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the global service provider and the dte IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; DTE dte = (DTE)sp.GetService(typeof(DTE)); string destination = Path.Combine(TestContext.TestDir, TestContext.TestName); ProjectNode project = Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true); bool hasProjectOpened = project.HasProjectOpened; Assert.IsTrue(hasProjectOpened, "The event listener for opening the project has failed"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service var shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; var packageGuid = new Guid(LINQBridgeVs.Extension.GuidList.GuidBridgeVsExtensionPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(MicrosoftCorporation.SlowCheetah.GuidList.guidSlowCheetahPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(McKearney.TfsSolutionInfo.GuidList.guidTfsProjectInfoPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid("C4128D99-2000-41D1-A6C3-704E6C1A3DE2"); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(FSharp.ProjectExtender.Constants.guidProjectExtenderPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid("f152487e-9a22-4cf9-bee6-a8f7c77f828d"); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(JosePedroSilva.TFSScrumExtensions.GuidList.guidTFSScrumExtensionsPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(GeoCybernetica.CodeGenerationExtention.GuidList.guidCodeGenerationExtentionPkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the Shell Service IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); //Validate package load IVsPackage package; Guid packageGuid = new Guid(ALMRangers.TracepointGeneratorPackage.GuidList.guidTracepointGenerator_PackagePkgString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); }); }
public void CppWinformsApplication() { UIThreadInvoker.Invoke((ThreadInvoker) delegate { //Solution and project creation parameters const string solutionName = "CPPWinApp"; const string projectName = "CPPWinApp"; //Template parameters const string projectType = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; var projectTemplateName = Path.Combine("vcNet", "mc++appwiz.vsz"); const string itemTemplateName = "newc++file.cpp"; const string newFileName = "Test.cpp"; var dte = (DTE)VsIdeTestHostContext.ServiceProvider.GetService(typeof(DTE)); var testUtils = new TestUtils(); testUtils.CreateEmptySolution(TestContext.TestDir, solutionName); Assert.AreEqual(0, testUtils.ProjectCount()); //Add new CPP Windows application project to existing solution var solutionDirectory = Directory.GetParent(dte.Solution.FullName).FullName; var projectDirectory = TestUtils.GetNewDirectoryName(solutionDirectory, projectName); var projectTemplatePath = Path.Combine(dte.Solution.TemplatePath[projectType], projectTemplateName); Assert.IsTrue(File.Exists(projectTemplatePath), string.Format("Could not find template file: {0}", projectTemplatePath)); dte.Solution.AddFromTemplate(projectTemplatePath, projectDirectory, projectName); //Verify that the new project has been added to the solution Assert.AreEqual(1, testUtils.ProjectCount()); //Get the project Project project = dte.Solution.Item(1); Assert.IsNotNull(project); Assert.IsTrue(string.Compare(project.Name, projectName, StringComparison.InvariantCultureIgnoreCase) == 0); //Verify Adding new code file to project string newItemTemplatePath = Path.Combine(dte.Solution.ProjectItemsTemplatePath(projectType), itemTemplateName); Assert.IsTrue(File.Exists(newItemTemplatePath)); ProjectItem item = project.ProjectItems.AddFromTemplate(newItemTemplatePath, newFileName); Assert.IsNotNull(item); }); }
public void TestGetAutomationObject() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the global service provider and the dte IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; DTE dte = (DTE)sp.GetService(typeof(DTE)); string destination = Path.Combine(TestContext.TestDir, TestContext.TestName); ProjectNode project = Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true); object retValue = project.GetAutomationObject(); Assert.IsNotNull(retValue); }); }
public void MyTestCleanup() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { IVsSolution solutionService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution)) as IVsSolution; if (solutionService != null) { object isOpen; solutionService.GetProperty((int)__VSPROPID.VSPROPID_IsSolutionOpen, out isOpen); if ((bool)isOpen) { solutionService.CloseSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_ForceSave, null, 0); } } }); }
public void PackageLoadTest() { UIThreadInvoker.Invoke(new Action(() => { // Get the Shell Service var shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell; Assert.IsNotNull(shellService); // Validate package load IVsPackage package; var packageGuid = new Guid(PackageGuids.GuidCodeMaidPackageString); Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package)); Assert.IsNotNull(package, "Package failed to load"); })); }
public void InitializeContext() { this.testClass = new ValidationTest(); // Exports test class to MEF VsCompositionContainer.Create(new TypeCatalog(typeof(ValidationTest)), new VsExportProviderSettings( VsExportProvidingPreference.BeforeExportsFromOtherContainers)); this.solution = VsIdeTestHostContext.ServiceProvider.GetService <ISolution>(); this.solution.CreateInstance(this.DeploymentDirectory, "Blank"); this.patternManager = VsIdeTestHostContext.ServiceProvider.GetService <IPatternManager>(); var toolkit = this.patternManager.InstalledToolkits.Single(f => f.Id == "NuPattern.Runtime.IntegrationTests.TestToolkit"); UIThreadInvoker.Invoke(new Action(() => this.product = this.patternManager.CreateProduct(toolkit, "Foo"))); }
public void TestHasProjectOpened() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the global service provider and the dte IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; DTE dte = (DTE)sp.GetService(typeof(DTE)); string destination = Path.Combine(TestContext.TestDir, TestContext.TestName); ProjectNode project = Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true); PropertyInfo pi = typeof(ProjectNode).GetProperty("HasProjectOpened", BindingFlags.Instance | BindingFlags.NonPublic); bool hasProjectOpened = (bool)pi.GetValue(project, new object[] { }); Assert.IsTrue(hasProjectOpened, "The event listener for opening the project has failed"); }); }
public void TestTargetsOnUserProject() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the global service provider and the dte IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; DTE dte = (DTE)sp.GetService(typeof(DTE)); string mainProject = CreateTempFileOnDisk(@" <Project DefaultTargets=`Build` xmlns=`msbuildnamespace`> <Import Project=`$(MSBuildBinPath)\Microsoft.CSharp.targets`/> </Project> " ); ProjectShim mainProjectShim = null; UserProjectSecurityChecker userProject = null; try { mainProjectShim = CreateProjectShim(mainProject); userProject = CreateUserProjectSecurityChecker(sp, @" <Project DefaultTargets=`Build` xmlns=`msbuildnamespace`> <Target Name=`PrepareForBuild`> <PropertyGroup> <TargetDir>$(TargetDir)</TargetDir> <TargetPath>$(TargetPath)</TargetPath> </PropertyGroup> </Target> </Project> " , mainProjectShim); MethodInfo mi = userProject.GetType().GetMethod("IsProjectSafeWithTargets", BindingFlags.Instance | BindingFlags.NonPublic); string[] message = new string[1] { String.Empty }; bool result = (bool)mi.Invoke(userProject, message); Assert.IsTrue(!result && !String.IsNullOrEmpty(message[0]), "A user project redefined targets and was not considered unsafe."); } finally { TestProjectForSecurity.CleanUp(userProject, mainProjectShim); } }); }
public void TestCreatingFileNode() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the global service provider and the dte IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; DTE dte = (DTE)sp.GetService(typeof(DTE)); string destination = Path.Combine(TestContext.TestDir, TestContext.TestName); ProjectNode project = Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true); string newFileName = TestUtils.GetNewFileName(project.ProjectFolder, "test", "cs"); ProjectElement item = project.CreateMsBuildFileItem(newFileName, "Compile"); FileNode node = project.CreateFileNode(item); Assert.IsNotNull(node); }); }
public void TestProjectCreationWithDTE() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Get the global service provider and the dte IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; DTE dte = (DTE)sp.GetService(typeof(DTE)); string destination = Path.Combine(TestContext.TestDir, TestContext.TestName); ProjectNode project = Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true); // test nested project item EnvDTE.ProjectItem nestedProject = ((OAProject)project.GetAutomationObject()).ProjectItems.Item("ANestedProject"); Assert.IsNotNull(nestedProject, "Failed to retrieve nested projects"); Assert.IsNotNull(nestedProject.SubProject, "Failed to retrieve nested projects's subproject"); // Add a cs file to the nested project. string newFileName = Path.GetFullPath(TestUtils.GetNewFileName(project.ProjectFolder, "GetClassWithCodeModel", "cs")); EnvDTE.ProjectItem newFile = nestedProject.SubProject.ProjectItems.AddFromFile(newFileName); CodeModel codeModel = nestedProject.SubProject.CodeModel; Assert.IsNotNull(codeModel, "Failed to retrieve nested projects's subproject"); FileCodeModel fileCodeModel = newFile.FileCodeModel; CodeClass cc = fileCodeModel.AddClass("MyClass", 0, null, null, vsCMAccess.vsCMAccessPublic); IEnumerator enumerator = fileCodeModel.CodeElements.GetEnumerator(); bool found = false; while (enumerator.MoveNext()) { CodeElement element = enumerator.Current as CodeElement; if (element.Name == "MyClass") { found = true; break; } } Assert.IsTrue(found, "Could not find the class in the code model associated to the nested project"); }); }
public void InsideSameFolder() { //"Program3.fs" //"Folder1\\File3.fs" //"Folder1\\File4.fs" //"Folder1\\Sub1\File2.fs" //"Folder1\\Sub1\\SubSub1\\File1.fs" //"Folder1\\Sub2\\File1.fs" //"Folder1\\File1.fs" //"Folder2\\File1.fs" //"Program.fs" //"Program2.fs" //"Folder3\\CompileFile1.fs", //"Folder3\\ContentFile1.fs", //"Folder3\\NoneFile1.fs" UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //"It'd be more optimal if root level files won't be swapped in this tests. //But they are swapped (manual check,not yet automized) new SwapConfig("InsideSameFolder", ref testContext) .Move( new MoveOp { Index = 1, Dir = CompileOrderViewer.Direction.Down }, new MoveOp { Index = 3, Dir = CompileOrderViewer.Direction.Down }) .ExpectedOrder( "Program3.fs", "Folder1\\File4.fs", "Folder1\\File3.fs", "Folder1\\Sub1\\SubSub1\\File1.fs", "Folder1\\Sub1\\File2.fs", "Folder1\\Sub2\\File1.fs", "Folder1\\File1.fs", "Folder2\\File1.fs", "Program.fs", "Program2.fs", "Folder3\\CompileFile1.fs" //, //"Folder3\\ContentFile1.fs", //"Folder3\\NoneFile1.fs" ) .Run(); }); }
public void WhenShowingMessage_ThenSucceeds() { var components = (IComponentModel)Package.GetGlobalService(typeof(SComponentModel)); var service = (IServiceProvider)components.GetService <SVsServiceProvider>(); var ui = (IVsUIShell)service.GetService(typeof(SVsUIShell)); Assert.NotNull(service); Assert.NotNull(ui); using (var purger = new DialogBoxPurger(0)) { UIThreadInvoker.Invoke((Action)(() => { PackageUtility.ShowError(service, "Foo", string.Empty); })); } }