CloseCurrentSolution() public method

public CloseCurrentSolution ( __VSSLNSAVEOPTIONS saveoptions ) : void
saveoptions __VSSLNSAVEOPTIONS
return void
示例#1
0
 public void CreateEmptySolution()
 {
     var testUtils = new TestUtils();
     testUtils.CloseCurrentSolution(
             __VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave );
     testUtils.CreateEmptySolution( TestContext.TestDir, "EmptySolution" );
 }
 public void CreateEmptySolution() {
     UIThreadInvoker.Invoke((ThreadInvoker) delegate() {
         var testUtils = new TestUtils();
         testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);
         testUtils.CreateEmptySolution(TestContext.TestDir, "EmptySolution");
     });
 }
示例#3
0
        public void ValidateNewFileOpenedWithEditor()
        {
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
            {
                TestUtils testUtils = new TestUtils();
                testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);
                testUtils.CreateEmptySolution(TestContext.TestDir, "CreateEmptySolution");

                //Add new file to the solution and save all
                string name = "mynewfile";
                EnvDTE.DTE dte = VsIdeTestHostContext.Dte;
                EnvDTE.Window win = dte.ItemOperations.NewFile(@"Racket Files\Racket", name, EnvDTE.Constants.vsViewKindPrimary);
                Assert.IsNotNull(win);
                dte.ExecuteCommand("File.SaveAll", string.Empty);

                //get the currect misc files state
                object OriginalValueMiscFilesSavesLastNItems = dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value;
                if ((int)OriginalValueMiscFilesSavesLastNItems == 0)
                {
                    dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value = 5;
                }

                //get a handle to the project item in the solution explorer
                EnvDTE.ProjectItem item = win.Document.ProjectItem;
                Assert.IsNotNull(item);

                //close window
                win.Close(EnvDTE.vsSaveChanges.vsSaveChangesNo);

                //reset the miscfiles property if it was modified
                if (OriginalValueMiscFilesSavesLastNItems != dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value)
                {
                    dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value = OriginalValueMiscFilesSavesLastNItems;
                }

            });
        }