public void ShouldReportSuccessWhenNoProjectHasSpecifiedPackageReference()
        {
            //GIVEN
            var projectName = Any.String();
            var packageName = Any.String();
            var context     = new NScanDriver();

            context.HasProject(projectName);

            context.Add(RuleDemandingThat().Project(projectName).IndependentOfPackage(packageName));

            //WHEN
            context.PerformAnalysis();

            //THEN
            context.ReportShouldContain(
                ProjectIndependentOfMessage.ProjectIndependentOfPackage(projectName, packageName).Ok());
            context.ShouldIndicateSuccess();
        }
        public void ShouldReportAllSatisfiedRules()
        {
            //GIVEN
            var context = new NScanDriver();

            context.HasProject("A");
            context.HasProject("B");

            context.Add(RuleDemandingThat().Project("A")
                        .IndependentOfProject("B"));

            //WHEN
            context.PerformAnalysis();

            //THEN
            context.ReportShouldContain(
                ProjectIndependentOfMessage.ProjectIndependentOfProject("A", "B").Ok());
            context.ShouldIndicateSuccess();
        }
Пример #3
0
        public void ShouldReportSuccessWhenPatternExclusionRulesOutDependingThatWouldOtherwiseMatch()
        {
            //GIVEN
            var context = new NScanDriver();

            context.HasProject("CompositionRoot");
            context.HasProject("CompositionRootSpecification").WithReferences("CompositionRoot");

            context.Add(RuleBuilder.RuleDemandingThat()
                        .Project("*")
                        .Except("*Specification*")
                        .IndependentOfProject("*CompositionRoot*"));

            //WHEN
            context.PerformAnalysis();

            //THEN
            context.ReportShouldContain(
                ProjectIndependentOfMessage.ProjectIndependentOfProject(
                    "* except *Specification*", "*CompositionRoot*"
                    ).Ok());
            context.ShouldIndicateSuccess();
        }