Microsoft.VsSDK.IntegrationTestLibrary.TestUtils.CloseInEditorWithoutSaving C# (CSharp) Method

CloseInEditorWithoutSaving() public method

public CloseInEditorWithoutSaving ( string fullFileName ) : void
fullFileName string
return void
        public void CloseInEditorWithoutSaving(string fullFileName)
        {
            // Get the RDT service
            IVsRunningDocumentTable runningDocumentTableService = (IVsRunningDocumentTable)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsRunningDocumentTable));
            Assert.IsNotNull(runningDocumentTableService, "Failed to get the Running Document Table Service");

            // Get our document cookie and hierarchy for the file
            uint docCookie;
            IntPtr docData;
            IVsHierarchy hierarchy;
            uint itemId;
            runningDocumentTableService.FindAndLockDocument(
                (uint)Microsoft.VisualStudio.Shell.Interop._VSRDTFLAGS.RDT_NoLock,
                fullFileName,
                out hierarchy,
                out itemId,
                out docData,
                out docCookie);

            // Get the SolutionService
            IVsSolution solutionService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution)) as IVsSolution;
            Assert.IsNotNull(solutionService, "Failed to get IVsSolution service");

            // Close the document
            solutionService.CloseSolutionElement(
                (uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave,
                hierarchy,
                docCookie);
        }