public void TestCloseInvalidDocument() { using (PowerPointApplicationController applicationController = new PowerPointApplicationController(true)) { applicationController.CreateHostApplication(2000); applicationController.CloseDocument(new object(), false); } }
public void TestCloseDocumentOnAlreadyClosedDocument() { using (PowerPointApplicationController applicationController = new PowerPointApplicationController(true)) { applicationController.CreateHostApplication(2000); PowerPoint.Presentation presentation = (PowerPoint.Presentation) applicationController.OpenDocument(CopyFile(Path.Combine(m_testPath, "test.ppt")), false); Assert.IsNotNull(presentation); try { presentation.Close(); applicationController.CloseDocument(presentation, false); } finally { if (null != presentation) Marshal.ReleaseComObject(presentation); presentation = null; } } }
public void TestCloseNullDocument() { using (PowerPointApplicationController applicationController = new PowerPointApplicationController(true)) { applicationController.CreateHostApplication(2000); applicationController.CloseDocument(null, false); } }
public void TestCloseDocument() { using (PowerPointApplicationController applicationController = new PowerPointApplicationController(true)) { applicationController.CreateHostApplication(2000); object officeDocument = applicationController.OpenDocument(CopyFile(Path.Combine(m_testPath, "test.ppt")), false); Assert.IsNotNull(officeDocument); PowerPoint.Presentations presentations = null; try { Assert.IsInstanceOf(typeof(PowerPoint.Presentation), officeDocument); PowerPoint._Application application = (PowerPoint._Application)applicationController.HostApplication; presentations = (PowerPoint.Presentations)application.Presentations; Assert.AreEqual(1, presentations.Count); applicationController.CloseDocument(officeDocument, false); Assert.AreEqual(0, presentations.Count); } finally { if (null != officeDocument) Marshal.ReleaseComObject(officeDocument); officeDocument = null; if (null != presentations) Marshal.ReleaseComObject(presentations); presentations = null; } } }