Example #1
0
        public void ShouldReturnItsInnerRuleDescriptionWhenAskedForOne()
        {
            //GIVEN
            var innerRule = Any.Instance <IProjectScopedRule>();
            var rule      = new ProjectScopedRuleApplicableToMatchingProject(
                Any.Instance <Pattern>(),
                innerRule);

            //WHEN
            var description = rule.Description();

            //THEN
            description.Should().Be(innerRule.Description());
        }
Example #2
0
        public void ShouldNotDelegateToInnerRuleWhenProjectDoesNotMatchExpectedPattern()
        {
            //GIVEN
            var innerRule      = Substitute.For <IProjectScopedRule>();
            var projectPattern = Any.Pattern();
            var rule           = new ProjectScopedRuleApplicableToMatchingProject(projectPattern, innerRule);
            var target         = Substitute.For <IProjectScopedRuleTarget>();
            var report         = Any.Instance <IAnalysisReportInProgress>();

            target.HasProjectAssemblyNameMatching(projectPattern).Returns(false);

            //WHEN
            rule.Check(target, report);

            //THEN
            innerRule.ReceivedNothing();
        }
Example #3
0
        public void ShouldDelegateToInnerRuleWhenProjectMatchesExpectedPattern()
        {
            //GIVEN
            var innerRule      = Substitute.For <IProjectScopedRule>();
            var projectPattern = Any.Pattern();
            var rule           = new ProjectScopedRuleApplicableToMatchingProject(projectPattern, innerRule);
            var target         = Substitute.For <IProjectScopedRuleTarget>();
            var report         = Any.Instance <IAnalysisReportInProgress>();

            target.HasProjectAssemblyNameMatching(projectPattern).Returns(true);

            //WHEN
            rule.Check(target, report);

            //THEN
            Received.InOrder(() =>
            {
                target.AddInfoAboutMatchingPatternTo(report);
                innerRule.Check(target, report);
            });
        }