コード例 #1
0
ファイル: TestDiscovery.cs プロジェクト: killbug2004/WSProf
        public void TestDiscoveryWhiteTextCountIsCorrect()
        {
            using (var file = new SelfDeletingFile("3WhiteText.xlsx"))
            {
                var attachment = new ProtectAttachment(FcsFileFactory.Create(file.FileName, "3WhiteText.xlsx"));
                var task = new TaskDiscovery(attachment);
                task.Execute(new CancellationToken());
                Assert.IsNotNull(attachment.RiskAnalysis);
                Assert.IsNotNull(attachment.RiskAnalysis.DiscoveryResult);
                Assert.IsTrue(attachment.RiskAnalysis.HasMetaData);
                Assert.IsTrue(attachment.RiskAnalysis.DiscoveryResult.HasMetadataOfType(MetadataType.WhiteText));

                var whiteTexts = attachment.RiskAnalysis.DiscoveryResult.GetItemsForType(MetadataType.WhiteText);

                var foundText =
                    (from text in whiteTexts
                        from detail in text.Details
                        where detail.Name == "Content"
                        select detail.Value).ToList();

                Assert.IsTrue(foundText.Contains("White Text 1"));
                Assert.IsTrue(foundText.Contains("White Text 2"));
                Assert.IsTrue(foundText.Contains("White Text 3"));

                Assert.IsTrue(foundText.Count == 3);
            }
        }
コード例 #2
0
ファイル: TestDiscovery.cs プロジェクト: killbug2004/WSProf
 public void TestDiscoverDocument()
 {
     using (var file = new SelfDeletingFile("SmallTextComplexDocument.doc"))
     {
         var attachment = new ProtectAttachment(FcsFileFactory.Create(file.FileName, "SmallTextComplexDocument"));
         var task = new TaskDiscovery(attachment);
         task.Execute(new CancellationToken());
         Assert.IsNotNull(attachment.RiskAnalysis);
         Assert.IsNotNull(attachment.RiskAnalysis.DiscoveryResult);
         Assert.IsTrue(attachment.RiskAnalysis.HasMetaData);
     }
 }
コード例 #3
0
        public void TestExpand()
        {
            using (var file = new SelfDeletingFile("small.zip"))
            {
                var attachment1 = new ProtectAttachment(FcsFileFactory.Create(file.FileName, "small"));

                var task1 = new TaskExtract(attachment1);
                task1.Execute(new CancellationToken());

                Assert.IsTrue(attachment1.Children.Any());

                Assert.IsNotNull(attachment1.Children.FirstOrDefault(x => x.Name == "Memory Usage in Protect.docx"));
                Assert.IsNotNull(attachment1.Children.FirstOrDefault(x => x.Name == "Sample Document_OriginalFile.docx"));

            }
        }