public void SearchSkimmer_AllowFileNameRegexMatchesProperly() { string scanTargetExtension = Guid.NewGuid().ToString(); SearchDefinition definition = null; AnalyzeContext context = CreateGuidMatchingSkimmer( scanTargetExtension: scanTargetExtension, ref definition, out SearchSkimmer skimmer, allowFileExtension: scanTargetExtension, denyFileExtension: null); AnalysisApplicability applicability = skimmer.CanAnalyze(context, out string reasonIfNotApplicable); applicability.Should().Be(AnalysisApplicability.ApplicableToSpecifiedTarget); reasonIfNotApplicable.Should().BeNull(); skimmer.Analyze(context); ValidateResultsAgainstDefinition(((TestLogger)context.Logger).Results, definition, skimmer); context.FileContents = null; ((TestLogger)context.Logger).Results.Clear(); skimmer.Analyze(context); ValidateResultsAgainstDefinition(((TestLogger)context.Logger).Results, definition, skimmer); }
public void SearchSkimmer_DenyFileNameRegexFiltersProperly() { string scanTargetExtension = Guid.NewGuid().ToString(); SearchDefinition definition = null; AnalyzeContext context = CreateGuidMatchingSkimmer( scanTargetExtension: scanTargetExtension, ref definition, out SearchSkimmer skimmer, allowFileExtension: null, denyFileExtension: scanTargetExtension); AnalysisApplicability applicability = skimmer.CanAnalyze(context, out string reasonIfNotApplicable); applicability.Should().Be(AnalysisApplicability.NotApplicableToSpecifiedTarget); reasonIfNotApplicable.Should().Be(SpamResources.TargetDoesNotMeetFileNameCriteria); skimmer.Analyze(context); ((TestLogger)context.Logger).Results.Should().BeNull(); }