public void TestVerifyFileWithOfficeWithCorruptFile() { using (TempFileForActions inputFile = new TempFileForActions(CopyFile(Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\Projects\Hygiene\src\TestDocuments\Corrupt.xls")))) { LightSpeedExcelCleaningStrategy strategy = new LightSpeedExcelCleaningStrategy(); Assert.IsFalse(strategy.VerifyFileWithOffice(inputFile), "Verification should fail"); } }
public void TestVerifyFileWithOffice() { using (TempFileForActions inputFile = new TempFileForActions(CopyFile(Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\Projects\Hygiene\src\TestDocuments\TestSimpleSpreadsheet.xls")))) { LightSpeedExcelCleaningStrategy strategy = new LightSpeedExcelCleaningStrategy(); Type type = typeof(LightSpeedExcelCleaningStrategy); MethodInfo mi = type.GetMethod("CleanFile", BindingFlags.NonPublic | BindingFlags.Instance); mi.Invoke( strategy, new object[3] { inputFile.TempFile, new List<ContentType>() { ContentType.ContentRule, ContentType.Comment, ContentType.Header, ContentType.Footer, ContentType.TrackChange, ContentType.Field, ContentType.RoutingSlip, ContentType.Links }, new List<Exclusion>() } ); Assert.IsTrue(strategy.VerifyFileWithOffice(inputFile)); } }