diff --git a/xUnitRevitUtilsShared/xru.cs b/xUnitRevitUtilsShared/xru.cs index 719d723..6c4bd00 100644 --- a/xUnitRevitUtilsShared/xru.cs +++ b/xUnitRevitUtilsShared/xru.cs @@ -47,6 +47,23 @@ namespace xUnitRevitUtils UiContext.Send(x => doc = Uiapp.OpenAndActivateDocument(filePath).Document, null); Assert.NotNull(doc); return doc; + } + /// + /// Closes the provided Revit document + /// + /// Revit document to be closed + /// If true, saves changes to document before closing + /// + /// Bool indicating whether or not the document was successfully closed + /// + public static bool CloseDoc(Document doc, bool saveChanges = false) + { + if (doc == null) + return false; + + var result = false; + UiContext.Send(x => result = doc.Close(saveChanges), null); + return result; } ///