public void TestCreatePartFilterForContentType() { using (Stream str = File.Open(TESTFILE_DIR + "test002.docx", FileMode.Open)) { DocumentProcessor dp = new DocumentProcessor(str); Assert.IsTrue(dp.GetPartFilter("cheese/sandwiches", DocumentProcessingActions.Discover) is DefaultPartFilter); IPartFilter pf = dp.GetPartFilter("toast/xml", DocumentProcessingActions.Discover); Assert.IsInstanceOf(typeof(DefaultPartFilter), pf); Assert.AreEqual(str, pf.ProcessPart(str, null, null, DocumentProcessingActions.Clean), "expected the default part filter pass back the input stream when cleaning"); Assert.AreEqual(str, pf.ProcessPart(str, null, null, DocumentProcessingActions.PassThrough), "expected the default part filter pass back the input stream when passing through"); Assert.AreEqual(str, pf.ProcessPart(str, null, null, DocumentProcessingActions.DiscoverAndClean), "expected the default part filter pass back the input stream when cleaning and discovering"); Assert.AreEqual(null, pf.ProcessPart(str, null, null, DocumentProcessingActions.Discover), "expected the default part filter pass back null when discovering"); } }