public void ShouldCreateIndependentOfProjectRuleWithPassedIds() { //GIVEN var ruleViolationFactory = Any.Instance <IDependencyPathRuleViolationFactory>(); var ruleFactory = new DependencyPathRuleFactory(ruleViolationFactory); var dependingId = Any.Pattern(); var dependencyId = Any.Instance <Glob>(); var independentRuleComplementDto = new IndependentRuleComplementDto( DependencyPathRuleFactory.ProjectDependencyType, dependingId, dependencyId); //WHEN var rule = ruleFactory.CreateDependencyRuleFrom(independentRuleComplementDto); //THEN rule.GetType().Should().Be <IndependentRule>(); rule.Should().DependOn(dependingId); rule.Should().DependOnTypeChain( typeof(JoinedDescribedCondition), typeof(IsFollowingAssemblyCondition)); rule.Should().DependOnTypeChain( typeof(JoinedDescribedCondition), typeof(HasAssemblyNameMatchingPatternCondition)); rule.Should().DependOn(dependencyId); rule.Should().DependOn(ruleViolationFactory); }
public void ShouldCreateIndependentOfAssemblyRuleWithPassedIds() { //GIVEN var ruleViolationFactory = Any.Instance <IDependencyPathRuleViolationFactory>(); var ruleFactory = new DependencyPathRuleFactory(ruleViolationFactory); var dependingNamePattern = Any.Pattern(); var assemblyNamePattern = Any.Instance <Glob>(); var independentRuleComplementDto = new IndependentRuleComplementDto( DependencyPathRuleFactory.AssemblyDependencyType, dependingNamePattern, assemblyNamePattern); //WHEN var rule = ruleFactory.CreateDependencyRuleFrom(independentRuleComplementDto); //THEN rule.Should().BeOfType <IndependentRule>(); rule.Should().DependOnTypeChain(typeof(DescribedCondition), typeof(HasAssemblyReferenceMatchingCondition)); rule.Should().DependOn(dependingNamePattern); rule.Should().DependOn(assemblyNamePattern); rule.Should().DependOn(ruleViolationFactory); }