public void ShouldAddAllDependencyRulesFromDtosToRuleSet() { //GIVEN var ruleDto1 = Any.Instance <IndependentRuleComplementDto>(); var ruleDto2 = Any.Instance <IndependentRuleComplementDto>(); var ruleDto3 = Any.Instance <IndependentRuleComplementDto>(); var dependencyAnalysis = Substitute.For <IDependencyAnalysis>(); var analysis = new AnalysisBuilder { DependencyAnalysis = dependencyAnalysis }.Build(); var ruleDtos = new [] { DependencyPathBasedRuleUnionDto.With(ruleDto1), DependencyPathBasedRuleUnionDto.With(ruleDto2), DependencyPathBasedRuleUnionDto.With(ruleDto3) }; //WHEN analysis.AddDependencyPathRules(ruleDtos); //THEN dependencyAnalysis.Received(1).Add(ruleDtos); }
public void ShouldAddRuleToRuleSet() { //GIVEN var ruleSet = Substitute.For <IPathRuleSet>(); var ruleFactory = Substitute.For <IDependencyBasedRuleFactory>(); var analysis = new DependencyAnalysis(Any.Instance <ISolutionForDependencyPathBasedRules>(), ruleSet, ruleFactory); var dto1 = Any.Instance <IndependentRuleComplementDto>(); var dto2 = Any.Instance <IndependentRuleComplementDto>(); var dto3 = Any.Instance <IndependentRuleComplementDto>(); var projectScopedRuleUnionDtos = new List <DependencyPathBasedRuleUnionDto> { DependencyPathBasedRuleUnionDto.With(dto1), DependencyPathBasedRuleUnionDto.With(dto2), DependencyPathBasedRuleUnionDto.With(dto3) }; var rule1 = Any.Instance <IDependencyRule>(); var rule2 = Any.Instance <IDependencyRule>(); var rule3 = Any.Instance <IDependencyRule>(); ruleFactory.CreateDependencyRuleFrom(dto1).Returns(rule1); ruleFactory.CreateDependencyRuleFrom(dto2).Returns(rule2); ruleFactory.CreateDependencyRuleFrom(dto3).Returns(rule3); //WHEN analysis.Add(projectScopedRuleUnionDtos); //THEN Received.InOrder(() => { ruleSet.Add(rule1); ruleSet.Add(rule2); ruleSet.Add(rule3); }); }
public IFullDependencyPathRuleConstructed IndependentOfAssembly(string assemblyName) { var complementDto = IndependentRuleComplement("assembly", assemblyName); _dependencyPathRuleDto = DependencyPathBasedRuleUnionDto.With(complementDto); _testedRuleDefinition = TestedRuleDefinition.From(complementDto); return(this); }
public IFullDependencyPathRuleConstructed IndependentOfPackage(string packageName) { var complementDto = IndependentRuleComplement("package", packageName); _dependencyPathRuleDto = DependencyPathBasedRuleUnionDto.With(complementDto); _testedRuleDefinition = TestedRuleDefinition.From(complementDto); return(this); }
IndependentOfRuleComplement(Pattern dependingPattern) { return(IndependentOfKeyword .Then(_ => from dependencyType in TextUntil(':') from dependency in TextUntilEol select DependencyPathBasedRuleUnionDto.With( new IndependentRuleComplementDto(dependencyType, dependingPattern, new Glob(dependency))))); }
public DependencyPathAnalysisRule(DependencyPathBasedRuleUnionDto dto) { _dto = dto; }