private void ADiscoveryWithAllPossibleElements_STADelegate()
        {
            IMWApplication app = new CApplicationClass();
            IMWMetadataElements elems = SetupElements();
            IMWDocument protectDoc;

            Assert.IsNotNull(app, "CApplicationClass instance should not be null.");
            Assert.IsNotNull(elems, "CMetadataElementsClass instance should not be null.");

            protectDoc = (IMWDocument)app.Documents.Open(m_sFileToTest);
            Assert.IsNotNull(protectDoc, "IMWDocument instance should not be null after being opened in Protect.");

            MSXML2.IXMLDOMDocument xmlDOMDoc = (IXMLDOMDocument)protectDoc.DiscoverMetadata((CMetadataElementsClass)elems);
            Assert.IsNotNull( xmlDOMDoc , "DiscoverMetaData should return a non-null XmlDOM document.");

            protectDoc.Close( false );
        }
		private Workshare.Protect.Api.IMWDocument CleanCurrentDocument()
		{
			IMWMetadataElements elems = SetupElements();
			IMWApplication app = new CApplicationClass();
			IMWDocument protectDoc;
	
			Assert.IsNotNull( app , "CApplicationClass instance should not be null.");
				
			protectDoc = (IMWDocument)app.Documents.Open( m_sFileToTest );
			Assert.IsNotNull( protectDoc , "IMWDocument instance should not be null after being opened in Protect.");

			//do the cleaning and save the doc
			protectDoc.RemoveMetadata( (CMetadataElementsClass)elems );
			protectDoc.SaveAs(m_sCleanedDocPath);
			Assert.IsTrue( protectDoc.Saved , "Value of 'Saved' field should be true after a save.");

			return protectDoc;
		}