Esempio n. 1
0
		private string GetCorrectedDisplayName(string testDisplayName, string sourceFile)
		{
			string testFilesLocation = TestFileUtils.MakeRootPathAbsolute(@"\Projects\Hygiene\src\ResponseObjects.Tests\TestFiles\");
			string testFilePath = System.IO.Path.Combine(testFilesLocation, sourceFile);

			using (System.IO.FileStream fileStream = new System.IO.FileStream(testFilePath, System.IO.FileMode.Open))
			{
				Workshare.Policy.Engine.File f = new Workshare.Policy.Engine.File(fileStream, testDisplayName);
				return f.GetCorrectedDisplayName();
			}
		}
Esempio n. 2
0
        public void Test02_DocumentStatistics_SUPPORTED_BUT_NOT_WORKING()
        {
            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "dirty.doc");

            string fileName = TEST_FOLDER + "dirty.doc";
            IFile file = new File(fileName, "dirty.doc");
            Assert.IsTrue(DoesFileHaveMetdata(file, "DocumentStatistic"));
            file.Dispose();

            CleanerController cleaner = new CleanerController();
            cleaner.Options.UnCheckAll();
            cleaner.Options["DocumentStatistics"].Checked = true;
            cleaner.WriteToFolder = TEST_OUTPUT_FOLDER;
            cleaner.Files.AddRange(new string[] { fileName }, false);

            cleaner.Process();

            file = new File(TEST_OUTPUT_FOLDER + "dirty.doc", "dirty.doc");
            Assert.IsFalse(DoesFileHaveMetdata(file, "DocumentStatistic"));

            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "dirty.doc");
        }
Esempio n. 3
0
        public void Test01_Footnotes_SUPPORTED()
        {
            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "footnotes.doc");

            string fileName = TEST_FOLDER + "footnotes.doc";
            IFile file = new File(fileName, "footnotes.doc");
            Assert.IsTrue(DoesFileHaveMetdata(file, "Footnote"));
            file.Dispose();

            CleanerController cleaner = new CleanerController();
            cleaner.Options.UnCheckAll();
            cleaner.Options["Footnotes"].Checked = true;
            cleaner.WriteToFolder = TEST_OUTPUT_FOLDER;
            cleaner.Files.AddRange(new string[]{fileName}, false);

            cleaner.Process();

            file = new File(TEST_OUTPUT_FOLDER + "footnotes.doc", "footnotes.doc");
            Assert.IsFalse(DoesFileHaveMetdata(file, "Footnote"));

            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "footnotes.doc");
        }
Esempio n. 4
0
        public void TestShouldShowOptionForFileList()
        {
            OptionList list = new OptionList();

            File wordFile = new File(TEST_FOLDER + "small.doc", "small.doc");
            File excelFile = new File(TEST_FOLDER + "small.xls", "small.xls");
            File powerpointFile = new File(TEST_FOLDER + "test.ppt", "test.ppt");

            Collection<IContainer> wrd_excel = new Collection<IContainer>();
            Collection<IContainer> wrd_power = new Collection<IContainer>();
            Collection<IContainer> wrd_excel_power = new Collection<IContainer>();
            Collection<IContainer> excel_power = new Collection<IContainer>();

            wrd_excel.Add(wordFile);
            wrd_excel.Add(excelFile);

            wrd_power.Add(wordFile);
            wrd_power.Add(powerpointFile);

            wrd_excel_power.Add(wordFile);
            wrd_excel_power.Add(excelFile);
            wrd_excel_power.Add(powerpointFile);

            excel_power.Add(excelFile);
            excel_power.Add(powerpointFile);


            Assert.IsTrue(list.ShouldShowOptionForFileList("Footnotes", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Footnotes", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Footnotes", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Footnotes", excel_power));

            Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", wrd_excel));
            Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", wrd_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("SmartTags", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("SmartTags", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("SmartTags", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("SmartTags", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Template", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Template", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Template", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Template", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("DocumentVariables", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("DocumentVariables", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("DocumentVariables", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentVariables", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", wrd_excel_power));
			Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", excel_power));
			Assert.IsFalse(list.ShouldShowOptionForFileList("Macros", new Collection<IContainer> { powerpointFile }));

            Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", excel_power));

            Assert.IsFalse(list.ShouldShowOptionForFileList("SpeakerNotes", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("SpeakerNotes", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("SpeakerNotes", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("SpeakerNotes", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Links", wrd_excel));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Links", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Links", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Links", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Reviewers", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Reviewers", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Reviewers", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Reviewers", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("SmallText", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("SmallText", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("SmallText", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("SmallText", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("WhiteText", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("WhiteText", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("WhiteText", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("WhiteText", excel_power));

            Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", wrd_excel));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", wrd_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenText", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenText", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenText", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("HiddenText", excel_power));

            Assert.IsFalse(list.ShouldShowOptionForFileList("HiddenSlides", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenSlides", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenSlides", wrd_excel_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenSlides", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("AutoVersion", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("AutoVersion", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("AutoVersion", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("AutoVersion", excel_power));

            Assert.IsTrue(list.ShouldShowOptionForFileList("Versions", wrd_excel));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Versions", wrd_power));
            Assert.IsTrue(list.ShouldShowOptionForFileList("Versions", wrd_excel_power));
            Assert.IsFalse(list.ShouldShowOptionForFileList("Versions", excel_power));
        }
        public void Test04_Headers_NOTAPPLICABLE()
        {
            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "headers.docx");

            string fileName = TEST_FOLDER + "headers.docx";
            IFile file = new File(fileName, "headers.docx");
            Assert.IsTrue(DoesFileHaveMetdata(file, "Header"));
            file.Dispose();

            CleanerController cleaner = new CleanerController();
            cleaner.Options.UnCheckAll();
            cleaner.Options["Headers"].Checked = true;
            cleaner.WriteToFolder = TEST_OUTPUT_FOLDER;
            cleaner.Files.AddRange(new string[]{fileName}, false);

            cleaner.Process();

            file = new File(TEST_OUTPUT_FOLDER + "headers.docx", "headers.docx");
            Assert.IsTrue(DoesFileHaveMetdata(file, "Header"));

            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "headers.docx");
        }
Esempio n. 6
0
        public void Test20_HiddenText_SUPPORTED()
        {
            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "HiddenText.rtf");

            string fileName = TEST_FOLDER + "HiddenText.rtf";
            IFile file = new File(fileName, "HiddenText.rtf");
            Assert.IsTrue(DoesFileHaveMetadata(file, "HiddenText"));
            file.Dispose();

            CleanerController cleaner = new CleanerController();
            cleaner.Options.UnCheckAll();
            cleaner.Options["HiddenText"].Checked = true;
            cleaner.WriteToFolder = TEST_OUTPUT_FOLDER;
            cleaner.Files.AddRange(new string[]{fileName}, false);

            cleaner.Process();

            file = new File(TEST_OUTPUT_FOLDER + "HiddenText.rtf", "HiddenText.rtf");
            Assert.IsFalse(DoesFileHaveMetadata(file, "HiddenText"));

            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "HiddenText.rtf");
        }
Esempio n. 7
0
        public void Test12_RoutingSlip_SUPPORTED()
        {
            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "testroutingslip.rtf");

            IFile file = new File(TEST_FOLDER + "testroutingslip.rtf", "testroutingslip.rtf");
            Assert.IsTrue(DoesFileHaveMetadata(file, "RoutingSlip"));

            CleanerController cleaner = new CleanerController();
            cleaner.Files.Add(file);
            cleaner.Options.UnCheckAll();
            cleaner.Options["RoutingSlip"].Checked = true;
            cleaner.WriteToFolder = TEST_OUTPUT_FOLDER;

            cleaner.Process();

            file = new File(TEST_OUTPUT_FOLDER + "testroutingslip.rtf", "testroutingslip.rtf");
            Assert.IsFalse(DoesFileHaveMetadata(file, "RoutingSlip"));

            System.IO.File.Delete(TEST_OUTPUT_FOLDER + "testroutingslip.rtf");
        }