diff --git a/ArchUnitNET/Domain/Extensions/ObjectProviderExtensions.cs b/ArchUnitNET/Domain/Extensions/ObjectProviderExtensions.cs new file mode 100644 index 000000000..da0e8566f --- /dev/null +++ b/ArchUnitNET/Domain/Extensions/ObjectProviderExtensions.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace ArchUnitNET.Domain.Extensions +{ + internal static class ObjectProviderExtensions + { + private sealed class ReplaceDescriptionObjectProvider : IObjectProvider + { + private readonly IObjectProvider _innerObjectProvider; + + public ReplaceDescriptionObjectProvider( + IObjectProvider innerObjectProvider, + string newDescription + ) + { + _innerObjectProvider = innerObjectProvider; + Description = newDescription; + } + + public string Description { get; } + + public IEnumerable GetObjects(Architecture architecture) => + _innerObjectProvider.GetObjects(architecture); + + public string FormatDescription( + string emptyDescription, + string singleDescription, + string multipleDescription + ) => + _innerObjectProvider.FormatDescription( + emptyDescription, + singleDescription, + multipleDescription + ); + + public override string ToString() => Description; + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + return GetType() == obj.GetType() + && Equals((ReplaceDescriptionObjectProvider)obj); + } + + private bool Equals(ReplaceDescriptionObjectProvider other) + { + return Equals(_innerObjectProvider, other._innerObjectProvider) + && string.Equals(Description, other.Description, StringComparison.Ordinal); + } + + public override int GetHashCode() + { + unchecked + { + return ( + (_innerObjectProvider != null ? _innerObjectProvider.GetHashCode() : 0) + * 397 + ) ^ (Description != null ? Description.GetHashCode() : 0); + } + } + } + + internal static IObjectProvider WithDescription( + this IObjectProvider objectProvider, + string newDescription + ) + { + return new ReplaceDescriptionObjectProvider(objectProvider, newDescription); + } + + private sealed class DescriptionSuffixObjectProvider : IObjectProvider + { + private readonly IObjectProvider _innerObjectProvider; + private readonly string _descriptionSuffix; + + public DescriptionSuffixObjectProvider( + IObjectProvider innerObjectProvider, + string descriptionSuffix + ) + { + _innerObjectProvider = innerObjectProvider; + _descriptionSuffix = descriptionSuffix; + } + + public string Description => $"{_innerObjectProvider.Description} {_descriptionSuffix}"; + + public IEnumerable GetObjects(Architecture architecture) => + _innerObjectProvider.GetObjects(architecture); + + public string FormatDescription( + string emptyDescription, + string singleDescription, + string multipleDescription + ) => + _innerObjectProvider.FormatDescription( + emptyDescription, + singleDescription, + multipleDescription + ); + + public override string ToString() => Description; + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + return GetType() == obj.GetType() + && Equals((DescriptionSuffixObjectProvider)obj); + } + + private bool Equals(DescriptionSuffixObjectProvider other) + { + return Equals(_innerObjectProvider, other._innerObjectProvider) + && string.Equals( + _descriptionSuffix, + other._descriptionSuffix, + StringComparison.Ordinal + ); + } + + public override int GetHashCode() + { + unchecked + { + return ( + (_innerObjectProvider != null ? _innerObjectProvider.GetHashCode() : 0) + * 397 + ) ^ (_descriptionSuffix != null ? _descriptionSuffix.GetHashCode() : 0); + } + } + } + + internal static IObjectProvider WithDescriptionSuffix( + this IObjectProvider objectProvider, + string descriptionSuffix + ) + { + return new DescriptionSuffixObjectProvider(objectProvider, descriptionSuffix); + } + } +} diff --git a/ArchUnitNET/Fluent/ArchRule.cs b/ArchUnitNET/Fluent/ArchRule.cs index 8aa046858..3f2122736 100644 --- a/ArchUnitNET/Fluent/ArchRule.cs +++ b/ArchUnitNET/Fluent/ArchRule.cs @@ -1,79 +1,168 @@ using System.Collections.Generic; using System.Linq; using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Syntax; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent { - public class ArchRule : SyntaxElement, IArchRule + public abstract class ArchRule : IArchRule where TRuleType : ICanBeAnalyzed { - protected ArchRule(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected ArchRule( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + { + PartialArchRuleConjunction = partialArchRuleConjunction; + ObjectProvider = objectProvider; + Condition = condition; + } + + [CanBeNull] + protected PartialArchRuleConjunction PartialArchRuleConjunction { get; } + + protected IObjectProvider ObjectProvider { get; } + + protected IOrderedCondition Condition { get; } + + public string Description => + PartialArchRuleConjunction != null + ? $"{PartialArchRuleConjunction.LeftArchRule.Description} {PartialArchRuleConjunction.LogicalConjunction.Description} {ObjectProvider.Description} {Condition.Description}" + : $"{ObjectProvider.Description} {Condition.Description}"; /// /// By default, rules are evaluated so positive results are required to be present. /// This call defeats this check on the rule. /// - public ArchRule WithoutRequiringPositiveResults() + public ArchRuleWithoutRequirungPositiveResults WithoutRequiringPositiveResults() { - _ruleCreator.RequirePositiveResults = false; - return this; + return new ArchRuleWithoutRequirungPositiveResults( + PartialArchRuleConjunction, + ObjectProvider, + Condition + ); } public bool HasNoViolations(Architecture architecture) { - if (_ruleCreator.RequirePositiveResults) - { - return Evaluate(architecture).All(e => e.Passed); - } - else + if (PartialArchRuleConjunction != null) { - return _ruleCreator.HasNoViolations(architecture); + return PartialArchRuleConjunction.LogicalConjunction.Evaluate( + PartialArchRuleConjunction.LeftArchRule.HasNoViolations(architecture), + EvaluateCondition(architecture).All(result => result.Passed) + ); } + return Evaluate(architecture).All(result => result.Passed); } public IEnumerable Evaluate(Architecture architecture) { - var result = _ruleCreator.Evaluate(architecture).ToList(); + if (PartialArchRuleConjunction != null) + { + return PartialArchRuleConjunction + .LeftArchRule.Evaluate(architecture) + .Concat(EvaluateCondition(architecture)); + } + return EvaluateCondition(architecture); + } - // To require positives, we only ever need to add - // a non-passing result if there are no results. - if (_ruleCreator.RequirePositiveResults && result.Count == 0) + private IEnumerable EvaluateCondition(Architecture architecture) + { + var objects = ObjectProvider.GetObjects(architecture); + if (!(objects is ICollection objectsCollection)) + { + objectsCollection = objects.ToList(); + } + var conditionResults = Condition.Check(objectsCollection, architecture).ToList(); + if (conditionResults.Count == 0) { - result.Add( - new EvaluationResult( - this, - new StringIdentifier(Description), - false, - $"The rule requires positive evaluation, not just absence of violations. Use {nameof(WithoutRequiringPositiveResults)}() or improve your rule's predicates.", - this, - architecture - ) + yield return new EvaluationResult( + this, + new StringIdentifier(Description), + false, + "The rule requires positive evaluation, not just absence of violations. Use WithoutRequiringPositiveResults() or improve your rule's predicates.", + this, + architecture + ); + } + foreach (var conditionResult in conditionResults) + { + yield return new EvaluationResult( + conditionResult.AnalyzedObject, + new StringIdentifier(conditionResult.AnalyzedObject?.FullName ?? ""), + conditionResult.Pass, + conditionResult.AnalyzedObject != null + ? $"{conditionResult.AnalyzedObject.FullName} {conditionResult.Description}" + : conditionResult.Description, + this, + architecture ); } - - return result; } public CombinedArchRuleDefinition And() { - return new CombinedArchRuleDefinition(_ruleCreator, LogicalConjunctionDefinition.And); + return new CombinedArchRuleDefinition(this, LogicalConjunctionDefinition.And); } public CombinedArchRuleDefinition Or() { - return new CombinedArchRuleDefinition(_ruleCreator, LogicalConjunctionDefinition.Or); + return new CombinedArchRuleDefinition(this, LogicalConjunctionDefinition.Or); } public IArchRule And(IArchRule archRule) { - return new CombinedArchRule(_ruleCreator, LogicalConjunctionDefinition.And, archRule); + return new CombinedArchRule(this, LogicalConjunctionDefinition.And, archRule); } public IArchRule Or(IArchRule archRule) { - return new CombinedArchRule(_ruleCreator, LogicalConjunctionDefinition.Or, archRule); + return new CombinedArchRule(this, LogicalConjunctionDefinition.Or, archRule); + } + + public override string ToString() + { + return Description; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + return GetType() == obj.GetType() && Equals((ArchRule)obj); + } + + private bool Equals(ArchRule other) + { + return Equals(PartialArchRuleConjunction, other.PartialArchRuleConjunction) + && Equals(ObjectProvider, other.ObjectProvider) + && Equals(Condition, other.Condition); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = + PartialArchRuleConjunction != null + ? PartialArchRuleConjunction.GetHashCode() + : 0; + hashCode = + (hashCode * 397) ^ (ObjectProvider != null ? ObjectProvider.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (Condition != null ? Condition.GetHashCode() : 0); + return hashCode; + } } } } diff --git a/ArchUnitNET/Fluent/ArchRuleCreator.cs b/ArchUnitNET/Fluent/ArchRuleCreator.cs deleted file mode 100644 index 68eae4f84..000000000 --- a/ArchUnitNET/Fluent/ArchRuleCreator.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ArchUnitNET.Domain; -using ArchUnitNET.Fluent.Conditions; -using ArchUnitNET.Fluent.Predicates; - -namespace ArchUnitNET.Fluent -{ - public class ArchRuleCreator : IArchRuleCreator - where TRuleType : ICanBeAnalyzed - { - private readonly ConditionManager _conditionManager; - private readonly PredicateManager _predicateManager; - private bool? _requirePositiveResults; - - public ArchRuleCreator(BasicObjectProvider basicObjectProvider) - { - _predicateManager = new PredicateManager(basicObjectProvider); - _conditionManager = new ConditionManager(); - } - - public string Description => - (_predicateManager.Description + " " + _conditionManager.Description).Trim(); - - public bool HasNoViolations(Architecture architecture) - { - return HasNoViolations(GetAnalyzedObjects(architecture), architecture); - } - - public IEnumerable Evaluate(Architecture architecture) - { - return EvaluateConditions(GetAnalyzedObjects(architecture), architecture); - } - - public void AddPredicate(IPredicate predicate) - { - _predicateManager.AddPredicate(predicate); - } - - public void AddPredicateConjunction(LogicalConjunction logicalConjunction) - { - _predicateManager.SetNextLogicalConjunction(logicalConjunction); - } - - public void AddCondition(IOrderedCondition condition) - { - _conditionManager.AddCondition(condition); - } - - public void AddConditionConjunction(LogicalConjunction logicalConjunction) - { - _conditionManager.SetNextLogicalConjunction(logicalConjunction); - } - - public void AddConditionReason(string reason) - { - _conditionManager.AddReason(reason); - } - - public void AddPredicateReason(string reason) - { - _predicateManager.AddReason(reason); - } - - public void BeginComplexCondition( - IObjectProvider relatedObjects, - RelationCondition relationCondition - ) - where TRelatedType : ICanBeAnalyzed - { - _conditionManager.BeginComplexCondition(relatedObjects, relationCondition); - } - - public void ContinueComplexCondition(IPredicate predicate) - where TRelatedType : ICanBeAnalyzed - { - _conditionManager.ContinueComplexCondition(predicate); - } - - public IEnumerable GetAnalyzedObjects(Architecture architecture) - { - return _predicateManager.GetObjects(architecture); - } - - public void SetCustomPredicateDescription(string description) - { - _predicateManager.SetCustomDescription(description); - } - - public void SetCustomConditionDescription(string description) - { - _conditionManager.SetCustomDescription(description); - } - - private void SetRequirePositiveResults(bool requirePositive) - { - if (_requirePositiveResults != null && _requirePositiveResults != requirePositive) - throw new InvalidOperationException("conflicting positive expectation"); - _requirePositiveResults = requirePositive; - } - - public bool RequirePositiveResults - { - get => _requirePositiveResults ?? true; - set => SetRequirePositiveResults(value); - } - - private bool HasNoViolations( - IEnumerable filteredObjects, - Architecture architecture - ) - { - return EvaluateConditions(filteredObjects, architecture).All(result => result.Passed); - } - - private IEnumerable EvaluateConditions( - IEnumerable filteredObjects, - Architecture architecture - ) - { - return _conditionManager.EvaluateConditions(filteredObjects, architecture, this); - } - - public override string ToString() - { - return Description; - } - - private bool Equals(ArchRuleCreator other) - { - return _conditionManager.Equals(other._conditionManager) - && _predicateManager.Equals(other._predicateManager); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - return obj.GetType() == GetType() && Equals((ArchRuleCreator)obj); - } - - public override int GetHashCode() - { - unchecked - { - var hashCode = - 397 ^ (_conditionManager != null ? _conditionManager.GetHashCode() : 0); - hashCode = - (hashCode * 397) - ^ (_predicateManager != null ? _predicateManager.GetHashCode() : 0); - return hashCode; - } - } - } -} diff --git a/ArchUnitNET/Fluent/ArchRuleDefinition.cs b/ArchUnitNET/Fluent/ArchRuleDefinition.cs index 943dcbbe2..53c05ce4b 100644 --- a/ArchUnitNET/Fluent/ArchRuleDefinition.cs +++ b/ArchUnitNET/Fluent/ArchRuleDefinition.cs @@ -14,70 +14,62 @@ public static class ArchRuleDefinition { public static GivenTypes Types(bool includeReferenced = false) { - var ruleCreator = includeReferenced - ? new ArchRuleCreator(BasicObjectProviderDefinition.TypesIncludingReferenced) - : new ArchRuleCreator(BasicObjectProviderDefinition.Types); - return new GivenTypes(ruleCreator); + return new GivenTypes( + null, + includeReferenced + ? BasicObjectProviderDefinition.TypesIncludingReferenced + : BasicObjectProviderDefinition.Types + ); } public static GivenAttributes Attributes(bool includeReferenced = false) { - var ruleCreator = includeReferenced - ? new ArchRuleCreator( - BasicObjectProviderDefinition.AttributesIncludingReferenced - ) - : new ArchRuleCreator(BasicObjectProviderDefinition.Attributes); - return new GivenAttributes(ruleCreator); + return new GivenAttributes( + null, + includeReferenced + ? BasicObjectProviderDefinition.AttributesIncludingReferenced + : BasicObjectProviderDefinition.Attributes + ); } public static GivenClasses Classes(bool includeReferenced = false) { - var ruleCreator = includeReferenced - ? new ArchRuleCreator( - BasicObjectProviderDefinition.ClassesIncludingReferenced - ) - : new ArchRuleCreator(BasicObjectProviderDefinition.Classes); - return new GivenClasses(ruleCreator); + return new GivenClasses( + null, + includeReferenced + ? BasicObjectProviderDefinition.ClassesIncludingReferenced + : BasicObjectProviderDefinition.Classes + ); } public static GivenInterfaces Interfaces(bool includeReferenced = false) { - var ruleCreator = includeReferenced - ? new ArchRuleCreator( - BasicObjectProviderDefinition.InterfacesIncludingReferenced - ) - : new ArchRuleCreator(BasicObjectProviderDefinition.Interfaces); - return new GivenInterfaces(ruleCreator); + return new GivenInterfaces( + null, + includeReferenced + ? BasicObjectProviderDefinition.InterfacesIncludingReferenced + : BasicObjectProviderDefinition.Interfaces + ); } public static GivenMembers Members() { - var ruleCreator = new ArchRuleCreator(BasicObjectProviderDefinition.Members); - return new GivenMembers(ruleCreator); + return new GivenMembers(null, BasicObjectProviderDefinition.Members); } public static GivenFieldMembers FieldMembers() { - var ruleCreator = new ArchRuleCreator( - BasicObjectProviderDefinition.FieldMembers - ); - return new GivenFieldMembers(ruleCreator); + return new GivenFieldMembers(null, BasicObjectProviderDefinition.FieldMembers); } public static GivenMethodMembers MethodMembers() { - var ruleCreator = new ArchRuleCreator( - BasicObjectProviderDefinition.MethodMembers - ); - return new GivenMethodMembers(ruleCreator); + return new GivenMethodMembers(null, BasicObjectProviderDefinition.MethodMembers); } public static GivenPropertyMembers PropertyMembers() { - var ruleCreator = new ArchRuleCreator( - BasicObjectProviderDefinition.PropertyMembers - ); - return new GivenPropertyMembers(ruleCreator); + return new GivenPropertyMembers(null, BasicObjectProviderDefinition.PropertyMembers); } } } diff --git a/ArchUnitNET/Fluent/ArchRuleWithoutRequirungPositiveResults.cs b/ArchUnitNET/Fluent/ArchRuleWithoutRequirungPositiveResults.cs new file mode 100644 index 000000000..80d0dd843 --- /dev/null +++ b/ArchUnitNET/Fluent/ArchRuleWithoutRequirungPositiveResults.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using System.Linq; +using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; + +namespace ArchUnitNET.Fluent +{ + public class ArchRuleWithoutRequirungPositiveResults : IArchRule + where TRuleType : ICanBeAnalyzed + { + internal ArchRuleWithoutRequirungPositiveResults( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + { + PartialArchRuleConjunction = partialArchRuleConjunction; + ObjectProvider = objectProvider; + Condition = condition; + } + + [CanBeNull] + protected PartialArchRuleConjunction PartialArchRuleConjunction { get; } + + protected IObjectProvider ObjectProvider { get; } + + protected IOrderedCondition Condition { get; } + + public string Description => + PartialArchRuleConjunction != null + ? $"{PartialArchRuleConjunction.LeftArchRule.Description} {PartialArchRuleConjunction.LogicalConjunction.Description} {ObjectProvider.Description} {Condition.Description}" + : $"{ObjectProvider.Description} {Condition.Description}"; + + public bool HasNoViolations(Architecture architecture) + { + return Evaluate(architecture).All(result => result.Passed); + } + + public IEnumerable Evaluate(Architecture architecture) + { + return Condition + .Check(ObjectProvider.GetObjects(architecture), architecture) + .Select(conditionResult => new EvaluationResult( + conditionResult.AnalyzedObject, + new StringIdentifier(conditionResult.AnalyzedObject.FullName), + conditionResult.Pass, + conditionResult.Pass + ? $"{conditionResult.AnalyzedObject.FullName} passed" + : $"{conditionResult.AnalyzedObject.FullName} {conditionResult.Description}", + this, + architecture + )); + } + + public CombinedArchRuleDefinition And() + { + return new CombinedArchRuleDefinition(this, LogicalConjunctionDefinition.And); + } + + public CombinedArchRuleDefinition Or() + { + return new CombinedArchRuleDefinition(this, LogicalConjunctionDefinition.Or); + } + + public IArchRule And(IArchRule archRule) + { + return new CombinedArchRule(this, LogicalConjunctionDefinition.And, archRule); + } + + public IArchRule Or(IArchRule archRule) + { + return new CombinedArchRule(this, LogicalConjunctionDefinition.Or, archRule); + } + } +} diff --git a/ArchUnitNET/Fluent/CombinedArchRuleCreator.cs b/ArchUnitNET/Fluent/CombinedArchRuleCreator.cs deleted file mode 100644 index 7dfedc516..000000000 --- a/ArchUnitNET/Fluent/CombinedArchRuleCreator.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ArchUnitNET.Domain; -using ArchUnitNET.Fluent.Conditions; -using ArchUnitNET.Fluent.Exceptions; -using ArchUnitNET.Fluent.Predicates; - -namespace ArchUnitNET.Fluent -{ - public class CombinedArchRuleCreator : IArchRuleCreator - where TRuleType : ICanBeAnalyzed - { - private readonly ArchRuleCreator _currentArchRuleCreator; - private readonly LogicalConjunction _logicalConjunction; - private readonly ICanBeEvaluated _oldRule; - private bool? _requirePositiveResults; - - public CombinedArchRuleCreator( - ICanBeEvaluated oldRule, - LogicalConjunction logicalConjunction, - BasicObjectProvider basicObjectProvider - ) - { - _oldRule = oldRule; - _logicalConjunction = logicalConjunction; - _currentArchRuleCreator = new ArchRuleCreator(basicObjectProvider); - } - - public string Description => - _oldRule.Description - + " " - + _logicalConjunction.Description - + " " - + _currentArchRuleCreator.Description; - - public bool HasNoViolations(Architecture architecture) - { - return _logicalConjunction.Evaluate( - _oldRule.HasNoViolations(architecture), - _currentArchRuleCreator.HasNoViolations(architecture) - ); - } - - public IEnumerable Evaluate(Architecture architecture) - { - return _oldRule - .Evaluate(architecture) - .Concat(_currentArchRuleCreator.Evaluate(architecture)); - } - - public void AddPredicate(IPredicate predicate) - { - _currentArchRuleCreator.AddPredicate(predicate); - } - - public void AddPredicateConjunction(LogicalConjunction logicalConjunction) - { - _currentArchRuleCreator.AddPredicateConjunction(logicalConjunction); - } - - public void AddCondition(IOrderedCondition condition) - { - _currentArchRuleCreator.AddCondition(condition); - } - - public void AddConditionConjunction(LogicalConjunction logicalConjunction) - { - _currentArchRuleCreator.AddConditionConjunction(logicalConjunction); - } - - public void AddConditionReason(string reason) - { - _currentArchRuleCreator.AddConditionReason(reason); - } - - public void AddPredicateReason(string reason) - { - _currentArchRuleCreator.AddPredicateReason(reason); - } - - public void BeginComplexCondition( - IObjectProvider relatedObjects, - RelationCondition relationCondition - ) - where TRelatedType : ICanBeAnalyzed - { - _currentArchRuleCreator.BeginComplexCondition(relatedObjects, relationCondition); - } - - public void ContinueComplexCondition(IPredicate predicate) - where TRelatedType : ICanBeAnalyzed - { - _currentArchRuleCreator.ContinueComplexCondition(predicate); - } - - public IEnumerable GetAnalyzedObjects(Architecture architecture) - { - throw new CannotGetObjectsOfCombinedArchRuleCreatorException( - "GetFilteredObjects() can't be used with CombinedArchRuleCreators because the analyzed objects might be of different type." - ); - } - - public void SetCustomPredicateDescription(string description) - { - _currentArchRuleCreator.SetCustomPredicateDescription(description); - } - - public void SetCustomConditionDescription(string description) - { - _currentArchRuleCreator.SetCustomConditionDescription(description); - } - - private void SetRequirePositiveResults(bool requirePositive) - { - if (_requirePositiveResults != null && _requirePositiveResults != requirePositive) - throw new InvalidOperationException("conflicting positive expectation"); - _requirePositiveResults = requirePositive; - } - - public bool RequirePositiveResults - { - get => _requirePositiveResults ?? true; - set => SetRequirePositiveResults(value); - } - - public override string ToString() - { - return Description; - } - - private bool Equals(CombinedArchRuleCreator other) - { - return Equals(_oldRule, other._oldRule) - && Equals(_logicalConjunction, other._logicalConjunction) - && Equals(_currentArchRuleCreator, other._currentArchRuleCreator); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - return obj.GetType() == GetType() && Equals((CombinedArchRuleCreator)obj); - } - - public override int GetHashCode() - { - unchecked - { - var hashCode = _oldRule != null ? _oldRule.GetHashCode() : 0; - hashCode = - (hashCode * 397) - ^ (_logicalConjunction != null ? _logicalConjunction.GetHashCode() : 0); - hashCode = - (hashCode * 397) - ^ (_currentArchRuleCreator != null ? _currentArchRuleCreator.GetHashCode() : 0); - return hashCode; - } - } - } -} diff --git a/ArchUnitNET/Fluent/CombinedArchRuleDefinition.cs b/ArchUnitNET/Fluent/CombinedArchRuleDefinition.cs index 75b6fff61..7eb5ed5c3 100644 --- a/ArchUnitNET/Fluent/CombinedArchRuleDefinition.cs +++ b/ArchUnitNET/Fluent/CombinedArchRuleDefinition.cs @@ -10,98 +10,58 @@ namespace ArchUnitNET.Fluent { - public class CombinedArchRuleDefinition + public class CombinedArchRuleDefinition : PartialArchRuleConjunction { - private readonly LogicalConjunction _logicalConjunction; - private readonly ICanBeEvaluated _oldRule; + internal override ICanBeEvaluated LeftArchRule { get; } + internal override LogicalConjunction LogicalConjunction { get; } public CombinedArchRuleDefinition( - ICanBeEvaluated oldRule, + ICanBeEvaluated leftRule, LogicalConjunction logicalConjunction ) { - _oldRule = oldRule; - _logicalConjunction = logicalConjunction; + LeftArchRule = leftRule; + LogicalConjunction = logicalConjunction; } public GivenTypes Types() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.Types - ); - return new GivenTypes(combinedRuleCreator); + return new GivenTypes(this, BasicObjectProviderDefinition.Types); } public GivenAttributes Attributes() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.Attributes - ); - return new GivenAttributes(combinedRuleCreator); + return new GivenAttributes(this, BasicObjectProviderDefinition.Attributes); } public GivenClasses Classes() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.Classes - ); - return new GivenClasses(combinedRuleCreator); + return new GivenClasses(this, BasicObjectProviderDefinition.Classes); } public GivenInterfaces Interfaces() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.Interfaces - ); - return new GivenInterfaces(combinedRuleCreator); + return new GivenInterfaces(this, BasicObjectProviderDefinition.Interfaces); } public GivenMembers Members() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.Members - ); - return new GivenMembers(combinedRuleCreator); + return new GivenMembers(this, BasicObjectProviderDefinition.Members); } public GivenFieldMembers FieldMembers() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.FieldMembers - ); - return new GivenFieldMembers(combinedRuleCreator); + return new GivenFieldMembers(this, BasicObjectProviderDefinition.FieldMembers); } public GivenMethodMembers MethodMembers() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.MethodMembers - ); - return new GivenMethodMembers(combinedRuleCreator); + return new GivenMethodMembers(this, BasicObjectProviderDefinition.MethodMembers); } public GivenPropertyMembers PropertyMembers() { - var combinedRuleCreator = new CombinedArchRuleCreator( - _oldRule, - _logicalConjunction, - BasicObjectProviderDefinition.PropertyMembers - ); - return new GivenPropertyMembers(combinedRuleCreator); + return new GivenPropertyMembers(this, BasicObjectProviderDefinition.PropertyMembers); } } } diff --git a/ArchUnitNET/Fluent/ConditionManager.cs b/ArchUnitNET/Fluent/ConditionManager.cs deleted file mode 100644 index 4acf30bbe..000000000 --- a/ArchUnitNET/Fluent/ConditionManager.cs +++ /dev/null @@ -1,401 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ArchUnitNET.Domain; -using ArchUnitNET.Domain.Extensions; -using ArchUnitNET.Fluent.Conditions; -using ArchUnitNET.Fluent.Extensions; -using ArchUnitNET.Fluent.Predicates; -using JetBrains.Annotations; - -namespace ArchUnitNET.Fluent -{ - internal class ConditionManager : IHasDescription - where T : ICanBeAnalyzed - { - private readonly List> _conditionElements; - private Type _referenceTypeTemp; - private object _relatedObjectsTemp; - private object _relationConditionTemp; - - public ConditionManager() - { - _conditionElements = new List> - { - new ConditionElement(LogicalConjunctionDefinition.ForwardSecondValue), - }; - } - - public string Description => - _conditionElements - .Aggregate( - "", - (current, conditionElement) => current + " " + conditionElement.Description - ) - .Trim(); - - public void BeginComplexCondition( - IObjectProvider relatedObjects, - RelationCondition relationCondition - ) - where TRelatedType : ICanBeAnalyzed - { - _relatedObjectsTemp = relatedObjects; - _relationConditionTemp = relationCondition; - _referenceTypeTemp = typeof(TRelatedType); - } - - public void ContinueComplexCondition(IPredicate filter) - where TRelatedType : ICanBeAnalyzed - { - if (typeof(TRelatedType) == _referenceTypeTemp) - { - AddCondition( - new ComplexCondition( - (IObjectProvider)_relatedObjectsTemp, - (RelationCondition)_relationConditionTemp, - filter - ) - ); - } - else - { - throw new InvalidCastException( - "ContinueComplexCondition() has to be called with the same generic type argument that was used for BeginComplexCondition()." - ); - } - } - - public void AddCondition(IOrderedCondition condition) - { - _conditionElements.Last().SetCondition(condition); - } - - public void AddReason(string reason) - { - _conditionElements.Last().AddReason(reason); - } - - public void SetCustomDescription(string description) - { - _conditionElements.ForEach(conditionElement => - conditionElement.SetCustomDescription("") - ); - _conditionElements.Last().SetCustomDescription(description); - } - - public void SetNextLogicalConjunction(LogicalConjunction logicalConjunction) - { - _conditionElements.Add(new ConditionElement(logicalConjunction)); - } - - private bool CheckEmpty() - { - return _conditionElements.Aggregate( - true, - (currentResult, conditionElement) => conditionElement.CheckEmpty(currentResult) - ); - } - - public IEnumerable EvaluateConditions( - IEnumerable filteredObjects, - Architecture architecture, - ICanBeEvaluated archRuleCreator - ) - { - var filteredObjectsList = filteredObjects.ToList(); - if (filteredObjectsList.IsNullOrEmpty() && !CheckEmpty()) - { - return new[] - { - new EvaluationResult( - null, - new StringIdentifier(""), - false, - "There are no objects matching the criteria", - archRuleCreator, - architecture - ), - }; - } - - var conditionResults = _conditionElements - .Select(conditionElement => - conditionElement.Check(filteredObjectsList, architecture).ToList() - ) - .ToList(); - return filteredObjectsList.Select( - (t, i) => - CreateEvaluationResult( - conditionResults.Select(results => results[i]), - architecture, - archRuleCreator - ) - ); - } - - private IEnumerable FindResultsForObject( - List> conditionResults, - T canBeAnalyzed - ) - { - return conditionResults.Select(results => results[canBeAnalyzed]); - } - - private static IEnumerable FindResultsForObject( - List> conditionResults, - T t - ) - { - return conditionResults.Select(results => - results.Find(x => x.ConditionResult.AnalyzedObject.Equals(t)) - ); - } - - private static EvaluationResult CreateEvaluationResult( - IEnumerable conditionElementResults, - Architecture architecture, - ICanBeEvaluated archRuleCreator - ) - { - var conditionElementResultsList = conditionElementResults.ToList(); - var analyzedObject = conditionElementResultsList.First().ConditionResult.AnalyzedObject; - var passRule = conditionElementResultsList.Aggregate( - true, - (currentResult, conditionElementResult) => - conditionElementResult.LogicalConjunction.Evaluate( - currentResult, - conditionElementResult.ConditionResult.Pass - ) - ); - var description = analyzedObject.FullName; - if (passRule) - { - description += " passed"; - } - else - { - var first = true; - var failDescriptionCache = new List(); //Prevent failDescriptions like "... failed because ... is public and is public" - foreach ( - var conditionResult in conditionElementResultsList - .Select(result => result.ConditionResult) - .Where(condResult => - !condResult.Pass - && !failDescriptionCache.Contains(condResult.FailDescription) - ) - ) - { - if (!first) - { - description += " and"; - } - - description += " " + conditionResult.FailDescription; - failDescriptionCache.Add(conditionResult.FailDescription); - first = false; - } - } - - var identifier = new StringIdentifier(analyzedObject.FullName); - return new EvaluationResult( - analyzedObject, - identifier, - passRule, - description, - archRuleCreator, - architecture - ); - } - - public override string ToString() - { - return Description; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - return obj.GetType() == GetType() && Equals((ConditionManager)obj); - } - - public override int GetHashCode() - { - unchecked - { - return _conditionElements.Aggregate( - 397, - (current, conditionElement) => - (current * 397) - ^ (conditionElement != null ? conditionElement.GetHashCode() : 0) - ); - } - } - - private bool Equals(ConditionManager other) - { - return _conditionElements.SequenceEqual(other._conditionElements) - && _referenceTypeTemp == other._referenceTypeTemp - && _relationConditionTemp == other._relationConditionTemp; - } -#pragma warning disable 693 - private class ConditionElement : IHasDescription - where T : ICanBeAnalyzed - { - private readonly LogicalConjunction _logicalConjunction; - private IOrderedCondition _condition; - - [CanBeNull] - private string _customDescription; - - private string _reason; - - public ConditionElement(LogicalConjunction logicalConjunction) - { - _condition = null; - _logicalConjunction = logicalConjunction; - _reason = ""; - } - - public string Description => - _customDescription - ?? ( - _condition == null - ? "" - : ( - _logicalConjunction.Description - + " should " - + _condition.GetShortDescription() - + " " - + _reason - ).Trim() - ); - - public void AddReason(string reason) - { - if (_condition == null) - { - throw new InvalidOperationException( - "Can't add a reason to a ConditionElement before the condition is set." - ); - } - - if (_reason != "") - { - throw new InvalidOperationException( - "Can't add a reason to a ConditionElement which already has a reason." - ); - } - - _reason = "because " + reason; - } - - public void SetCondition(IOrderedCondition condition) - { - _condition = condition; - } - - public void SetCustomDescription(string description) - { - _customDescription = description; - } - - public IEnumerable Check( - IEnumerable objects, - Architecture architecture - ) - { - if (_condition == null) - { - throw new InvalidOperationException( - "Can't check a ConditionElement before the condition is set." - ); - } - - return _condition - .Check(objects, architecture) - .Select(result => new ConditionElementResult(result, _logicalConjunction)); - } - - public bool CheckEmpty(bool currentResult) - { - if (_condition == null) - { - throw new InvalidOperationException( - "Can't check a ConditionElement before the condition is set." - ); - } - - return _logicalConjunction.Evaluate(currentResult, _condition.CheckEmpty()); - } - - public override string ToString() - { - return Description; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - return obj.GetType() == GetType() && Equals((ConditionElement)obj); - } - - private bool Equals(ConditionElement other) - { - return Equals(_logicalConjunction, other._logicalConjunction) - && Equals(_condition, other._condition) - && _customDescription == other._customDescription - && _reason == other._reason; - } - - public override int GetHashCode() - { - unchecked - { - var hashCode = - _logicalConjunction != null ? _logicalConjunction.GetHashCode() : 0; - hashCode = - (hashCode * 397) ^ (_condition != null ? _condition.GetHashCode() : 0); - hashCode = - (hashCode * 397) - ^ (_customDescription != null ? _customDescription.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (_reason != null ? _reason.GetHashCode() : 0); - return hashCode; - } - } - } - - private class ConditionElementResult - { - public readonly ConditionResult ConditionResult; - public readonly LogicalConjunction LogicalConjunction; - - public ConditionElementResult( - ConditionResult conditionResult, - LogicalConjunction logicalConjunction - ) - { - ConditionResult = conditionResult; - LogicalConjunction = logicalConjunction; - } - } - } -} diff --git a/ArchUnitNET/Fluent/Conditions/ArchitectureCondition.cs b/ArchUnitNET/Fluent/Conditions/ArchitectureCondition.cs index d588e1cc9..0e54a7b4d 100644 --- a/ArchUnitNET/Fluent/Conditions/ArchitectureCondition.cs +++ b/ArchUnitNET/Fluent/Conditions/ArchitectureCondition.cs @@ -25,7 +25,7 @@ string description public string Description { get; } - public IEnumerable Check( + public IEnumerable Check( IEnumerable objects, Architecture architecture ) diff --git a/ArchUnitNET/Fluent/Conditions/CombinedCondition.cs b/ArchUnitNET/Fluent/Conditions/CombinedCondition.cs new file mode 100644 index 000000000..7d08720e4 --- /dev/null +++ b/ArchUnitNET/Fluent/Conditions/CombinedCondition.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Syntax.Elements.Types; + +namespace ArchUnitNET.Fluent.Conditions +{ + internal sealed class CombinedCondition : IOrderedCondition + where TRuleType : ICanBeAnalyzed + { + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; + private readonly IOrderedCondition _rightCondition; + + public CombinedCondition( + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction, + IOrderedCondition rightCondition + ) + { + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; + _rightCondition = rightCondition; + } + + public string Description => + $"{_leftCondition.Description} {_logicalConjunction.Description} should {_rightCondition.Description}"; + + public IEnumerable Check( + IEnumerable objects, + Architecture architecture + ) + { + if (!(objects is ICollection objectCollection)) + { + objectCollection = objects.ToList(); + } + var leftResults = _leftCondition.Check(objectCollection, architecture); + var rightResults = _rightCondition.Check(objectCollection, architecture); + if (objectCollection.Count == 0) + { + return leftResults.Concat(rightResults); + } + return leftResults.Zip( + rightResults, + (leftResult, rightResult) => + { + if (leftResult is CombinedConditionResult combinedLeftResult) + { + return combinedLeftResult.Add(_logicalConjunction, rightResult); + } + return new CombinedConditionResult( + leftResult, + _logicalConjunction, + rightResult + ); + } + ); + } + + public bool CheckEmpty() + { + return _logicalConjunction.Evaluate( + _leftCondition.CheckEmpty(), + _rightCondition.CheckEmpty() + ); + } + } +} diff --git a/ArchUnitNET/Fluent/Conditions/CombinedConditionResult.cs b/ArchUnitNET/Fluent/Conditions/CombinedConditionResult.cs new file mode 100644 index 000000000..01e06e18f --- /dev/null +++ b/ArchUnitNET/Fluent/Conditions/CombinedConditionResult.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using System.Linq; +using ArchUnitNET.Domain; + +namespace ArchUnitNET.Fluent.Conditions +{ + public class CombinedConditionResult : IConditionResult + { + private readonly IConditionResult _firstConditionResult; + private readonly List _conditionElements; + + public CombinedConditionResult( + IConditionResult left, + LogicalConjunction logicalConjunction, + IConditionResult right + ) + { + _firstConditionResult = left; + _conditionElements = new List + { + new ConditionElementResult(right, logicalConjunction), + }; + } + + public CombinedConditionResult Add( + LogicalConjunction logicalConjunction, + IConditionResult conditionResult + ) + { + _conditionElements.Add(new ConditionElementResult(conditionResult, logicalConjunction)); + return this; + } + + public ICanBeAnalyzed AnalyzedObject => + _conditionElements[0].ConditionResult.AnalyzedObject; + + public bool Pass + { + get + { + return _conditionElements.Aggregate( + _firstConditionResult.Pass, + (currentResult, conditionElement) => + conditionElement.LogicalConjunction.Evaluate( + currentResult, + conditionElement.ConditionResult.Pass + ) + ); + } + } + + public string Description + { + get + { + if (Pass) + { + return $"{AnalyzedObject.FullName} passed"; + } + var conditionResults = new List(_conditionElements.Count + 1) + { + _firstConditionResult, + }; + conditionResults.AddRange( + _conditionElements.Select(condElement => condElement.ConditionResult) + ); + return string.Join( + " and ", + conditionResults + .Where(condResult => !condResult.Pass) + .Select(condResult => condResult.Description) + .Distinct() + ); + } + } + + private class ConditionElementResult + { + public readonly IConditionResult ConditionResult; + public readonly LogicalConjunction LogicalConjunction; + + public ConditionElementResult( + IConditionResult conditionResult, + LogicalConjunction logicalConjunction + ) + { + ConditionResult = conditionResult; + LogicalConjunction = logicalConjunction; + } + } + } +} diff --git a/ArchUnitNET/Fluent/Conditions/ComplexCondition.cs b/ArchUnitNET/Fluent/Conditions/ComplexCondition.cs deleted file mode 100644 index b070c1bc4..000000000 --- a/ArchUnitNET/Fluent/Conditions/ComplexCondition.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Collections.Generic; -using ArchUnitNET.Domain; -using ArchUnitNET.Fluent.Predicates; - -namespace ArchUnitNET.Fluent.Conditions -{ - public class ComplexCondition : IOrderedCondition - where TRuleType : ICanBeAnalyzed - where TRelatedType : ICanBeAnalyzed - { - private readonly IPredicate _predicate; - private readonly IObjectProvider _relatedTypes; - private readonly RelationCondition _relation; - - public ComplexCondition( - IObjectProvider relatedTypes, - RelationCondition relation, - IPredicate predicate - ) - { - _relatedTypes = relatedTypes; - _relation = relation; - _predicate = predicate; - } - - public string Description => _relation.Description + " " + _predicate.Description; - - public IEnumerable Check( - IEnumerable objects, - Architecture architecture - ) - { - return _relation - .GetCondition( - _predicate.GetMatchingObjects( - _relatedTypes.GetObjects(architecture), - architecture - ) - ) - .Check(objects, architecture); - } - - public bool CheckEmpty() - { - return true; - } - - public override string ToString() - { - return Description; - } - - private bool Equals(ComplexCondition other) - { - return Equals(_predicate, other._predicate) && Equals(_relation, other._relation); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - return obj.GetType() == GetType() - && Equals((ComplexCondition)obj); - } - - public override int GetHashCode() - { - unchecked - { - return ((_predicate != null ? _predicate.GetHashCode() : 0) * 397) - ^ (_relation != null ? _relation.GetHashCode() : 0); - } - } - } -} diff --git a/ArchUnitNET/Fluent/Conditions/ConditionExtensions.cs b/ArchUnitNET/Fluent/Conditions/ConditionExtensions.cs index 4c3f28274..29cdc0e83 100644 --- a/ArchUnitNET/Fluent/Conditions/ConditionExtensions.cs +++ b/ArchUnitNET/Fluent/Conditions/ConditionExtensions.cs @@ -19,7 +19,7 @@ public OrderedConditionWrapper(ICondition condition) public string Description => _condition.Description; - public IEnumerable Check( + public IEnumerable Check( IEnumerable objects, Architecture architecture ) @@ -31,7 +31,7 @@ Architecture architecture public bool CheckEmpty() => _condition.CheckEmpty(); - private static Func Check( + private static Func Check( Architecture architecture, ICollection objects, ICondition condition @@ -68,5 +68,81 @@ this ICondition condition } return new OrderedConditionWrapper(condition); } + + private class ConditionWithDescription : IOrderedCondition + where TRuleType : ICanBeAnalyzed + { + private readonly IOrderedCondition _condition; + + public ConditionWithDescription( + IOrderedCondition condition, + string description + ) + { + _condition = condition; + Description = description; + } + + public string Description { get; } + + public IEnumerable Check( + IEnumerable objects, + Architecture architecture + ) + { + return _condition.Check(objects, architecture); + } + + public bool CheckEmpty() + { + return _condition.CheckEmpty(); + } + } + + public static IOrderedCondition As( + this IOrderedCondition condition, + string description + ) + where TRuleType : ICanBeAnalyzed + { + return new ConditionWithDescription(condition, description); + } + + private class ConditionWithReason : IOrderedCondition + where TRuleType : ICanBeAnalyzed + { + private readonly IOrderedCondition _condition; + private readonly string _reason; + + public ConditionWithReason(IOrderedCondition condition, string reason) + { + _condition = condition; + _reason = reason; + } + + public string Description => $"{_condition.Description} because {_reason}"; + + public IEnumerable Check( + IEnumerable objects, + Architecture architecture + ) + { + return _condition.Check(objects, architecture); + } + + public bool CheckEmpty() + { + return _condition.CheckEmpty(); + } + } + + public static IOrderedCondition Because( + this IOrderedCondition condition, + string reason + ) + where TRuleType : ICanBeAnalyzed + { + return new ConditionWithReason(condition, reason); + } } } diff --git a/ArchUnitNET/Fluent/Conditions/ConditionResult.cs b/ArchUnitNET/Fluent/Conditions/ConditionResult.cs index 698562675..fe6faee24 100644 --- a/ArchUnitNET/Fluent/Conditions/ConditionResult.cs +++ b/ArchUnitNET/Fluent/Conditions/ConditionResult.cs @@ -3,23 +3,19 @@ namespace ArchUnitNET.Fluent.Conditions { - public class ConditionResult + public class ConditionResult : IConditionResult { - public readonly ICanBeAnalyzed AnalyzedObject; + public ICanBeAnalyzed AnalyzedObject { get; } - [CanBeNull] - public readonly string FailDescription; - public readonly bool Pass; + public bool Pass { get; } - public ConditionResult( - ICanBeAnalyzed analyzedObject, - bool pass, - string failDescription = null - ) + public string Description { get; } + + public ConditionResult(ICanBeAnalyzed analyzedObject, bool pass, string description = null) { Pass = pass; AnalyzedObject = analyzedObject; - FailDescription = pass ? null : failDescription; + Description = pass ? (description ?? "passed") : description; } } } diff --git a/ArchUnitNET/Fluent/Conditions/EnumerableCondition.cs b/ArchUnitNET/Fluent/Conditions/EnumerableCondition.cs index 0bb6e4dd5..214ee8dee 100644 --- a/ArchUnitNET/Fluent/Conditions/EnumerableCondition.cs +++ b/ArchUnitNET/Fluent/Conditions/EnumerableCondition.cs @@ -20,7 +20,7 @@ string description public string Description { get; } - public IEnumerable Check( + public IEnumerable Check( IEnumerable objects, Architecture architecture ) diff --git a/ArchUnitNET/Fluent/Conditions/ExistsCondition.cs b/ArchUnitNET/Fluent/Conditions/ExistsCondition.cs index 6622e90a8..589893135 100644 --- a/ArchUnitNET/Fluent/Conditions/ExistsCondition.cs +++ b/ArchUnitNET/Fluent/Conditions/ExistsCondition.cs @@ -16,12 +16,31 @@ public ExistsCondition(bool valueIfExists) public string Description => _valueIfExists ? "exist" : "not exist"; - public IEnumerable Check( + public IEnumerable Check( IEnumerable objects, Architecture architecture ) { - return objects.Select(obj => new ConditionResult(obj, _valueIfExists, "does exist")); + if (!(objects is ICollection objectCollection)) + { + objectCollection = objects.ToList(); + } + if (!objectCollection.Any()) + { + return new[] + { + new ConditionResult( + null, + !_valueIfExists, + "There are no objects matching the criteria" + ), + }; + } + return objectCollection.Select(obj => new ConditionResult( + obj, + _valueIfExists, + "does exist" + )); } public bool CheckEmpty() diff --git a/ArchUnitNET/Fluent/Conditions/ICondition.cs b/ArchUnitNET/Fluent/Conditions/ICondition.cs index 78cbdab4d..3ac121ad2 100644 --- a/ArchUnitNET/Fluent/Conditions/ICondition.cs +++ b/ArchUnitNET/Fluent/Conditions/ICondition.cs @@ -16,7 +16,7 @@ public interface ICondition : IHasDescription /// Objects to check the condition against. /// The architecture context for the check. /// A collection of ConditionResults indicating the outcome for each object. - IEnumerable Check( + IEnumerable Check( IEnumerable objects, Architecture architecture ); diff --git a/ArchUnitNET/Fluent/Conditions/IConditionResult.cs b/ArchUnitNET/Fluent/Conditions/IConditionResult.cs new file mode 100644 index 000000000..496240af2 --- /dev/null +++ b/ArchUnitNET/Fluent/Conditions/IConditionResult.cs @@ -0,0 +1,15 @@ +using ArchUnitNET.Domain; +using JetBrains.Annotations; + +namespace ArchUnitNET.Fluent.Conditions +{ + public interface IConditionResult + { + ICanBeAnalyzed AnalyzedObject { get; } + + bool Pass { get; } + + [CanBeNull] + string Description { get; } + } +} diff --git a/ArchUnitNET/Fluent/Conditions/RelationCondition.cs b/ArchUnitNET/Fluent/Conditions/RelationCondition.cs index 29ef4ef63..1005d1609 100644 --- a/ArchUnitNET/Fluent/Conditions/RelationCondition.cs +++ b/ArchUnitNET/Fluent/Conditions/RelationCondition.cs @@ -29,9 +29,11 @@ string failDescription public string Description { get; } - public IOrderedCondition GetCondition(IEnumerable objects) + public IOrderedCondition GetCondition( + IObjectProvider objectProvider + ) { - return _relation(new ObjectProvider(objects.ToList())); + return _relation(objectProvider); } private bool Equals(RelationCondition other) diff --git a/ArchUnitNET/Fluent/Conditions/SimpleCondition.cs b/ArchUnitNET/Fluent/Conditions/SimpleCondition.cs index fc7ca1502..74308b084 100644 --- a/ArchUnitNET/Fluent/Conditions/SimpleCondition.cs +++ b/ArchUnitNET/Fluent/Conditions/SimpleCondition.cs @@ -16,7 +16,11 @@ public SimpleCondition( string failDescription ) { - _condition = obj => new ConditionResult(obj, condition(obj), failDescription); + _condition = obj => + { + var passed = condition(obj); + return new ConditionResult(obj, condition(obj), passed ? null : failDescription); + }; Description = description; } @@ -32,17 +36,21 @@ public SimpleCondition( string description ) { - _condition = obj => new ConditionResult( - obj, - condition(obj), - dynamicFailDescription(obj) - ); + _condition = obj => + { + var passed = condition(obj); + return new ConditionResult( + obj, + passed, + passed ? null : dynamicFailDescription(obj) + ); + }; Description = description; } public string Description { get; } - public IEnumerable Check( + public IEnumerable Check( IEnumerable objects, Architecture architecture ) diff --git a/ArchUnitNET/Fluent/IArchRuleCreator.cs b/ArchUnitNET/Fluent/IArchRuleCreator.cs deleted file mode 100644 index e0109b139..000000000 --- a/ArchUnitNET/Fluent/IArchRuleCreator.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using ArchUnitNET.Domain; -using ArchUnitNET.Fluent.Conditions; -using ArchUnitNET.Fluent.Predicates; - -namespace ArchUnitNET.Fluent -{ - public interface IArchRuleCreator : ICanBeEvaluated - where TRuleType : ICanBeAnalyzed - { - void AddPredicate(IPredicate predicate); - void AddPredicateConjunction(LogicalConjunction logicalConjunction); - void AddCondition(IOrderedCondition condition); - void AddConditionConjunction(LogicalConjunction logicalConjunction); - void AddConditionReason(string reason); - void AddPredicateReason(string reason); - - void BeginComplexCondition( - IObjectProvider relatedObjects, - RelationCondition relationCondition - ) - where TRelatedType : ICanBeAnalyzed; - - void ContinueComplexCondition(IPredicate predicate) - where TRelatedType : ICanBeAnalyzed; - - IEnumerable GetAnalyzedObjects(Architecture architecture); - - void SetCustomPredicateDescription(string description); - void SetCustomConditionDescription(string description); - - bool RequirePositiveResults { get; set; } - } -} diff --git a/ArchUnitNET/Fluent/PartialArchRuleConjunction.cs b/ArchUnitNET/Fluent/PartialArchRuleConjunction.cs new file mode 100644 index 000000000..b55f0332e --- /dev/null +++ b/ArchUnitNET/Fluent/PartialArchRuleConjunction.cs @@ -0,0 +1,44 @@ +using JetBrains.Annotations; + +namespace ArchUnitNET.Fluent +{ + public abstract class PartialArchRuleConjunction + { + internal abstract ICanBeEvaluated LeftArchRule { get; } + + internal abstract LogicalConjunction LogicalConjunction { get; } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + return GetType() == obj.GetType() && Equals((PartialArchRuleConjunction)obj); + } + + private bool Equals(PartialArchRuleConjunction other) + { + return Equals(LeftArchRule, other.LeftArchRule) + && Equals(LogicalConjunction, other.LogicalConjunction); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = LeftArchRule != null ? LeftArchRule.GetHashCode() : 0; + hashCode = + (hashCode * 397) + ^ (LogicalConjunction != null ? LogicalConjunction.GetHashCode() : 0); + return hashCode; + } + } + } +} diff --git a/ArchUnitNET/Fluent/PlantUml/GivenPlantUmlFluentComponentDiagram.cs b/ArchUnitNET/Fluent/PlantUml/GivenPlantUmlFluentComponentDiagram.cs index 4cc6cc230..f66d305fa 100644 --- a/ArchUnitNET/Fluent/PlantUml/GivenPlantUmlFluentComponentDiagram.cs +++ b/ArchUnitNET/Fluent/PlantUml/GivenPlantUmlFluentComponentDiagram.cs @@ -4,23 +4,26 @@ namespace ArchUnitNET.Fluent.PlantUml { public class GivenPlantUmlFluentComponentDiagram { - private readonly PlantUmlFluentComponentDiagramCreator _fluentComponentDiagramCreator; + private readonly PlantUmlFileBuilder _builder; + private readonly string _description; internal GivenPlantUmlFluentComponentDiagram( - PlantUmlFluentComponentDiagramCreator fluentComponentDiagramCreator + PlantUmlFileBuilder builder, + string description ) { - _fluentComponentDiagramCreator = fluentComponentDiagramCreator; + _builder = builder; + _description = description; } public string AsString(RenderOptions renderOptions = null) { - return _fluentComponentDiagramCreator.Builder.AsString(renderOptions); + return _builder.AsString(renderOptions); } public void WriteToFile(string path, RenderOptions renderOptions = null) { - _fluentComponentDiagramCreator.Builder.WriteToFile(path, renderOptions); + _builder.WriteToFile(path, renderOptions); } } } diff --git a/ArchUnitNET/Fluent/PlantUml/PlantUmlDefinition.cs b/ArchUnitNET/Fluent/PlantUml/PlantUmlDefinition.cs index f54168a12..872713e6d 100644 --- a/ArchUnitNET/Fluent/PlantUml/PlantUmlDefinition.cs +++ b/ArchUnitNET/Fluent/PlantUml/PlantUmlDefinition.cs @@ -4,8 +4,7 @@ public static class PlantUmlDefinition { public static PlantUmlFluentComponentDiagramInitializer ComponentDiagram() { - var fluentCreator = new PlantUmlFluentComponentDiagramCreator(); - return new PlantUmlFluentComponentDiagramInitializer(fluentCreator); + return new PlantUmlFluentComponentDiagramInitializer(); } } } diff --git a/ArchUnitNET/Fluent/PlantUml/PlantUmlFluentComponentDiagramCreator.cs b/ArchUnitNET/Fluent/PlantUml/PlantUmlFluentComponentDiagramCreator.cs deleted file mode 100644 index 8efe32b93..000000000 --- a/ArchUnitNET/Fluent/PlantUml/PlantUmlFluentComponentDiagramCreator.cs +++ /dev/null @@ -1,23 +0,0 @@ -using ArchUnitNET.Domain; -using ArchUnitNET.Domain.PlantUml.Export; - -namespace ArchUnitNET.Fluent.PlantUml -{ - internal class PlantUmlFluentComponentDiagramCreator : IHasDescription - { - public readonly PlantUmlFileBuilder Builder; - - public PlantUmlFluentComponentDiagramCreator() - { - Description = "Class diagram"; - Builder = new PlantUmlFileBuilder(); - } - - public void AddToDescription(string description) - { - Description += " " + description.Trim(); - } - - public string Description { get; private set; } - } -} diff --git a/ArchUnitNET/Fluent/PlantUml/PlantUmlFluentComponentDiagramInitializer.cs b/ArchUnitNET/Fluent/PlantUml/PlantUmlFluentComponentDiagramInitializer.cs index 2bc3f92bc..1948b0c91 100644 --- a/ArchUnitNET/Fluent/PlantUml/PlantUmlFluentComponentDiagramInitializer.cs +++ b/ArchUnitNET/Fluent/PlantUml/PlantUmlFluentComponentDiagramInitializer.cs @@ -6,29 +6,24 @@ namespace ArchUnitNET.Fluent.PlantUml { public class PlantUmlFluentComponentDiagramInitializer { - private readonly PlantUmlFluentComponentDiagramCreator _fluentComponentDiagramCreator; - - internal PlantUmlFluentComponentDiagramInitializer( - PlantUmlFluentComponentDiagramCreator fluentComponentDiagramCreator - ) + internal PlantUmlFluentComponentDiagramInitializer() { - _fluentComponentDiagramCreator = fluentComponentDiagramCreator; } public GivenPlantUmlFluentComponentDiagram WithElements( IEnumerable elements ) { - _fluentComponentDiagramCreator.Builder.WithElements(elements); - _fluentComponentDiagramCreator.AddToDescription("with custom elements"); - return new GivenPlantUmlFluentComponentDiagram(_fluentComponentDiagramCreator); + var builder = new PlantUmlFileBuilder(); + builder.WithElements(elements); + return new GivenPlantUmlFluentComponentDiagram(builder, "with custom elements"); } public GivenPlantUmlFluentComponentDiagram WithElements(params IPlantUmlElement[] elements) { - _fluentComponentDiagramCreator.Builder.WithElements(elements); - _fluentComponentDiagramCreator.AddToDescription("with custom elements"); - return new GivenPlantUmlFluentComponentDiagram(_fluentComponentDiagramCreator); + var builder = new PlantUmlFileBuilder(); + builder.WithElements(elements); + return new GivenPlantUmlFluentComponentDiagram(builder, "with custom elements"); } public GivenPlantUmlFluentComponentDiagram WithDependenciesFromTypes( @@ -36,9 +31,9 @@ public GivenPlantUmlFluentComponentDiagram WithDependenciesFromTypes( GenerationOptions generationOptions = null ) { - _fluentComponentDiagramCreator.Builder.WithDependenciesFrom(types, generationOptions); - _fluentComponentDiagramCreator.AddToDescription("with dependencies from types"); - return new GivenPlantUmlFluentComponentDiagram(_fluentComponentDiagramCreator); + var builder = new PlantUmlFileBuilder(); + builder.WithDependenciesFrom(types, generationOptions); + return new GivenPlantUmlFluentComponentDiagram(builder, "with dependencies from types"); } public GivenPlantUmlFluentComponentDiagram WithDependenciesFromTypes( @@ -47,12 +42,12 @@ public GivenPlantUmlFluentComponentDiagram WithDependenciesFromTypes( GenerationOptions generationOptions = null ) { - _fluentComponentDiagramCreator.Builder.WithDependenciesFrom( + var builder = new PlantUmlFileBuilder(); + builder.WithDependenciesFrom( types.GetObjects(architecture), generationOptions ); - _fluentComponentDiagramCreator.AddToDescription("with dependencies from types"); - return new GivenPlantUmlFluentComponentDiagram(_fluentComponentDiagramCreator); + return new GivenPlantUmlFluentComponentDiagram(builder, "with dependencies from types"); } public GivenPlantUmlFluentComponentDiagram WithDependenciesFromSlices( @@ -60,9 +55,9 @@ public GivenPlantUmlFluentComponentDiagram WithDependenciesFromSlices( GenerationOptions generationOptions = null ) { - _fluentComponentDiagramCreator.Builder.WithDependenciesFrom(slices, generationOptions); - _fluentComponentDiagramCreator.AddToDescription("with dependencies from slices"); - return new GivenPlantUmlFluentComponentDiagram(_fluentComponentDiagramCreator); + var builder = new PlantUmlFileBuilder(); + builder.WithDependenciesFrom(slices, generationOptions); + return new GivenPlantUmlFluentComponentDiagram(builder, "with dependencies from slices"); } public GivenPlantUmlFluentComponentDiagram WithDependenciesFromSlices( @@ -70,12 +65,12 @@ public GivenPlantUmlFluentComponentDiagram WithDependenciesFromSlices( string focusOnPackage ) { - _fluentComponentDiagramCreator.Builder.WithDependenciesFromFocusOn( + var builder = new PlantUmlFileBuilder(); + builder.WithDependenciesFromFocusOn( slices, focusOnPackage ); - _fluentComponentDiagramCreator.AddToDescription("with dependencies from slices"); - return new GivenPlantUmlFluentComponentDiagram(_fluentComponentDiagramCreator); + return new GivenPlantUmlFluentComponentDiagram(builder, "with dependencies from slices"); } public GivenPlantUmlFluentComponentDiagram WithDependenciesFromSlices( @@ -83,11 +78,11 @@ public GivenPlantUmlFluentComponentDiagram WithDependenciesFromSlices( Architecture architecture ) { - _fluentComponentDiagramCreator.Builder.WithDependenciesFrom( + var builder = new PlantUmlFileBuilder(); + builder.WithDependenciesFrom( slices.GetObjects(architecture) ); - _fluentComponentDiagramCreator.AddToDescription("with dependencies from slices"); - return new GivenPlantUmlFluentComponentDiagram(_fluentComponentDiagramCreator); + return new GivenPlantUmlFluentComponentDiagram(builder, "with dependencies from slices"); } } } diff --git a/ArchUnitNET/Fluent/PredicateManager.PredicateManager.cs b/ArchUnitNET/Fluent/PredicateManager.PredicateManager.cs deleted file mode 100644 index 7322b2237..000000000 --- a/ArchUnitNET/Fluent/PredicateManager.PredicateManager.cs +++ /dev/null @@ -1,254 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ArchUnitNET.Domain; -using ArchUnitNET.Fluent.Extensions; -using ArchUnitNET.Fluent.Predicates; -using JetBrains.Annotations; - -namespace ArchUnitNET.Fluent -{ - internal class PredicateManager : IHasDescription - where T : ICanBeAnalyzed - { - private const string NotSet = "not set"; - private readonly BasicObjectProvider _basicObjectProvider; - private readonly List> _predicateElements; - private bool _hasCustomDescription; - - public PredicateManager(BasicObjectProvider basicObjectProvider) - { - _basicObjectProvider = basicObjectProvider; - _predicateElements = new List> - { - new PredicateElement( - LogicalConjunctionDefinition.ForwardSecondValue, - new SimplePredicate(t => true, NotSet) - ), - }; - _hasCustomDescription = false; - } - - public string Description => - _hasCustomDescription - ? _predicateElements.Aggregate( - "", - (current, objectFilterElement) => - current + " " + objectFilterElement.Description - ) - : _predicateElements.First().Description == NotSet ? _basicObjectProvider.Description - : _basicObjectProvider.Description - + " that" - + _predicateElements.Aggregate( - "", - (current, objectFilterElement) => - current + " " + objectFilterElement.Description - ); - - public IEnumerable GetObjects(Architecture architecture) - { - var objects = _basicObjectProvider.GetObjects(architecture).ToList(); - IEnumerable filteredObjects = new List(); - return _predicateElements.Aggregate( - filteredObjects, - (current, predicateElement) => - predicateElement.CheckPredicate(current, objects, architecture) - ); - } - - public void AddPredicate(IPredicate predicate) - { - _predicateElements.Last().SetPredicate(predicate); - } - - public void AddReason(string reason) - { - _predicateElements.Last().AddReason(reason); - } - - public void SetCustomDescription(string description) - { - _hasCustomDescription = true; - _predicateElements.ForEach(predicateElement => - predicateElement.SetCustomDescription("") - ); - _predicateElements.Last().SetCustomDescription(description); - } - - public void SetNextLogicalConjunction(LogicalConjunction logicalConjunction) - { - _predicateElements.Add(new PredicateElement(logicalConjunction)); - } - - public override string ToString() - { - return Description; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - return obj.GetType() == GetType() && Equals((PredicateManager)obj); - } - - private bool Equals(PredicateManager other) - { - return Equals(_basicObjectProvider, other._basicObjectProvider) - && _predicateElements.SequenceEqual(other._predicateElements) - && _hasCustomDescription == other._hasCustomDescription; - } - - public override int GetHashCode() - { - unchecked - { - var hashCode = - _basicObjectProvider != null ? _basicObjectProvider.GetHashCode() : 0; - return _predicateElements.Aggregate( - hashCode, - (current, predicateElement) => - (current * 397) - ^ (predicateElement != null ? predicateElement.GetHashCode() : 0) - ); - } - } - -#pragma warning disable 693 - private class PredicateElement : IHasDescription - where T : ICanBeAnalyzed - { - private readonly LogicalConjunction _logicalConjunction; - - [CanBeNull] - private string _customDescription; - - private IPredicate _predicate; - private string _reason; - - public PredicateElement( - LogicalConjunction logicalConjunction, - IPredicate predicate = null - ) - { - _predicate = predicate; - _logicalConjunction = logicalConjunction; - _reason = ""; - } - - public string Description => - _customDescription - ?? ( - _predicate == null - ? _logicalConjunction.Description - : ( - _logicalConjunction.Description - + " " - + _predicate.GetShortDescription() - + " " - + _reason - ).Trim() - ); - - public void AddReason(string reason) - { - if (_predicate == null) - { - throw new InvalidOperationException( - "Can't add a reason to a PredicateElement before the predicate is set." - ); - } - - if (_reason != "") - { - throw new InvalidOperationException( - "Can't add a reason to a PredicateElement which already has a reason." - ); - } - - _reason = "because " + reason; - } - - public void SetCustomDescription(string description) - { - _customDescription = description; - } - - public void SetPredicate(IPredicate predicate) - { - _predicate = predicate; - } - - public IEnumerable CheckPredicate( - IEnumerable currentObjects, - IEnumerable allObjects, - Architecture architecture - ) - { - if (_predicate == null) - { - throw new InvalidOperationException( - "Can't check a PredicateElement before the predicate is set." - ); - } - - return _logicalConjunction.Evaluate( - currentObjects, - _predicate.GetMatchingObjects(allObjects, architecture) - ); - } - - public override string ToString() - { - return Description; - } - - private bool Equals(PredicateElement other) - { - return Equals(_logicalConjunction, other._logicalConjunction) - && _customDescription == other._customDescription - && Equals(_predicate, other._predicate) - && _reason == other._reason; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - return obj.GetType() == GetType() && Equals((PredicateElement)obj); - } - - public override int GetHashCode() - { - unchecked - { - var hashCode = - _logicalConjunction != null ? _logicalConjunction.GetHashCode() : 0; - hashCode = - (hashCode * 397) - ^ (_customDescription != null ? _customDescription.GetHashCode() : 0); - hashCode = - (hashCode * 397) ^ (_predicate != null ? _predicate.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (_reason != null ? _reason.GetHashCode() : 0); - return hashCode; - } - } - } - } -} diff --git a/ArchUnitNET/Fluent/Predicates/CombinedPredicate.cs b/ArchUnitNET/Fluent/Predicates/CombinedPredicate.cs new file mode 100644 index 000000000..a2375ad72 --- /dev/null +++ b/ArchUnitNET/Fluent/Predicates/CombinedPredicate.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Linq; +using ArchUnitNET.Domain; + +namespace ArchUnitNET.Fluent.Predicates +{ + internal sealed class CombinedPredicate : IPredicate + where TRuleType : ICanBeAnalyzed + { + private readonly IPredicate _leftPredicate; + private readonly LogicalConjunction _logicalConjunction; + private readonly IPredicate _rightPredicate; + + public CombinedPredicate( + IPredicate leftPredicate, + LogicalConjunction logicalConjunction, + IPredicate rightPredicate + ) + { + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; + _rightPredicate = rightPredicate; + } + + public string Description => + $"{_leftPredicate.Description} {_logicalConjunction.Description} {_rightPredicate.Description}"; + + public IEnumerable GetMatchingObjects( + IEnumerable objects, + Architecture architecture + ) + { + if (!(objects is ICollection objectCollection)) + { + objectCollection = objects.ToList(); + } + return _logicalConjunction.Evaluate( + _leftPredicate.GetMatchingObjects(objectCollection, architecture), + _rightPredicate.GetMatchingObjects(objectCollection, architecture) + ); + } + } +} diff --git a/ArchUnitNET/Fluent/Predicates/PredicateExtensions.cs b/ArchUnitNET/Fluent/Predicates/PredicateExtensions.cs new file mode 100644 index 000000000..2a23efbf6 --- /dev/null +++ b/ArchUnitNET/Fluent/Predicates/PredicateExtensions.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; +using ArchUnitNET.Domain; + +namespace ArchUnitNET.Fluent.Predicates +{ + public static class PredicateExtensions + { + private sealed class PredicateWithDescription : IPredicate + where TRuleType : ICanBeAnalyzed + { + private readonly IPredicate _predicate; + + public PredicateWithDescription(IPredicate predicate, string description) + { + _predicate = predicate; + Description = description; + } + + public string Description { get; } + + public IEnumerable GetMatchingObjects( + IEnumerable objects, + Architecture architecture + ) + { + return _predicate.GetMatchingObjects(objects, architecture); + } + } + + public static IPredicate As( + this IPredicate predicate, + string description + ) + where TRuleType : ICanBeAnalyzed + { + return new PredicateWithDescription(predicate, description); + } + + private sealed class PredicateWithReason : IPredicate + where TRuleType : ICanBeAnalyzed + { + private readonly IPredicate _predicate; + private readonly string _reason; + + public PredicateWithReason(IPredicate predicate, string reason) + { + _predicate = predicate; + _reason = reason; + } + + public string Description => $"{_predicate.Description} because {_reason}"; + + public IEnumerable GetMatchingObjects( + IEnumerable objects, + Architecture architecture + ) + { + return _predicate.GetMatchingObjects(objects, architecture); + } + } + + public static IPredicate Because( + this IPredicate predicate, + string reason + ) + where TRuleType : ICanBeAnalyzed + { + return new PredicateWithReason(predicate, reason); + } + } +} diff --git a/ArchUnitNET/Fluent/Predicates/PredicateObjectProvider.cs b/ArchUnitNET/Fluent/Predicates/PredicateObjectProvider.cs new file mode 100644 index 000000000..e884789a8 --- /dev/null +++ b/ArchUnitNET/Fluent/Predicates/PredicateObjectProvider.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using ArchUnitNET.Domain; + +namespace ArchUnitNET.Fluent.Predicates +{ + public class PredicateObjectProvider : IObjectProvider + where T : ICanBeAnalyzed + { + internal PredicateObjectProvider(IObjectProvider objectProvider, IPredicate predicate) + { + ObjectProvider = objectProvider; + Predicate = predicate; + } + + protected IObjectProvider ObjectProvider { get; } + protected IPredicate Predicate { get; } + + public string Description => $"{ObjectProvider.Description} {Predicate.Description}"; + + public IEnumerable GetObjects(Architecture architecture) => + Predicate.GetMatchingObjects(ObjectProvider.GetObjects(architecture), architecture); + + public string FormatDescription( + string emptyDescription, + string singleDescription, + string multipleDescription + ) => $"{multipleDescription} {Description}"; + + public override string ToString() => Description; + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + return GetType() == obj.GetType() && Equals((PredicateObjectProvider)obj); + } + + private bool Equals(PredicateObjectProvider other) + { + return Equals(ObjectProvider, other.ObjectProvider) + && Equals(Predicate, other.Predicate); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = ObjectProvider != null ? ObjectProvider.GetHashCode() : 0; + hashCode = (hashCode * 397) ^ (Predicate != null ? Predicate.GetHashCode() : 0); + return hashCode; + } + } + } +} diff --git a/ArchUnitNET/Fluent/Slices/GivenSlices.cs b/ArchUnitNET/Fluent/Slices/GivenSlices.cs index 59e4b9524..8fcb2fa13 100644 --- a/ArchUnitNET/Fluent/Slices/GivenSlices.cs +++ b/ArchUnitNET/Fluent/Slices/GivenSlices.cs @@ -1,28 +1,28 @@ using System.Collections.Generic; +using System.Linq; using ArchUnitNET.Domain; namespace ArchUnitNET.Fluent.Slices { public class GivenSlices : IObjectProvider { - private readonly SliceRuleCreator _ruleCreator; + private readonly SliceAssignment _sliceAssignment; - public GivenSlices(SliceRuleCreator ruleCreator) + public GivenSlices(SliceAssignment sliceAssignment) { - _ruleCreator = ruleCreator; + _sliceAssignment = sliceAssignment; } - public string Description => _ruleCreator.Description; + public string Description => _sliceAssignment.Description; public SlicesShould Should() { - _ruleCreator.AddToDescription("should"); - return new SlicesShould(_ruleCreator); + return new SlicesShould(_sliceAssignment); } public IEnumerable GetObjects(Architecture architecture) { - return _ruleCreator.GetSlices(architecture); + return GetSlices(architecture); } public string FormatDescription( @@ -33,5 +33,12 @@ string multipleDescription { return $"{multipleDescription} {Description}"; } + + private IEnumerable GetSlices(Architecture architecture) + { + return _sliceAssignment + .Apply(architecture.Types) + .Where(slice => !slice.Identifier.Ignored); + } } } diff --git a/ArchUnitNET/Fluent/Slices/SliceRule.cs b/ArchUnitNET/Fluent/Slices/SliceRule.cs index 14d6d8727..0daab7689 100644 --- a/ArchUnitNET/Fluent/Slices/SliceRule.cs +++ b/ArchUnitNET/Fluent/Slices/SliceRule.cs @@ -1,47 +1,65 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Linq; using ArchUnitNET.Domain; namespace ArchUnitNET.Fluent.Slices { public class SliceRule : IArchRule { - private readonly SliceRuleCreator _ruleCreator; + private readonly SliceAssignment _sliceAssignment; + private readonly Func, ICanBeEvaluated, Architecture, IEnumerable> _evaluationFunc; + private readonly string _description; - public SliceRule(SliceRuleCreator ruleCreator) + public SliceRule( + SliceAssignment sliceAssignment, + Func, ICanBeEvaluated, Architecture, IEnumerable> evaluationFunc, + string description + ) { - _ruleCreator = ruleCreator; + _sliceAssignment = sliceAssignment; + _evaluationFunc = evaluationFunc; + _description = description; } - public string Description => _ruleCreator.Description; + public string Description => "Slices " + _sliceAssignment.Description + " should " + _description; public bool HasNoViolations(Architecture architecture) { - return _ruleCreator.HasNoViolations(architecture); + return Evaluate(architecture).All(result => result.Passed); } public IEnumerable Evaluate(Architecture architecture) { - return _ruleCreator.Evaluate(architecture); + var slices = GetSlices(architecture); + return _evaluationFunc(slices, this, architecture); } public CombinedArchRuleDefinition And() { - return new CombinedArchRuleDefinition(_ruleCreator, LogicalConjunctionDefinition.And); + return new CombinedArchRuleDefinition(this, LogicalConjunctionDefinition.And); } public CombinedArchRuleDefinition Or() { - return new CombinedArchRuleDefinition(_ruleCreator, LogicalConjunctionDefinition.Or); + return new CombinedArchRuleDefinition(this, LogicalConjunctionDefinition.Or); } public IArchRule And(IArchRule archRule) { - return new CombinedArchRule(_ruleCreator, LogicalConjunctionDefinition.And, archRule); + return new CombinedArchRule(this, LogicalConjunctionDefinition.And, archRule); } public IArchRule Or(IArchRule archRule) { - return new CombinedArchRule(_ruleCreator, LogicalConjunctionDefinition.Or, archRule); + return new CombinedArchRule(this, LogicalConjunctionDefinition.Or, archRule); + } + + private IEnumerable GetSlices(Architecture architecture) + { + return _sliceAssignment + .Apply(architecture.Types) + .Where(slice => !slice.Identifier.Ignored); } } } diff --git a/ArchUnitNET/Fluent/Slices/SliceRuleCreator.cs b/ArchUnitNET/Fluent/Slices/SliceRuleCreator.cs deleted file mode 100644 index 943a9e352..000000000 --- a/ArchUnitNET/Fluent/Slices/SliceRuleCreator.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ArchUnitNET.Domain; - -namespace ArchUnitNET.Fluent.Slices -{ - public class SliceRuleCreator : ICanBeEvaluated - { - private Func< - IEnumerable, - ICanBeEvaluated, - Architecture, - IEnumerable - > _evaluationFunc; - private SliceAssignment _sliceAssignment; - - public SliceRuleCreator() - { - Description = "Slices"; - } - - public string Description { get; private set; } - - public bool HasNoViolations(Architecture architecture) - { - return Evaluate(architecture).All(result => result.Passed); - } - - public IEnumerable Evaluate(Architecture architecture) - { - return _evaluationFunc(GetSlices(architecture), this, architecture); - } - - public void SetSliceAssignment(SliceAssignment sliceAssignment) - { - _sliceAssignment = sliceAssignment; - AddToDescription(sliceAssignment.Description); - } - - public void SetEvaluationFunction( - Func< - IEnumerable, - ICanBeEvaluated, - Architecture, - IEnumerable - > evaluationFunc - ) - { - _evaluationFunc = evaluationFunc; - } - - public void AddToDescription(string description) - { - Description += " " + description.Trim(); - } - - public IEnumerable GetSlices(Architecture architecture) - { - if (_sliceAssignment == null) - { - throw new InvalidOperationException( - "The Slice Assignment has to be set before GetSlices() can be called." - ); - } - - return _sliceAssignment - .Apply(architecture.Types) - .Where(slice => !slice.Identifier.Ignored); - } - } -} diff --git a/ArchUnitNET/Fluent/Slices/SliceRuleDefinition.cs b/ArchUnitNET/Fluent/Slices/SliceRuleDefinition.cs index fc3e03b96..e84e680ea 100644 --- a/ArchUnitNET/Fluent/Slices/SliceRuleDefinition.cs +++ b/ArchUnitNET/Fluent/Slices/SliceRuleDefinition.cs @@ -4,8 +4,7 @@ public static class SliceRuleDefinition { public static SliceRuleInitializer Slices() { - var ruleCreator = new SliceRuleCreator(); - return new SliceRuleInitializer(ruleCreator); + return new SliceRuleInitializer(); } } } diff --git a/ArchUnitNET/Fluent/Slices/SliceRuleInitializer.cs b/ArchUnitNET/Fluent/Slices/SliceRuleInitializer.cs index da0de0afd..a68dab508 100644 --- a/ArchUnitNET/Fluent/Slices/SliceRuleInitializer.cs +++ b/ArchUnitNET/Fluent/Slices/SliceRuleInitializer.cs @@ -5,11 +5,8 @@ namespace ArchUnitNET.Fluent.Slices { public class SliceRuleInitializer { - private readonly SliceRuleCreator _ruleCreator; - - public SliceRuleInitializer(SliceRuleCreator ruleCreator) + public SliceRuleInitializer() { - _ruleCreator = ruleCreator; } /// @@ -21,32 +18,28 @@ public SliceRuleInitializer(SliceRuleCreator ruleCreator) /// public GivenSlices Matching(string pattern) { - _ruleCreator.SetSliceAssignment( - new SliceAssignment( - t => - { - var parseResult = Parse(pattern); - return AssignFunc(t, parseResult.pattern, parseResult.asterisk); - }, - "matching \"" + pattern + "\"" - ) + var sliceAssignment = new SliceAssignment( + t => + { + var parseResult = Parse(pattern); + return AssignFunc(t, parseResult.pattern, parseResult.asterisk); + }, + "matching \"" + pattern + "\"" ); - return new GivenSlices(_ruleCreator); + return new GivenSlices(sliceAssignment); } public GivenSlices MatchingWithPackages(string pattern) { - _ruleCreator.SetSliceAssignment( - new SliceAssignment( - t => - { - var parseResult = Parse(pattern); - return AssignFunc(t, parseResult.pattern, parseResult.asterisk, true); - }, - "matching \"" + pattern + "\"" - ) + var sliceAssignment = new SliceAssignment( + t => + { + var parseResult = Parse(pattern); + return AssignFunc(t, parseResult.pattern, parseResult.asterisk, true); + }, + "matching \"" + pattern + "\"" ); - return new GivenSlices(_ruleCreator); + return new GivenSlices(sliceAssignment); } private static (string pattern, int? asterisk) Parse(string pattern) diff --git a/ArchUnitNET/Fluent/Slices/SlicesShould.cs b/ArchUnitNET/Fluent/Slices/SlicesShould.cs index 5e1fc1cfa..c27ea6049 100644 --- a/ArchUnitNET/Fluent/Slices/SlicesShould.cs +++ b/ArchUnitNET/Fluent/Slices/SlicesShould.cs @@ -9,11 +9,11 @@ namespace ArchUnitNET.Fluent.Slices { public class SlicesShould { - private readonly SliceRuleCreator _ruleCreator; + private readonly SliceAssignment _sliceAssignment; - public SlicesShould(SliceRuleCreator ruleCreator) + public SlicesShould(SliceAssignment sliceAssignment) { - _ruleCreator = ruleCreator; + _sliceAssignment = sliceAssignment; } private static IEnumerable FindDependencies( @@ -31,9 +31,7 @@ IEnumerable otherSlices public SliceRule BeFreeOfCycles() { - _ruleCreator.SetEvaluationFunction(EvaluateBeFreeOfCycles); - _ruleCreator.AddToDescription("be free of cycles"); - return new SliceRule(_ruleCreator); + return new SliceRule(_sliceAssignment, EvaluateBeFreeOfCycles, "be free of cycles"); } private static IEnumerable EvaluateBeFreeOfCycles( @@ -121,9 +119,7 @@ Architecture architecture public SliceRule NotDependOnEachOther() { - _ruleCreator.SetEvaluationFunction(EvaluateNotDependOnEachOther); - _ruleCreator.AddToDescription("not depend on each other"); - return new SliceRule(_ruleCreator); + return new SliceRule(_sliceAssignment, EvaluateNotDependOnEachOther, "not depend on each other"); } private static IEnumerable EvaluateNotDependOnEachOther( diff --git a/ArchUnitNET/Fluent/Syntax/ConjunctionFactory.cs b/ArchUnitNET/Fluent/Syntax/ConjunctionFactory.cs deleted file mode 100644 index 54817ea82..000000000 --- a/ArchUnitNET/Fluent/Syntax/ConjunctionFactory.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using ArchUnitNET.Domain; - -namespace ArchUnitNET.Fluent.Syntax -{ - public static class ConjunctionFactory - { - public static TConjunction Create( - IArchRuleCreator ruleCreator - ) - where TRuleType : ICanBeAnalyzed - { - return (TConjunction)Activator.CreateInstance(typeof(TConjunction), ruleCreator); - } - } -} diff --git a/ArchUnitNET/Fluent/Syntax/Elements/AddObjectCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/AddObjectCondition.cs index eb16eb0ba..193e56eab 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/AddObjectCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/AddObjectCondition.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using ArchUnitNET.Domain; using ArchUnitNET.Domain.Extensions; @@ -7,25 +7,28 @@ using ArchUnitNET.Fluent.Syntax.Elements.Types; using ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes; using ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces; +using JetBrains.Annotations; using Attribute = ArchUnitNET.Domain.Attribute; namespace ArchUnitNET.Fluent.Syntax.Elements { public abstract class AddObjectCondition - : SyntaxElement, + : PartialConditionConjunction, IAddObjectCondition where TRuleType : ICanBeAnalyzed { - internal AddObjectCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected AddObjectCondition( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } - public TNextElement Exist() - { - _ruleCreator.RequirePositiveResults = false; - return CreateNextElement(ObjectConditionsDefinition.Exist()); - } + public override string Description { get; } = ""; // csharpier-ignore-start + + public TNextElement Exist() => CreateNextElement(ObjectConditionsDefinition.Exist()); + public TNextElement Be(params ICanBeAnalyzed[] objects) => Be(new ObjectProvider(objects)); public TNextElement Be(IEnumerable objects) => Be(new ObjectProvider(objects)); public TNextElement Be(IObjectProvider objects) => CreateNextElement(ObjectConditionsDefinition.Be(objects)); @@ -114,11 +117,7 @@ public TNextElement Exist() // Negations - public TNextElement NotExist() - { - _ruleCreator.RequirePositiveResults = false; - return CreateNextElement(ObjectConditionsDefinition.NotExist()); - } + public TNextElement NotExist() => CreateNextElement(ObjectConditionsDefinition.NotExist()); public TNextElement NotBe(params ICanBeAnalyzed[] objects) => NotBe(new ObjectProvider(objects)); public TNextElement NotBe(IEnumerable objects) => NotBe(new ObjectProvider(objects)); @@ -179,59 +178,59 @@ public TNextElement NotExist() public TNextElement NotBeInternal() => CreateNextElement(ObjectConditionsDefinition.NotBeInternal()); public TNextElement NotBeProtectedInternal() => CreateNextElement(ObjectConditionsDefinition.NotBeProtectedInternal()); public TNextElement NotBePrivateProtected() => CreateNextElement(ObjectConditionsDefinition.NotBePrivateProtected()); - // Relation Condition Negations public ShouldRelateToTypesThat NotDependOnAnyTypesThat() => BeginComplexTypeCondition(ObjectConditionsDefinition.NotDependOnAnyTypesThat()); public ShouldRelateToAttributesThat NotHaveAnyAttributesThat() => BeginComplexAttributeCondition(ObjectConditionsDefinition.NotHaveAnyAttributesThat()); // csharpier-ignore-end - protected abstract TNextElement CreateNextElement(IOrderedCondition condition); - protected ShouldRelateToTypesThat BeginComplexTypeCondition( RelationCondition relationCondition - ) - { - _ruleCreator.BeginComplexCondition(ArchRuleDefinition.Types(true), relationCondition); - return new ShouldRelateToTypesThat(_ruleCreator); - } + ) => + new ShouldRelateToTypesThat( + PartialArchRuleConjunction, + ArchRuleDefinition.Types(true).WithDescription("types that"), + this, + relationCondition + ); - protected ShouldRelateToAttributesThat< + protected ShouldRelateToInterfacesThat< TNextElement, TRuleType - > BeginComplexAttributeCondition(RelationCondition relationCondition) - { - _ruleCreator.BeginComplexCondition( - ArchRuleDefinition.Attributes(true), + > BeginComplexInterfaceCondition( + RelationCondition relationCondition + ) => + new ShouldRelateToInterfacesThat( + PartialArchRuleConjunction, + ArchRuleDefinition.Interfaces(true).WithDescription("interfaces that"), + this, relationCondition ); - return new ShouldRelateToAttributesThat(_ruleCreator); - } - protected ShouldRelateToInterfacesThat< + protected ShouldRelateToAttributesThat< TNextElement, TRuleType - > BeginComplexInterfaceCondition(RelationCondition relationCondition) - { - _ruleCreator.BeginComplexCondition( - ArchRuleDefinition.Interfaces(true), + > BeginComplexAttributeCondition( + RelationCondition relationCondition + ) => + new ShouldRelateToAttributesThat( + PartialArchRuleConjunction, + ArchRuleDefinition.Attributes(true).WithDescription("attributes that"), + this, relationCondition ); - return new ShouldRelateToInterfacesThat(_ruleCreator); - } protected ShouldRelateToMethodMembersThat< TNextElement, TRuleType > BeginComplexMethodMemberCondition( RelationCondition relationCondition - ) - { - _ruleCreator.BeginComplexCondition( - ArchRuleDefinition.MethodMembers(), + ) => + new ShouldRelateToMethodMembersThat( + PartialArchRuleConjunction, + ArchRuleDefinition.MethodMembers().WithDescription("method members that"), + this, relationCondition ); - return new ShouldRelateToMethodMembersThat(_ruleCreator); - } } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/AddObjectPredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/AddObjectPredicate.cs index 0598e4e9c..3893e248c 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/AddObjectPredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/AddObjectPredicate.cs @@ -4,18 +4,23 @@ using ArchUnitNET.Domain; using ArchUnitNET.Domain.Extensions; using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; using Attribute = ArchUnitNET.Domain.Attribute; namespace ArchUnitNET.Fluent.Syntax.Elements { - public abstract class AddObjectPredicate - : SyntaxElement, + public abstract class AddObjectPredicate + : SyntaxElement, IAddObjectPredicate where TRuleType : ICanBeAnalyzed - where TRelatedType : ICanBeAnalyzed { - internal AddObjectPredicate(IArchRuleCreator archRuleCreator) - : base(archRuleCreator) { } + protected AddObjectPredicate( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override string Description { get; } = ""; // csharpier-ignore-start public TNextElement FollowCustomPredicate(IPredicate predicate) => CreateNextElement(predicate); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjects.cs b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjects.cs index 21a835389..401100e0e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjects.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjects.cs @@ -1,52 +1,41 @@ using System.Collections.Generic; using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Exceptions; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements { - public abstract class GivenObjects + public abstract class GivenObjects : SyntaxElement, IObjectProvider where TRuleType : ICanBeAnalyzed { - protected GivenObjects(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected GivenObjects( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public abstract TGivenRuleTypeThat That(); + public abstract TRuleTypeShould Should(); + + public override string Description => ObjectProvider.Description; public IEnumerable GetObjects(Architecture architecture) { - try - { - return architecture.GetOrCreateObjects(this, _ruleCreator.GetAnalyzedObjects); - } - catch (CannotGetObjectsOfCombinedArchRuleCreatorException exception) + if (PartialArchRuleConjunction != null) { throw new CannotGetObjectsOfCombinedArchRuleException( - "GetObjects() can't be used with CombinedArchRule \"" - + ToString() - + "\" because the analyzed objects might be of different type. Try to use simple ArchRules instead.", - exception + "GetObjects cannot be called on a combined arch rule, because the analyzed objects may be of different types." ); } + return ObjectProvider.GetObjects(architecture); } public string FormatDescription( string emptyDescription, string singleDescription, string multipleDescription - ) - { - return $"{multipleDescription} {Description}"; - } - - public TRuleTypeThat That() - { - return Create(_ruleCreator); - } - - public TRuleTypeShould Should() - { - return Create(_ruleCreator); - } + ) => $"{multipleDescription} {Description}"; } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunction.cs index e670d1431..2e2f45190 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunction.cs @@ -1,9 +1,11 @@ using ArchUnitNET.Domain; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements { public abstract class GivenObjectsConjunction< + TGivenRuleType, TGivenRuleTypeThat, TRuleTypeShould, TGivenRuleTypeConjunctionWithReason, @@ -11,19 +13,14 @@ public abstract class GivenObjectsConjunction< > : GivenObjectsConjunctionWithDescription where TRuleType : ICanBeAnalyzed { - protected GivenObjectsConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected GivenObjectsConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } - public TGivenRuleTypeConjunctionWithReason Because(string reason) - { - _ruleCreator.AddPredicateReason(reason); - return Create(_ruleCreator); - } - - public TGivenRuleTypeConjunctionWithReason As(string description) - { - _ruleCreator.SetCustomPredicateDescription(description); - return Create(_ruleCreator); - } + public abstract TGivenRuleType As(string description); + public abstract TGivenRuleTypeConjunctionWithReason Because(string reason); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunctionWithDescription.cs index 3873a9417..0169b395a 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsConjunctionWithDescription.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Exceptions; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements { @@ -12,50 +13,43 @@ public abstract class GivenObjectsConjunctionWithDescription< > : SyntaxElement, IObjectProvider where TRuleType : ICanBeAnalyzed { - protected GivenObjectsConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected GivenObjectsConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider) + { + Predicate = predicate; + } + + protected IPredicate Predicate { get; } + + public abstract TGivenRuleTypeThat And(); + public abstract TGivenRuleTypeThat Or(); + public abstract TRuleTypeShould Should(); + + public override string Description => + $"{ObjectProvider.Description} {Predicate.Description}"; public IEnumerable GetObjects(Architecture architecture) { - try - { - return architecture.GetOrCreateObjects(this, _ruleCreator.GetAnalyzedObjects); - } - catch (CannotGetObjectsOfCombinedArchRuleCreatorException exception) + if (PartialArchRuleConjunction != null) { throw new CannotGetObjectsOfCombinedArchRuleException( - "GetObjects() can't be used with CombinedArchRule \"" - + ToString() - + "\" because the analyzed objects might be of different type. Try to use simple ArchRules instead.", - exception + "GetObjects cannot be called on a combined arch rule, because the analyzed objects may be of different types." ); } + return Predicate.GetMatchingObjects( + ObjectProvider.GetObjects(architecture), + architecture + ); } public string FormatDescription( string emptyDescription, string singleDescription, string multipleDescription - ) - { - return $"{multipleDescription} {Description}"; - } - - public TGivenRuleTypeThat And() - { - _ruleCreator.AddPredicateConjunction(LogicalConjunctionDefinition.And); - return Create(_ruleCreator); - } - - public TGivenRuleTypeThat Or() - { - _ruleCreator.AddPredicateConjunction(LogicalConjunctionDefinition.Or); - return Create(_ruleCreator); - } - - public TRuleTypeShould Should() - { - return Create(_ruleCreator); - } + ) => $"{multipleDescription} {Description}"; } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberCondition.cs index 65e9e3586..ce4a05628 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberCondition.cs @@ -10,8 +10,11 @@ public abstract class AddMemberCondition IAddMemberCondition where TRuleType : IMember { - internal AddMemberCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddMemberCondition( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start public TNextElement BeDeclaredIn(IType firstType, params IType[] moreTypes) => CreateNextElement(MemberConditionsDefinition.BeDeclaredIn(firstType, moreTypes)); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberPredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberPredicate.cs index 0e7fe2951..f68a2a4b0 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberPredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/AddMemberPredicate.cs @@ -4,14 +4,16 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Members { - public abstract class AddMemberPredicate - : AddObjectPredicate, + public abstract class AddMemberPredicate + : AddObjectPredicate, IAddMemberPredicate where TRuleType : IMember - where TRelatedType : ICanBeAnalyzed { - internal AddMemberPredicate(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddMemberPredicate( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start public TNextElement AreDeclaredIn(IType firstType, params IType[] moreTypes) => CreateNextElement(MemberPredicatesDefinition.AreDeclaredIn(firstType, moreTypes)); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberCondition.cs index 6a38442a5..b100f0153 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberCondition.cs @@ -6,7 +6,10 @@ public abstract class AddFieldMemberCondition : AddMemberCondition, IAddFieldMemberCondition { - internal AddFieldMemberCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddFieldMemberCondition( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberPredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberPredicate.cs index 6d4e6b7b7..0b729a5df 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberPredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/AddFieldMemberPredicate.cs @@ -2,12 +2,14 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { - public abstract class AddFieldMemberPredicate - : AddMemberPredicate, + public abstract class AddFieldMemberPredicate + : AddMemberPredicate, IAddFieldMemberPredicate - where TRelatedType : ICanBeAnalyzed { - internal AddFieldMemberPredicate(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddFieldMemberPredicate( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShould.cs index d3c7d059f..9753c2f93 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShould.cs @@ -1,19 +1,45 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { - public sealed class FieldMembersShould : AddFieldMemberCondition + public sealed class FieldMembersShould : AddFieldMemberCondition { - public FieldMembersShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override FieldMembersShould CreateNextElement( - IOrderedCondition condition + public FieldMembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public FieldMembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddCondition(condition); - return new FieldMembersShould(_ruleCreator); + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; } + + internal override FieldMembersShouldConjunction CreateNextElement( + IOrderedCondition condition + ) => + new FieldMembersShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition( + _leftCondition, + _logicalConjunction, + condition + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunction.cs index 19573f80c..ea681112c 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunction.cs @@ -1,4 +1,6 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { @@ -9,7 +11,41 @@ public class FieldMembersShouldConjunction FieldMember > { - public FieldMembersShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public FieldMembersShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override FieldMembersShouldConjunctionWithDescription As(string description) => + new FieldMembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override FieldMembersShouldConjunctionWithDescription Because(string reason) => + new FieldMembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override FieldMembersShould AndShould() => + new FieldMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override FieldMembersShould OrShould() => + new FieldMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunctionWithDescription.cs index 392ee298d..b2fbaa6a2 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/FieldMembersShouldConjunctionWithDescription.cs @@ -1,13 +1,33 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { public class FieldMembersShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public FieldMembersShouldConjunctionWithDescription( - IArchRuleCreator ruleCreator + internal FieldMembersShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition ) - : base(ruleCreator) { } + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override FieldMembersShould AndShould() => + new FieldMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override FieldMembersShould OrShould() => + new FieldMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembers.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembers.cs index 40422fcdc..10b167685 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembers.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembers.cs @@ -1,11 +1,28 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { public class GivenFieldMembers : GivenObjects { - public GivenFieldMembers(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenFieldMembers( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenFieldMembersThat That() => + new GivenFieldMembersThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override FieldMembersShould Should() => + new FieldMembersShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunction.cs index 7389edaed..dbea36dc1 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunction.cs @@ -1,16 +1,64 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { public class GivenFieldMembersConjunction : GivenObjectsConjunction< + GivenFieldMembers, GivenFieldMembersThat, FieldMembersShould, GivenFieldMembersConjunctionWithDescription, FieldMember > { - public GivenFieldMembersConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenFieldMembersConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenFieldMembers As(string description) => + new GivenFieldMembers( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescription( + description + ) + ); + + public override GivenFieldMembersConjunctionWithDescription Because(string reason) => + new GivenFieldMembersConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenFieldMembersThat And() => + new GivenFieldMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenFieldMembersThat Or() => + new GivenFieldMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override FieldMembersShould Should() => + new FieldMembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunctionWithDescription.cs index 014a6f995..5549019bb 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersConjunctionWithDescription.cs @@ -1,4 +1,7 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { @@ -9,9 +12,36 @@ public class GivenFieldMembersConjunctionWithDescription FieldMember > { - public GivenFieldMembersConjunctionWithDescription( - IArchRuleCreator ruleCreator + internal GivenFieldMembersConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate ) - : base(ruleCreator) { } + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenFieldMembersThat And() => + new GivenFieldMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenFieldMembersThat Or() => + new GivenFieldMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override FieldMembersShould Should() => + new FieldMembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersThat.cs index 37734b517..8665c1393 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/GivenFieldMembersThat.cs @@ -1,20 +1,49 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { public sealed class GivenFieldMembersThat - : AddFieldMemberPredicate + : AddFieldMemberPredicate { - public GivenFieldMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenFieldMembersConjunction CreateNextElement( - IPredicate predicate + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenFieldMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenFieldMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenFieldMembersConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenFieldMembersConjunction CreateNextElement( + IPredicate predicate + ) => + new GivenFieldMembersConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate( + _leftPredicate, + _logicalConjunction, + predicate + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/ShouldRelateToFieldMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/ShouldRelateToFieldMembersThat.cs index 5524aa789..d90a9a970 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/ShouldRelateToFieldMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/FieldMembers/ShouldRelateToFieldMembersThat.cs @@ -1,22 +1,42 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.FieldMembers { public sealed class ShouldRelateToFieldMembersThat - : AddFieldMemberPredicate + : AddFieldMemberPredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToFieldMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TRuleTypeShouldConjunction, + TRuleType + > _partialConditionConjunction; - protected override TRuleTypeShouldConjunction CreateNextElement( - IPredicate predicate + private readonly RelationCondition _relationCondition; + + public ShouldRelateToFieldMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction< + TRuleTypeShouldConjunction, + TRuleType + > partialConditionConjunction, + RelationCondition relationCondition ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TRuleTypeShouldConjunction CreateNextElement( + IPredicate predicate + ) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembers.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembers.cs index 1772a553d..ec845693a 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembers.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembers.cs @@ -1,10 +1,27 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { public class GivenMembers : GivenObjects { - public GivenMembers(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenMembers( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenMembersThat That() => + new GivenMembersThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override MembersShould Should() => + new MembersShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunction.cs index 51235670c..0c5ff1ece 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunction.cs @@ -1,16 +1,64 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { public class GivenMembersConjunction : GivenObjectsConjunction< + GivenMembers, GivenMembersThat, MembersShould, GivenMembersConjunctionWithDescription, IMember > { - public GivenMembersConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenMembersConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenMembers As(string description) => + new GivenMembers( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescription( + description + ) + ); + + public override GivenMembersConjunctionWithDescription Because(string reason) => + new GivenMembersConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenMembersThat And() => + new GivenMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenMembersThat Or() => + new GivenMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override MembersShould Should() => + new MembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunctionWithDescription.cs index 2a3f6ba40..3439bb51c 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersConjunctionWithDescription.cs @@ -1,11 +1,43 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { public class GivenMembersConjunctionWithDescription : GivenObjectsConjunctionWithDescription { - public GivenMembersConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenMembersConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenMembersThat And() => + new GivenMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenMembersThat Or() => + new GivenMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override MembersShould Should() => + new MembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs index fc63ebaf5..b69c6c7ad 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs @@ -1,22 +1,44 @@ -using System; -using System.Collections.Generic; -using ArchUnitNET.Domain; +using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; -using ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { - public sealed class GivenMembersThat - : AddMemberPredicate + public sealed class GivenMembersThat : AddMemberPredicate { - public GivenMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenMembersConjunction CreateNextElement(IPredicate predicate) + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction + ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenMembersConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenMembersConjunction CreateNextElement( + IPredicate predicate + ) => + new GivenMembersConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate(_leftPredicate, _logicalConjunction, predicate) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs index 350e2ac8e..085ae38b0 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs @@ -1,23 +1,41 @@ -using System; -using System.Collections.Generic; -using ArchUnitNET.Domain; +using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; -using ArchUnitNET.Fluent.Syntax.Elements.Types; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { public sealed class MembersShould : AddMemberCondition { - public MembersShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override MembersShouldConjunction CreateNextElement( - IOrderedCondition condition + public MembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public MembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddCondition(condition); - return new MembersShouldConjunction(_ruleCreator); + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; } + + internal override MembersShouldConjunction CreateNextElement( + IOrderedCondition condition + ) => + new MembersShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition(_leftCondition, _logicalConjunction, condition) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunction.cs index 74d0bbf82..4cfc5e6b9 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunction.cs @@ -1,11 +1,47 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { public class MembersShouldConjunction : ObjectsShouldConjunction { - public MembersShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public MembersShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override MembersShouldConjunctionWithDescription As(string description) => + new MembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override MembersShouldConjunctionWithDescription Because(string reason) => + new MembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override MembersShould AndShould() => + new MembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override MembersShould OrShould() => + new MembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunctionWithDescription.cs index 2ea0b51b4..7583d033f 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShouldConjunctionWithDescription.cs @@ -1,11 +1,33 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { public class MembersShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public MembersShouldConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal MembersShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override MembersShould AndShould() => + new MembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override MembersShould OrShould() => + new MembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberCondition.cs index c2a001207..8fb205dfc 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberCondition.cs @@ -9,8 +9,11 @@ public abstract class AddMethodMemberCondition : AddMemberCondition, IAddMethodMemberCondition { - internal AddMethodMemberCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddMethodMemberCondition( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start public TNextElement BeConstructor() => CreateNextElement(MethodMemberConditionsDefinition.BeConstructor()); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberPredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberPredicate.cs index c36993def..397a84427 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberPredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/AddMethodMemberPredicate.cs @@ -4,13 +4,15 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { - public abstract class AddMethodMemberPredicate - : AddMemberPredicate, + public abstract class AddMethodMemberPredicate + : AddMemberPredicate, IAddMethodMemberPredicate - where TRelatedType : ICanBeAnalyzed { - internal AddMethodMemberPredicate(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddMethodMemberPredicate( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start public TNextElement AreConstructors() => CreateNextElement(MethodMemberPredicatesDefinition.AreConstructors()); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembers.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembers.cs index 36ce0d2c3..51bd0b5d6 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembers.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembers.cs @@ -1,11 +1,28 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { public class GivenMethodMembers : GivenObjects { - public GivenMethodMembers(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenMethodMembers( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenMethodMembersThat That() => + new GivenMethodMembersThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override MethodMembersShould Should() => + new MethodMembersShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunction.cs index 3367f272c..d5e8fc8c4 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunction.cs @@ -1,16 +1,65 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { public class GivenMethodMembersConjunction : GivenObjectsConjunction< + GivenMethodMembers, GivenMethodMembersThat, MethodMembersShould, GivenMethodMembersConjunctionWithDescription, MethodMember > { - public GivenMethodMembersConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenMethodMembersConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenMethodMembers As(string description) => + new GivenMethodMembers( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescription(description) + ); + + public override GivenMethodMembersConjunctionWithDescription Because(string reason) => + new GivenMethodMembersConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenMethodMembersThat And() => + new GivenMethodMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenMethodMembersThat Or() => + new GivenMethodMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override MethodMembersShould Should() => + new MethodMembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunctionWithDescription.cs index 474cd9a59..977d24f78 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersConjunctionWithDescription.cs @@ -1,4 +1,7 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { @@ -9,9 +12,36 @@ public class GivenMethodMembersConjunctionWithDescription MethodMember > { - public GivenMethodMembersConjunctionWithDescription( - IArchRuleCreator ruleCreator + internal GivenMethodMembersConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate ) - : base(ruleCreator) { } + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenMethodMembersThat And() => + new GivenMethodMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenMethodMembersThat Or() => + new GivenMethodMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override MethodMembersShould Should() => + new MethodMembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs index 9197674b4..734707a0d 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs @@ -1,20 +1,49 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { public sealed class GivenMethodMembersThat - : AddMethodMemberPredicate + : AddMethodMemberPredicate { - public GivenMethodMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenMethodMembersConjunction CreateNextElement( - IPredicate predicate + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenMethodMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenMethodMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenMethodMembersConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenMethodMembersConjunction CreateNextElement( + IPredicate predicate + ) => + new GivenMethodMembersConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate( + _leftPredicate, + _logicalConjunction, + predicate + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs index b009b8d3d..39abcde55 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs @@ -1,21 +1,45 @@ -using System; -using System.Collections.Generic; -using ArchUnitNET.Domain; +using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { public class MethodMembersShould : AddMethodMemberCondition { - public MethodMembersShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override MethodMembersShouldConjunction CreateNextElement( - IOrderedCondition condition + public MethodMembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public MethodMembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddCondition(condition); - return new MethodMembersShouldConjunction(_ruleCreator); + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; } + + internal override MethodMembersShouldConjunction CreateNextElement( + IOrderedCondition condition + ) => + new MethodMembersShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition( + _leftCondition, + _logicalConjunction, + condition + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunction.cs index aba2d32cb..ac0e7ab81 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunction.cs @@ -1,4 +1,6 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { @@ -9,7 +11,41 @@ public class MethodMembersShouldConjunction MethodMember > { - public MethodMembersShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public MethodMembersShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override MethodMembersShouldConjunctionWithDescription As(string description) => + new MethodMembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override MethodMembersShouldConjunctionWithDescription Because(string reason) => + new MethodMembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override MethodMembersShould AndShould() => + new MethodMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override MethodMembersShould OrShould() => + new MethodMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunctionWithDescription.cs index d69f94c49..05437922e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShouldConjunctionWithDescription.cs @@ -1,13 +1,33 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { public class MethodMembersShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public MethodMembersShouldConjunctionWithDescription( - IArchRuleCreator ruleCreator + internal MethodMembersShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition ) - : base(ruleCreator) { } + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override MethodMembersShould AndShould() => + new MethodMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override MethodMembersShould OrShould() => + new MethodMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs index f21675db6..b8b9979c6 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs @@ -1,20 +1,37 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.MethodMembers { public sealed class ShouldRelateToMethodMembersThat - : AddMethodMemberPredicate + : AddMethodMemberPredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToMethodMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TNextElement, + TRuleType + > _partialConditionConjunction; - protected override TNextElement CreateNextElement(IPredicate predicate) + private readonly RelationCondition _relationCondition; + + public ShouldRelateToMethodMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction partialConditionConjunction, + RelationCondition relationCondition + ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TNextElement CreateNextElement(IPredicate predicate) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberCondition.cs index 5afe47ec7..13942d81d 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberCondition.cs @@ -6,8 +6,11 @@ public abstract class AddPropertyMemberCondition : AddMemberCondition, IAddPropertyMemberCondition { - internal AddPropertyMemberCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddPropertyMemberCondition( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start public TNextElement HaveGetter() => CreateNextElement(PropertyMemberConditionsDefinition.HaveGetter()); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberPredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberPredicate.cs index 66a061664..68948112b 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberPredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/AddPropertyMemberPredicate.cs @@ -2,13 +2,15 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { - public abstract class AddPropertyMemberPredicate - : AddMemberPredicate, + public abstract class AddPropertyMemberPredicate + : AddMemberPredicate, IAddPropertyMemberPredicate - where TRelatedType : ICanBeAnalyzed { - internal AddPropertyMemberPredicate(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddPropertyMemberPredicate( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start public TNextElement HaveGetter() => CreateNextElement(PropertyMemberPredicateDefinition.HaveGetter()); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembers.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembers.cs index 476f8c4e0..9519da119 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembers.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembers.cs @@ -1,11 +1,28 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { public class GivenPropertyMembers : GivenObjects { - public GivenPropertyMembers(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenPropertyMembers( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenPropertyMembersThat That() => + new GivenPropertyMembersThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override PropertyMembersShould Should() => + new PropertyMembersShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunction.cs index 481a62b4b..43c9bfb99 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunction.cs @@ -1,16 +1,65 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { public class GivenPropertyMembersConjunction : GivenObjectsConjunction< + GivenPropertyMembers, GivenPropertyMembersThat, PropertyMembersShould, GivenPropertyMembersConjunctionWithDescription, PropertyMember > { - public GivenPropertyMembersConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenPropertyMembersConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenPropertyMembers As(string description) => + new GivenPropertyMembers( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescription(description) + ); + + public override GivenPropertyMembersConjunctionWithDescription Because(string reason) => + new GivenPropertyMembersConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenPropertyMembersThat And() => + new GivenPropertyMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenPropertyMembersThat Or() => + new GivenPropertyMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override PropertyMembersShould Should() => + new PropertyMembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunctionWithDescription.cs index d5d0985e9..d71f0688f 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersConjunctionWithDescription.cs @@ -1,4 +1,7 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { @@ -9,9 +12,36 @@ public class GivenPropertyMembersConjunctionWithDescription PropertyMember > { - public GivenPropertyMembersConjunctionWithDescription( - IArchRuleCreator ruleCreator + internal GivenPropertyMembersConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate ) - : base(ruleCreator) { } + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenPropertyMembersThat And() => + new GivenPropertyMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenPropertyMembersThat Or() => + new GivenPropertyMembersThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override PropertyMembersShould Should() => + new PropertyMembersShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersThat.cs index c4664ea27..ae2eaef8e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/GivenPropertyMembersThat.cs @@ -1,20 +1,49 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { public sealed class GivenPropertyMembersThat - : AddPropertyMemberPredicate + : AddPropertyMemberPredicate { - public GivenPropertyMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenPropertyMembersConjunction CreateNextElement( - IPredicate predicate + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenPropertyMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenPropertyMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenPropertyMembersConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenPropertyMembersConjunction CreateNextElement( + IPredicate predicate + ) => + new GivenPropertyMembersConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate( + _leftPredicate, + _logicalConjunction, + predicate + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShould.cs index 86500037e..c76cd7797 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShould.cs @@ -1,20 +1,46 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { public class PropertyMembersShould : AddPropertyMemberCondition { - public PropertyMembersShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override PropertyMembersShouldConjunction CreateNextElement( - IOrderedCondition condition + public PropertyMembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public PropertyMembersShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddCondition(condition); - return new PropertyMembersShouldConjunction(_ruleCreator); + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; } + + internal override PropertyMembersShouldConjunction CreateNextElement( + IOrderedCondition condition + ) => + new PropertyMembersShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition( + _leftCondition, + _logicalConjunction, + condition + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunction.cs index 260d06f28..ea21985d9 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunction.cs @@ -1,4 +1,6 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { @@ -9,7 +11,41 @@ public class PropertyMembersShouldConjunction PropertyMember > { - public PropertyMembersShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public PropertyMembersShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override PropertyMembersShouldConjunctionWithDescription As(string description) => + new PropertyMembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override PropertyMembersShouldConjunctionWithDescription Because(string reason) => + new PropertyMembersShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override PropertyMembersShould AndShould() => + new PropertyMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override PropertyMembersShould OrShould() => + new PropertyMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunctionWithDescription.cs index 49ccbb689..29c02f04d 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/PropertyMembersShouldConjunctionWithDescription.cs @@ -1,13 +1,33 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { public class PropertyMembersShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public PropertyMembersShouldConjunctionWithDescription( - IArchRuleCreator ruleCreator + internal PropertyMembersShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition ) - : base(ruleCreator) { } + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override PropertyMembersShould AndShould() => + new PropertyMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override PropertyMembersShould OrShould() => + new PropertyMembersShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/ShouldRelateToPropertyMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/ShouldRelateToPropertyMembersThat.cs index 9cf7f0a26..3590801fe 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/ShouldRelateToPropertyMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/PropertyMembers/ShouldRelateToPropertyMembersThat.cs @@ -1,20 +1,37 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; namespace ArchUnitNET.Fluent.Syntax.Elements.Members.PropertyMembers { public sealed class ShouldRelateToPropertyMembersThat - : AddPropertyMemberPredicate + : AddPropertyMemberPredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToPropertyMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TNextElement, + TRuleType + > _partialConditionConjunction; - protected override TNextElement CreateNextElement(IPredicate predicate) + private readonly RelationCondition _relationCondition; + + public ShouldRelateToPropertyMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction partialConditionConjunction, + RelationCondition relationCondition + ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TNextElement CreateNextElement(IPredicate predicate) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs index 142d8210f..94ab5557d 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs @@ -1,24 +1,44 @@ using System; using System.Collections.Generic; using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; namespace ArchUnitNET.Fluent.Syntax.Elements.Members { public class ShouldRelateToMembersThat - : AddMemberPredicate + : AddMemberPredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToMembersThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TRuleTypeShouldConjunction, + TRuleType + > _partialConditionConjunction; - protected override TRuleTypeShouldConjunction CreateNextElement( - IPredicate predicate + private readonly RelationCondition _relationCondition; + + public ShouldRelateToMembersThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction< + TRuleTypeShouldConjunction, + TRuleType + > partialConditionConjunction, + RelationCondition relationCondition ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TRuleTypeShouldConjunction CreateNextElement( + IPredicate predicate + ) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunction.cs index 3bc68068a..2372d972e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunction.cs @@ -1,5 +1,5 @@ using ArchUnitNET.Domain; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; +using ArchUnitNET.Fluent.Conditions; namespace ArchUnitNET.Fluent.Syntax.Elements { @@ -10,19 +10,14 @@ public abstract class ObjectsShouldConjunction< > : ObjectsShouldConjunctionWithDescription where TRuleType : ICanBeAnalyzed { - protected ObjectsShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected ObjectsShouldConjunction( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } - public TRuleTypeShouldConjunctionWithReason Because(string reason) - { - _ruleCreator.AddConditionReason(reason); - return Create(_ruleCreator); - } - - public TRuleTypeShouldConjunctionWithReason As(string description) - { - _ruleCreator.SetCustomConditionDescription(description); - return Create(_ruleCreator); - } + public abstract TRuleTypeShouldConjunctionWithReason Because(string reason); + public abstract TRuleTypeShouldConjunctionWithReason As(string description); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunctionWithDescription.cs index 81cf2a4b3..eea3352c3 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShouldConjunctionWithDescription.cs @@ -1,5 +1,5 @@ using ArchUnitNET.Domain; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; +using ArchUnitNET.Fluent.Conditions; namespace ArchUnitNET.Fluent.Syntax.Elements { @@ -7,19 +7,14 @@ public abstract class ObjectsShouldConjunctionWithDescription where TRuleType : ICanBeAnalyzed { - protected ObjectsShouldConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected ObjectsShouldConjunctionWithDescription( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } - public TRuleTypeShould AndShould() - { - _ruleCreator.AddConditionConjunction(LogicalConjunctionDefinition.And); - return Create(_ruleCreator); - } - - public TRuleTypeShould OrShould() - { - _ruleCreator.AddConditionConjunction(LogicalConjunctionDefinition.Or); - return Create(_ruleCreator); - } + public abstract TRuleTypeShould AndShould(); + public abstract TRuleTypeShould OrShould(); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/PartialConditionConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/PartialConditionConjunction.cs new file mode 100644 index 000000000..aa7d6285f --- /dev/null +++ b/ArchUnitNET/Fluent/Syntax/Elements/PartialConditionConjunction.cs @@ -0,0 +1,19 @@ +using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; + +namespace ArchUnitNET.Fluent.Syntax.Elements +{ + public abstract class PartialConditionConjunction + : SyntaxElement + where TRuleType : ICanBeAnalyzed + { + protected PartialConditionConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + internal abstract TNextElement CreateNextElement(IOrderedCondition condition); + } +} diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypeCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypeCondition.cs index e6ce18a70..38475d384 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypeCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypeCondition.cs @@ -1,9 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { @@ -12,10 +13,14 @@ public abstract class AddTypeCondition IAddTypeCondition where TRuleType : IType { - internal AddTypeCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + protected AddTypeCondition( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start + public TNextElement Be(Type firstType, params Type[] moreTypes) => CreateNextElement(TypeConditionsDefinition.Be(firstType, moreTypes)); public TNextElement Be(IEnumerable types) => CreateNextElement(TypeConditionsDefinition.Be(types)); @@ -113,6 +118,7 @@ internal AddTypeCondition(IArchRuleCreator ruleCreator) public ShouldRelateToTypesThat NotBeAssignableToTypesThat() => BeginComplexTypeCondition(TypeConditionsDefinition.NotBeAssignableToTypesThat()); public ShouldRelateToInterfacesThat NotImplementAnyInterfacesThat() => BeginComplexInterfaceCondition(TypeConditionsDefinition.NotImplementAnyInterfacesThat()); + // csharpier-ignore-end } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypePredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypePredicate.cs index f6b98fb23..c8d8d4b21 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypePredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/AddTypePredicate.cs @@ -1,17 +1,21 @@ using System; using System.Collections.Generic; using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public abstract class AddTypePredicate - : AddObjectPredicate, + public abstract class AddTypePredicate + : AddObjectPredicate, IAddTypePredicate where TRuleType : IType - where TRelatedType : ICanBeAnalyzed { - internal AddTypePredicate(IArchRuleCreator archRuleCreator) - : base(archRuleCreator) { } + protected AddTypePredicate( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start public TNextElement Are(Type firstType, params Type[] moreTypes) => CreateNextElement(TypePredicatesDefinition.Are(firstType, moreTypes)); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributeCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributeCondition.cs index faacb61c2..fdd69aa04 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributeCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributeCondition.cs @@ -6,8 +6,11 @@ public abstract class AddAttributeCondition : AddTypeCondition, IAddAttributeCondition { - internal AddAttributeCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddAttributeCondition( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } public TNextElement BeAbstract() => CreateNextElement(AttributeConditionsDefinition.BeAbstract()); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributePredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributePredicate.cs index 979f3cf73..2b4911f1f 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributePredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AddAttributePredicate.cs @@ -2,13 +2,15 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { - public abstract class AddAttributePredicate - : AddTypePredicate, + public abstract class AddAttributePredicate + : AddTypePredicate, IAddAttributePredicate - where TRelatedType : ICanBeAnalyzed { - internal AddAttributePredicate(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddAttributePredicate( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShould.cs index 380721fcd..5f57fc51c 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShould.cs @@ -1,19 +1,45 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { public class AttributesShould : AddAttributeCondition { - public AttributesShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override AttributesShouldConjunction CreateNextElement( - IOrderedCondition condition + public AttributesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public AttributesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddCondition(condition); - return new AttributesShouldConjunction(_ruleCreator); + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; } + + internal override AttributesShouldConjunction CreateNextElement( + IOrderedCondition condition + ) => + new AttributesShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition( + _leftCondition, + _logicalConjunction, + condition + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunction.cs index b9d7ce0e5..d6d2996f6 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunction.cs @@ -1,4 +1,6 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { @@ -9,7 +11,41 @@ public class AttributesShouldConjunction Attribute > { - public AttributesShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public AttributesShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override AttributesShouldConjunctionWithDescription As(string description) => + new AttributesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override AttributesShouldConjunctionWithDescription Because(string reason) => + new AttributesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override AttributesShould AndShould() => + new AttributesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override AttributesShould OrShould() => + new AttributesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunctionWithDescription.cs index f7b30f9d5..a48d572d5 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/AttributesShouldConjunctionWithDescription.cs @@ -1,11 +1,33 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { public class AttributesShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public AttributesShouldConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AttributesShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override AttributesShould AndShould() => + new AttributesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override AttributesShould OrShould() => + new AttributesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributes.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributes.cs index 3b3d34b49..1d4c72d02 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributes.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributes.cs @@ -1,10 +1,27 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { public class GivenAttributes : GivenObjects { - public GivenAttributes(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenAttributes( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenAttributesThat That() => + new GivenAttributesThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override AttributesShould Should() => + new AttributesShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunction.cs index 1820d714e..b3ffee66f 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunction.cs @@ -1,16 +1,64 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { public class GivenAttributesConjunction : GivenObjectsConjunction< + GivenAttributes, GivenAttributesThat, AttributesShould, GivenAttributesConjunctionWithDescription, Attribute > { - public GivenAttributesConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenAttributesConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenAttributes As(string description) => + new GivenAttributes( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescription( + description + ) + ); + + public override GivenAttributesConjunctionWithDescription Because(string reason) => + new GivenAttributesConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenAttributesThat And() => + new GivenAttributesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenAttributesThat Or() => + new GivenAttributesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override AttributesShould Should() => + new AttributesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunctionWithDescription.cs index 59c008647..4658c97ed 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesConjunctionWithDescription.cs @@ -1,11 +1,43 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { public class GivenAttributesConjunctionWithDescription : GivenObjectsConjunctionWithDescription { - public GivenAttributesConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenAttributesConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenAttributesThat And() => + new GivenAttributesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenAttributesThat Or() => + new GivenAttributesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override AttributesShould Should() => + new AttributesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesThat.cs index e19227d8c..5cdc15149 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/GivenAttributesThat.cs @@ -1,20 +1,48 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { - public sealed class GivenAttributesThat - : AddAttributePredicate + public sealed class GivenAttributesThat : AddAttributePredicate { - public GivenAttributesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenAttributesConjunction CreateNextElement( - IPredicate predicate + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenAttributesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenAttributesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenAttributesConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenAttributesConjunction CreateNextElement( + IPredicate predicate + ) => + new GivenAttributesConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate( + _leftPredicate, + _logicalConjunction, + predicate + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/ShouldRelateToAttributesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/ShouldRelateToAttributesThat.cs index 5b3644714..77940e81e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/ShouldRelateToAttributesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Attributes/ShouldRelateToAttributesThat.cs @@ -1,20 +1,37 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Attributes { public sealed class ShouldRelateToAttributesThat - : AddAttributePredicate + : AddAttributePredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToAttributesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TNextElement, + TRuleType + > _partialConditionConjunction; - protected override TNextElement CreateNextElement(IPredicate predicate) + private readonly RelationCondition _relationCondition; + + public ShouldRelateToAttributesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction partialConditionConjunction, + RelationCondition relationCondition + ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TNextElement CreateNextElement(IPredicate predicate) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassCondition.cs index 53455f949..c3e9d67a5 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassCondition.cs @@ -6,8 +6,11 @@ public abstract class AddClassCondition : AddTypeCondition, IAddClassCondition { - public AddClassCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddClassCondition( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } public TNextElement BeAbstract() => CreateNextElement(ClassConditionsDefinition.BeAbstract()); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassPredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassPredicate.cs index 92d817b96..aea397ef9 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassPredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/AddClassPredicate.cs @@ -2,13 +2,15 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { - public abstract class AddClassPredicate - : AddTypePredicate, + public abstract class AddClassPredicate + : AddTypePredicate, IAddClassPredicate - where TRelatedType : ICanBeAnalyzed { - internal AddClassPredicate(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddClassPredicate( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } // csharpier-ignore-start diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShould.cs index 0f3d3c0ac..a58693af1 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShould.cs @@ -1,19 +1,41 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { public class ClassesShould : AddClassCondition { - public ClassesShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override ClassesShouldConjunction CreateNextElement( - IOrderedCondition condition + public ClassesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public ClassesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddCondition(condition); - return new ClassesShouldConjunction(_ruleCreator); + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; } + + internal override ClassesShouldConjunction CreateNextElement( + IOrderedCondition condition + ) => + new ClassesShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition(_leftCondition, _logicalConjunction, condition) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunction.cs index 7947fd354..4ea7c9eb9 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunction.cs @@ -1,11 +1,47 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { public class ClassesShouldConjunction : ObjectsShouldConjunction { - public ClassesShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public ClassesShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override ClassesShouldConjunctionWithDescription As(string description) => + new ClassesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override ClassesShouldConjunctionWithDescription Because(string reason) => + new ClassesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override ClassesShould AndShould() => + new ClassesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override ClassesShould OrShould() => + new ClassesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunctionWithDescription.cs index 48e6cab08..3992381c6 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ClassesShouldConjunctionWithDescription.cs @@ -1,11 +1,33 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { public class ClassesShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public ClassesShouldConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal ClassesShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override ClassesShould AndShould() => + new ClassesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override ClassesShould OrShould() => + new ClassesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClasses.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClasses.cs index ca0134412..51bf45429 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClasses.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClasses.cs @@ -1,10 +1,27 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { public class GivenClasses : GivenObjects { - public GivenClasses(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenClasses( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenClassesThat That() => + new GivenClassesThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override ClassesShould Should() => + new ClassesShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunction.cs index 54910a297..36b423193 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunction.cs @@ -1,16 +1,63 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { public class GivenClassesConjunction : GivenObjectsConjunction< + GivenClasses, GivenClassesThat, ClassesShould, GivenClassesConjunctionWithDescription, Class > { - public GivenClassesConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenClassesConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenClasses As(string description) => + new GivenClasses( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescription( + description + ) + ); + + public override GivenClassesConjunctionWithDescription Because(string reason) => + new GivenClassesConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenClassesThat And() => + new GivenClassesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenClassesThat Or() => + new GivenClassesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override ClassesShould Should() => + new ClassesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescriptionSuffix( + "should" + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunctionWithDescription.cs index d756bd5d8..099bc12ef 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesConjunctionWithDescription.cs @@ -1,11 +1,42 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { public class GivenClassesConjunctionWithDescription : GivenObjectsConjunctionWithDescription { - public GivenClassesConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenClassesConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenClassesThat And() => + new GivenClassesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenClassesThat Or() => + new GivenClassesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override ClassesShould Should() => + new ClassesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescriptionSuffix( + "should" + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesThat.cs index 8a8dd2b11..0a2f1bc0d 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/GivenClassesThat.cs @@ -1,17 +1,42 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { - public sealed class GivenClassesThat : AddClassPredicate + public sealed class GivenClassesThat : AddClassPredicate { - public GivenClassesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenClassesConjunction CreateNextElement(IPredicate predicate) + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenClassesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenClassesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction + ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenClassesConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenClassesConjunction CreateNextElement(IPredicate predicate) => + new GivenClassesConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate(_leftPredicate, _logicalConjunction, predicate) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ShouldRelateToClassesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ShouldRelateToClassesThat.cs index e11e9aa85..869992582 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ShouldRelateToClassesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Classes/ShouldRelateToClassesThat.cs @@ -1,20 +1,37 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Classes { public sealed class ShouldRelateToClassesThat - : AddClassPredicate + : AddClassPredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToClassesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TNextElement, + TRuleType + > _partialConditionConjunction; - protected override TNextElement CreateNextElement(IPredicate predicate) + private readonly RelationCondition _relationCondition; + + public ShouldRelateToClassesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction partialConditionConjunction, + RelationCondition relationCondition + ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TNextElement CreateNextElement(IPredicate predicate) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypes.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypes.cs index 274de1293..d43775d01 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypes.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypes.cs @@ -1,10 +1,29 @@ -using ArchUnitNET.Domain; +using System.Collections.Generic; +using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Exceptions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public class GivenTypes : GivenObjects + public sealed class GivenTypes : GivenObjects { - public GivenTypes(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenTypes( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenTypesThat That() => + new GivenTypesThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override TypesShould Should() => + new TypesShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunction.cs index 6da9dbe92..3a07bfdfc 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunction.cs @@ -1,16 +1,63 @@ -using ArchUnitNET.Domain; +using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public class GivenTypesConjunction + public sealed class GivenTypesConjunction : GivenObjectsConjunction< + GivenTypes, GivenTypesThat, TypesShould, GivenTypesConjunctionWithDescription, IType > { - public GivenTypesConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenTypesConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenTypes As(string description) => + new GivenTypes( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescription( + description + ) + ); + + public override GivenTypesConjunctionWithDescription Because(string reason) => + new GivenTypesConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenTypesThat And() => + new GivenTypesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenTypesThat Or() => + new GivenTypesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override TypesShould Should() => + new TypesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescriptionSuffix( + "should" + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunctionWithDescription.cs index 1c5b4c7eb..cd1d10290 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesConjunctionWithDescription.cs @@ -1,11 +1,42 @@ -using ArchUnitNET.Domain; +using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public class GivenTypesConjunctionWithDescription + public sealed class GivenTypesConjunctionWithDescription : GivenObjectsConjunctionWithDescription { - public GivenTypesConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenTypesConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenTypesThat And() => + new GivenTypesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenTypesThat Or() => + new GivenTypesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override TypesShould Should() => + new TypesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescriptionSuffix( + "should" + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs index e586d57b1..24b0293c8 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs @@ -1,22 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ArchUnitNET.Domain; +using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; -using Assembly = System.Reflection.Assembly; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public sealed class GivenTypesThat : AddTypePredicate + public sealed class GivenTypesThat : AddTypePredicate { - public GivenTypesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenTypesConjunction CreateNextElement(IPredicate predicate) + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenTypesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenTypesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction + ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenTypesConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenTypesConjunction CreateNextElement(IPredicate predicate) => + new GivenTypesConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate(_leftPredicate, _logicalConjunction, predicate) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfaceCondition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfaceCondition.cs index b54f7ac4f..d8549984a 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfaceCondition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfaceCondition.cs @@ -6,7 +6,10 @@ public abstract class AddInterfaceCondition : AddTypeCondition, IAddInterfaceCondition { - internal AddInterfaceCondition(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddInterfaceCondition( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfacePredicate.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfacePredicate.cs index 57d691219..1ec952d28 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfacePredicate.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/AddInterfacePredicate.cs @@ -2,12 +2,14 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { - public abstract class AddInterfacePredicate - : AddTypePredicate, + public abstract class AddInterfacePredicate + : AddTypePredicate, IAddInterfacePredicate - where TRelatedType : ICanBeAnalyzed { - internal AddInterfacePredicate(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal AddInterfacePredicate( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfaces.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfaces.cs index 1a90067cf..ddd255846 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfaces.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfaces.cs @@ -1,10 +1,27 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { public class GivenInterfaces : GivenObjects { - public GivenInterfaces(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenInterfaces( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : base(partialArchRuleConjunction, objectProvider) { } + + public override GivenInterfacesThat That() => + new GivenInterfacesThat( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("that") + ); + + public override InterfacesShould Should() => + new InterfacesShould( + PartialArchRuleConjunction, + ObjectProvider.WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunction.cs index ee448e366..157fc1d38 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunction.cs @@ -1,16 +1,64 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { public class GivenInterfacesConjunction : GivenObjectsConjunction< + GivenInterfaces, GivenInterfacesThat, InterfacesShould, - GivenInterfacesConjunction, + GivenInterfacesConjunctionWithDescription, Interface > { - public GivenInterfacesConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenInterfacesConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenInterfaces As(string description) => + new GivenInterfaces( + PartialArchRuleConjunction, + new PredicateObjectProvider(ObjectProvider, Predicate).WithDescription( + description + ) + ); + + public override GivenInterfacesConjunctionWithDescription Because(string reason) => + new GivenInterfacesConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Predicate.Because(reason) + ); + + public override GivenInterfacesThat And() => + new GivenInterfacesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenInterfacesThat Or() => + new GivenInterfacesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override InterfacesShould Should() => + new InterfacesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunctionWithDescription.cs index 04d5a39f7..1bfbe7aa1 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesConjunctionWithDescription.cs @@ -1,11 +1,43 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Domain.Extensions; +using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { public class GivenInterfacesConjunctionWithDescription : GivenObjectsConjunctionWithDescription { - public GivenInterfacesConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal GivenInterfacesConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate predicate + ) + : base(partialArchRuleConjunction, objectProvider, predicate) { } + + public override GivenInterfacesThat And() => + new GivenInterfacesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.And + ); + + public override GivenInterfacesThat Or() => + new GivenInterfacesThat( + PartialArchRuleConjunction, + ObjectProvider, + Predicate, + LogicalConjunctionDefinition.Or + ); + + public override InterfacesShould Should() => + new InterfacesShould( + PartialArchRuleConjunction, + new PredicateObjectProvider( + ObjectProvider, + Predicate + ).WithDescriptionSuffix("should") + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesThat.cs index 4401db0e0..166249f35 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/GivenInterfacesThat.cs @@ -1,20 +1,48 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Predicates; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { - public sealed class GivenInterfacesThat - : AddInterfacePredicate + public sealed class GivenInterfacesThat : AddInterfacePredicate { - public GivenInterfacesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + [CanBeNull] + private readonly IPredicate _leftPredicate; - protected override GivenInterfacesConjunction CreateNextElement( - IPredicate predicate + [CanBeNull] + private readonly LogicalConjunction _logicalConjunction; + + internal GivenInterfacesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + internal GivenInterfacesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IPredicate leftPredicate, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddPredicate(predicate); - return new GivenInterfacesConjunction(_ruleCreator); + _leftPredicate = leftPredicate; + _logicalConjunction = logicalConjunction; } + + protected override GivenInterfacesConjunction CreateNextElement( + IPredicate predicate + ) => + new GivenInterfacesConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftPredicate == null + ? predicate + : new CombinedPredicate( + _leftPredicate, + _logicalConjunction, + predicate + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShould.cs index b89b6f005..129b56947 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShould.cs @@ -1,19 +1,45 @@ using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { public class InterfacesShould : AddInterfaceCondition { - public InterfacesShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override InterfacesShouldConjunction CreateNextElement( - IOrderedCondition condition + public InterfacesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public InterfacesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction ) + : base(partialArchRuleConjunction, objectProvider) { - _ruleCreator.AddCondition(condition); - return new InterfacesShouldConjunction(_ruleCreator); + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; } + + internal override InterfacesShouldConjunction CreateNextElement( + IOrderedCondition condition + ) => + new InterfacesShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition( + _leftCondition, + _logicalConjunction, + condition + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunction.cs index 5db4f2000..17fce0b2e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunction.cs @@ -1,4 +1,6 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { @@ -9,7 +11,41 @@ public class InterfacesShouldConjunction Interface > { - public InterfacesShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public InterfacesShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override InterfacesShouldConjunctionWithDescription As(string description) => + new InterfacesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override InterfacesShouldConjunctionWithDescription Because(string reason) => + new InterfacesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override InterfacesShould AndShould() => + new InterfacesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override InterfacesShould OrShould() => + new InterfacesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunctionWithDescription.cs index b8870e827..c3c99bc54 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/InterfacesShouldConjunctionWithDescription.cs @@ -1,11 +1,33 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { public class InterfacesShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public InterfacesShouldConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + internal InterfacesShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override InterfacesShould AndShould() => + new InterfacesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override InterfacesShould OrShould() => + new InterfacesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/ShouldRelateToInterfacesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/ShouldRelateToInterfacesThat.cs index 8e75601c7..c30d517f1 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/ShouldRelateToInterfacesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/Interfaces/ShouldRelateToInterfacesThat.cs @@ -1,20 +1,37 @@ using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; namespace ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces { public sealed class ShouldRelateToInterfacesThat - : AddInterfacePredicate + : AddInterfacePredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToInterfacesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TNextElement, + TRuleType + > _partialConditionConjunction; - protected override TNextElement CreateNextElement(IPredicate predicate) + private readonly RelationCondition _relationCondition; + + public ShouldRelateToInterfacesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction partialConditionConjunction, + RelationCondition relationCondition + ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TNextElement CreateNextElement(IPredicate predicate) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs index fd9daa5d2..4c69f7084 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs @@ -1,23 +1,40 @@ -using System; +using System; using System.Collections.Generic; using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; using ArchUnitNET.Fluent.Predicates; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; -using Assembly = System.Reflection.Assembly; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public sealed class ShouldRelateToTypesThat - : AddTypePredicate + public sealed class ShouldRelateToTypesThat + : AddTypePredicate where TRuleType : ICanBeAnalyzed { - public ShouldRelateToTypesThat(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly PartialConditionConjunction< + TNextElement, + TRuleType + > _partialConditionConjunction; - protected override TRuleTypeShouldConjunction CreateNextElement(IPredicate predicate) + private readonly RelationCondition _relationCondition; + + public ShouldRelateToTypesThat( + PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider relatedObjectProvider, + PartialConditionConjunction partialConditionConjunction, + RelationCondition relationCondition + ) + : base(partialArchRuleConjunction, relatedObjectProvider) { - _ruleCreator.ContinueComplexCondition(predicate); - return Create(_ruleCreator); + _partialConditionConjunction = partialConditionConjunction; + _relationCondition = relationCondition; } + + protected override TNextElement CreateNextElement(IPredicate predicate) => + _partialConditionConjunction.CreateNextElement( + _relationCondition.GetCondition( + new PredicateObjectProvider(ObjectProvider, predicate) + ) + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs index ef63639b5..dae90dba5 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs @@ -1,25 +1,44 @@ -using System; -using System.Collections.Generic; -using System.IO; +using System; using ArchUnitNET.Domain; using ArchUnitNET.Fluent.Conditions; -using ArchUnitNET.Fluent.Syntax.Elements.Types.Interfaces; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; -using Assembly = System.Reflection.Assembly; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { public sealed class TypesShould : AddTypeCondition { - public TypesShould(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + private readonly IOrderedCondition _leftCondition; + private readonly LogicalConjunction _logicalConjunction; - protected override TypesShouldConjunction CreateNextElement( + public TypesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) + : this(partialArchRuleConjunction, objectProvider, null, null) { } + + public TypesShould( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition leftCondition, + LogicalConjunction logicalConjunction + ) + : base(partialArchRuleConjunction, objectProvider) + { + _leftCondition = leftCondition; + _logicalConjunction = logicalConjunction; + } + + internal override TypesShouldConjunction CreateNextElement( IOrderedCondition condition ) { - _ruleCreator.AddCondition(condition); - return new TypesShouldConjunction(_ruleCreator); + return new TypesShouldConjunction( + PartialArchRuleConjunction, + ObjectProvider, + _leftCondition == null + ? condition + : new CombinedCondition(_leftCondition, _logicalConjunction, condition) + ); } } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunction.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunction.cs index 1ae51c7c1..56a47b6a7 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunction.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunction.cs @@ -1,11 +1,47 @@ -using ArchUnitNET.Domain; +using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public class TypesShouldConjunction + public sealed class TypesShouldConjunction : ObjectsShouldConjunction { - public TypesShouldConjunction(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public TypesShouldConjunction( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override TypesShouldConjunctionWithDescription As(string description) => + new TypesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.As(description) + ); + + public override TypesShouldConjunctionWithDescription Because(string reason) => + new TypesShouldConjunctionWithDescription( + PartialArchRuleConjunction, + ObjectProvider, + Condition.Because(reason) + ); + + public override TypesShould AndShould() => + new TypesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override TypesShould OrShould() => + new TypesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunctionWithDescription.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunctionWithDescription.cs index b0959779a..89599e0d4 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunctionWithDescription.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShouldConjunctionWithDescription.cs @@ -1,11 +1,34 @@ -using ArchUnitNET.Domain; +using System.Collections.Generic; +using ArchUnitNET.Domain; +using ArchUnitNET.Fluent.Conditions; +using JetBrains.Annotations; namespace ArchUnitNET.Fluent.Syntax.Elements.Types { - public class TypesShouldConjunctionWithDescription + public sealed class TypesShouldConjunctionWithDescription : ObjectsShouldConjunctionWithDescription { - public TypesShouldConjunctionWithDescription(IArchRuleCreator ruleCreator) - : base(ruleCreator) { } + public TypesShouldConjunctionWithDescription( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider, + IOrderedCondition condition + ) + : base(partialArchRuleConjunction, objectProvider, condition) { } + + public override TypesShould AndShould() => + new TypesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.And + ); + + public override TypesShould OrShould() => + new TypesShould( + PartialArchRuleConjunction, + ObjectProvider, + Condition, + LogicalConjunctionDefinition.Or + ); } } diff --git a/ArchUnitNET/Fluent/Syntax/SyntaxElement.cs b/ArchUnitNET/Fluent/Syntax/SyntaxElement.cs index 118e3b20e..fd5530d8c 100644 --- a/ArchUnitNET/Fluent/Syntax/SyntaxElement.cs +++ b/ArchUnitNET/Fluent/Syntax/SyntaxElement.cs @@ -6,44 +6,50 @@ namespace ArchUnitNET.Fluent.Syntax public abstract class SyntaxElement : IHasDescription where TRuleType : ICanBeAnalyzed { - // ReSharper disable once InconsistentNaming - protected readonly IArchRuleCreator _ruleCreator; - - protected SyntaxElement([NotNull] IArchRuleCreator ruleCreator) + protected SyntaxElement( + [CanBeNull] PartialArchRuleConjunction partialArchRuleConjunction, + IObjectProvider objectProvider + ) { - _ruleCreator = ruleCreator; + PartialArchRuleConjunction = partialArchRuleConjunction; + ObjectProvider = objectProvider; } - public string Description => _ruleCreator.Description; + [CanBeNull] + protected PartialArchRuleConjunction PartialArchRuleConjunction { get; } - public override string ToString() - { - return Description; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } + protected IObjectProvider ObjectProvider { get; } - if (ReferenceEquals(this, obj)) - { - return true; - } + public abstract string Description { get; } - return obj.GetType() == GetType() && Equals((SyntaxElement)obj); - } - - private bool Equals(SyntaxElement other) + public override string ToString() { - return _ruleCreator.Equals(other._ruleCreator); + return Description; } - public override int GetHashCode() - { - return _ruleCreator != null ? _ruleCreator.GetHashCode() : 0; - } + // public override bool Equals(object obj) + // { + // if (ReferenceEquals(null, obj)) + // { + // return false; + // } + // + // if (ReferenceEquals(this, obj)) + // { + // return true; + // } + // + // return obj.GetType() == GetType() && Equals((SyntaxElement)obj); + // } + // + // private bool Equals(SyntaxElement other) + // { + // return _ruleCreator.Equals(other._ruleCreator); + // } + // + // public override int GetHashCode() + // { + // return _ruleCreator != null ? _ruleCreator.GetHashCode() : 0; + // } } } diff --git a/ArchUnitNETTests/ArchUnitNET/Storage/CustomPathFrozenRules.json b/ArchUnitNETTests/ArchUnitNET/Storage/CustomPathFrozenRules.json index f42d52c8b..d73f934f8 100644 --- a/ArchUnitNETTests/ArchUnitNET/Storage/CustomPathFrozenRules.json +++ b/ArchUnitNETTests/ArchUnitNET/Storage/CustomPathFrozenRules.json @@ -22,5 +22,18 @@ "Slice1", "Slice1.Service" ] + }, + { + "ArchRuleDescription": "Types are \"ArchUnitNETTests.Fluent.FreezeTests+Violation\" or \"ArchUnitNETTests.Fluent.FreezeTests+Violation2\" not be private", + "Violations": [ + "ArchUnitNETTests.Fluent.FreezeTests+Violation", + "ArchUnitNETTests.Fluent.FreezeTests+Violation2" + ] + }, + { + "ArchRuleDescription": "Types are \"ArchUnitNETTests.Fluent.FreezeTests+Violation\" be protected", + "Violations": [ + "ArchUnitNETTests.Fluent.FreezeTests+Violation" + ] } ] \ No newline at end of file diff --git a/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.json b/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.json index 06bbca207..2866b3707 100644 --- a/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.json +++ b/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.json @@ -32,5 +32,25 @@ { "ArchRuleDescription": "Slices matching \"TestAssembly.Slices.(*)..\" should not depend on each other", "Violations": [] + }, + { + "ArchRuleDescription": "Types are \"ArchUnitNETTests.Fluent.FreezeTests+Violation\" or \"ArchUnitNETTests.Fluent.FreezeTests+Violation2\" not be private", + "Violations": [ + "ArchUnitNETTests.Fluent.FreezeTests+Violation", + "ArchUnitNETTests.Fluent.FreezeTests+Violation2" + ] + }, + { + "ArchRuleDescription": "Types are \"ArchUnitNETTests.Fluent.FreezeTests+Violation\" be protected", + "Violations": [ + "ArchUnitNETTests.Fluent.FreezeTests+Violation" + ] + }, + { + "ArchRuleDescription": "Types are \"ArchUnitNETTests.Fluent.FreezeTests+Violation\" or \"ArchUnitNETTests.Fluent.FreezeTests+Violation2\" be public", + "Violations": [ + "ArchUnitNETTests.Fluent.FreezeTests+Violation", + "ArchUnitNETTests.Fluent.FreezeTests+Violation2" + ] } ] \ No newline at end of file diff --git a/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.xml b/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.xml index a174b04db..3dafd4e98 100644 --- a/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.xml +++ b/ArchUnitNETTests/ArchUnitNET/Storage/FrozenRules.xml @@ -1,5 +1,16 @@  + + ArchUnitNETTests.Fluent.FreezeTests+Violation + ArchUnitNETTests.Fluent.FreezeTests+Violation2 + + + ArchUnitNETTests.Fluent.FreezeTests+Violation + ArchUnitNETTests.Fluent.FreezeTests+Violation2 + + + ArchUnitNETTests.Fluent.FreezeTests+Violation + ArchUnitNETTests.Fluent.FreezeTests+Violation diff --git a/ArchUnitNETTests/AssemblyTestHelper/AssemblyTestHelper.cs b/ArchUnitNETTests/AssemblyTestHelper/AssemblyTestHelper.cs index 2030a3ae2..ee5f37b4f 100644 --- a/ArchUnitNETTests/AssemblyTestHelper/AssemblyTestHelper.cs +++ b/ArchUnitNETTests/AssemblyTestHelper/AssemblyTestHelper.cs @@ -58,7 +58,7 @@ public void AssertNoViolations(IArchRule rule) public void AssertAnyViolations(IArchRule rule) { - var results = rule.Evaluate(Architecture); + var results = rule.Evaluate(Architecture).ToList(); var output = FormatSnapshot(rule, results); if (results.All(result => !result.Passed)) { @@ -73,7 +73,7 @@ public void AssertAnyViolations(IArchRule rule) public void AssertOnlyViolations(IArchRule rule) { - var results = rule.Evaluate(Architecture); + var results = rule.Evaluate(Architecture).ToList(); var output = FormatSnapshot(rule, results); if (results.Any(result => result.Passed)) { @@ -85,7 +85,7 @@ public void AssertOnlyViolations(IArchRule rule) public void AssertException(IArchRule rule) where T : Exception { - var exception = Assert.Throws(() => rule.Evaluate(Architecture)); + var exception = Assert.Throws(() => rule.Evaluate(Architecture).ToList()); snapshot.AppendLine("Query: " + rule.Description); snapshot.AppendLine("Exception: " + exception.Message); snapshot.AppendLine(); diff --git a/ArchUnitNETTests/Fluent/DescriptionTests.cs b/ArchUnitNETTests/Fluent/DescriptionTests.cs index feac2a25a..cd555fde8 100644 --- a/ArchUnitNETTests/Fluent/DescriptionTests.cs +++ b/ArchUnitNETTests/Fluent/DescriptionTests.cs @@ -33,7 +33,7 @@ public class DescriptionTests .That() .ArePublic() .As(CustomDescription) - .And() + .That() .AreProtected() .Should() .BePublic() @@ -59,22 +59,34 @@ public class DescriptionTests [Fact] public void CustomDescriptionTest() { - Assert.Equal("Classes " + CustomDescription, _customDescriptionTestRule1.Description); - Assert.Equal("Classes " + CustomDescription, _customDescriptionTestRule1.ToString()); Assert.Equal( - CustomDescription + " and are protected " + CustomDescription, + "Classes should " + CustomDescription, + _customDescriptionTestRule1.Description + ); + Assert.Equal( + "Classes should " + CustomDescription, + _customDescriptionTestRule1.ToString() + ); + Assert.Equal( + CustomDescription + " that are protected should " + CustomDescription, _customDescriptionTestRule2.Description ); Assert.Equal( - CustomDescription + " and are protected " + CustomDescription, + CustomDescription + " that are protected should " + CustomDescription, _customDescriptionTestRule2.ToString() ); Assert.Equal( - "Classes " + CustomDescription + " and Attributes " + CustomDescription, + "Classes should " + + CustomDescription + + " and Attributes should " + + CustomDescription, _combinedCustomDescriptionTestRule.Description ); Assert.Equal( - "Classes " + CustomDescription + " and Attributes " + CustomDescription, + "Classes should " + + CustomDescription + + " and Attributes should " + + CustomDescription, _combinedCustomDescriptionTestRule.ToString() ); } diff --git a/ArchUnitNETTests/Fluent/Syntax/ConjunctionFactoryTest.cs b/ArchUnitNETTests/Fluent/Syntax/ConjunctionFactoryTest.cs deleted file mode 100644 index 6e01fd498..000000000 --- a/ArchUnitNETTests/Fluent/Syntax/ConjunctionFactoryTest.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using ArchUnitNET.Domain; -using ArchUnitNET.Fluent; -using ArchUnitNET.Fluent.Syntax.Elements.Types; -using Xunit; -using static ArchUnitNET.Fluent.BasicObjectProviderDefinition; -using static ArchUnitNET.Fluent.Syntax.ConjunctionFactory; - -namespace ArchUnitNETTests.Fluent.Syntax -{ - public class ConjunctionFactoryTest - { - [Fact] - public void CreateSyntaxElementTest() - { - var syntaxElement = Create( - new ArchRuleCreator(Types) - ); - Assert.NotNull(syntaxElement); - Assert.Equal(typeof(TypesShouldConjunction), syntaxElement.GetType()); - } - - [Fact] - public void CreateSyntaxElementWithInvalidParametersThrowsExceptionTest() - { - Assert.Throws(() => - Create(new ArchRuleCreator(Types)) - ); - } - } -} diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs b/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs index 32f37e3d2..d9d1838ea 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs @@ -455,10 +455,8 @@ class CustomCondition : ICondition { public string Description => "follow custom condition"; - public IEnumerable Check( - IEnumerable objects, - Architecture architecture - ) + public IEnumerable Check(IEnumerable objects, + Architecture architecture) { return objects.Select(t => new ConditionResult( t, diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.BeTypesThatTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.BeTypesThatTest.verified.txt index 88e3c1b24..eae15c55b 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.BeTypesThatTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.BeTypesThatTest.verified.txt @@ -10,10 +10,10 @@ All Evaluations passed Query: Types that are "TypeDependencyNamespace.BaseClass" should be types that are "TypeDependencyNamespace.ChildClass" Result: False -Description: TypeDependencyNamespace.BaseClass is not "TypeDependencyNamespace.ChildClass" +Description: TypeDependencyNamespace.BaseClass is not types that are "TypeDependencyNamespace.ChildClass" Message: "Types that are "TypeDependencyNamespace.BaseClass" should be types that are "TypeDependencyNamespace.ChildClass"" failed: - TypeDependencyNamespace.BaseClass is not "TypeDependencyNamespace.ChildClass" + TypeDependencyNamespace.BaseClass is not types that are "TypeDependencyNamespace.ChildClass" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.CallAnyTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.CallAnyTest.verified.txt index 37f40efa9..80b938aa9 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.CallAnyTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.CallAnyTest.verified.txt @@ -164,59 +164,59 @@ Message: ----- Conditions ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() only calls "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod3()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho..." failed: +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()"" failed: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() only calls "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod3()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() only calls "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod3()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho..." failed: +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()"" failed: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() only calls "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod3()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodD... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() only calls "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod3()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodD..." failed: +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()"" failed: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() only calls "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod3()" ----- Predicates ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho... +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()"" failed: + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho... +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()"" failed: + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" ... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodD... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" ..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodD... +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()"" failed: + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" @@ -224,7 +224,7 @@ Message: ----- Conditions ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyC... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" Result: True Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() passed Message: @@ -241,7 +241,7 @@ Message: ----- Predicates ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyName... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" Result: True Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() passed Message: diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.ExistTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.ExistTest.verified.txt index bbbebc435..af4d80273 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.ExistTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.ExistTest.verified.txt @@ -2,13 +2,13 @@ Query: Types that are "TypeDependencyNamespace.BaseClass" should exist Result: True -Description: TypeDependencyNamespace.BaseClass passed +Description: TypeDependencyNamespace.BaseClass does exist Message: All Evaluations passed Query: Types that are "TypeDependencyNamespace.BaseClass" should exist Result: True -Description: TypeDependencyNamespace.BaseClass passed +Description: TypeDependencyNamespace.BaseClass does exist Message: All Evaluations passed diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomConditionTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomConditionTest.verified.txt index 29762bfd9..9c3cfedea 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomConditionTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomConditionTest.verified.txt @@ -2,13 +2,13 @@ Query: Types that are "TypeDependencyNamespace.ChildClass" should follow custom condition Result: True -Description: TypeDependencyNamespace.ChildClass passed +Description: TypeDependencyNamespace.ChildClass does not follow custom condition Message: All Evaluations passed Query: Types that are "TypeDependencyNamespace.ChildClass" should follow custom condition Result: True -Description: TypeDependencyNamespace.ChildClass passed +Description: TypeDependencyNamespace.ChildClass does not follow custom condition Message: All Evaluations passed diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomPredicateTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomPredicateTest.verified.txt index 55bf00f80..83f44a483 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomPredicateTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.FollowCustomPredicateTest.verified.txt @@ -54,19 +54,19 @@ Message: Query: Types that are "TypeDependencyNamespace.BaseClass" should be types that follow custom predicate Result: False -Description: TypeDependencyNamespace.BaseClass is not "TypeDependencyNamespace.ChildClass" +Description: TypeDependencyNamespace.BaseClass is not types that follow custom predicate Message: "Types that are "TypeDependencyNamespace.BaseClass" should be types that follow custom predicate" failed: - TypeDependencyNamespace.BaseClass is not "TypeDependencyNamespace.ChildClass" + TypeDependencyNamespace.BaseClass is not types that follow custom predicate Query: Types that are "TypeDependencyNamespace.BaseClass" should be types that follow custom predicate Result: False -Description: TypeDependencyNamespace.BaseClass is not "TypeDependencyNamespace.ChildClass" +Description: TypeDependencyNamespace.BaseClass is not types that follow custom predicate Message: "Types that are "TypeDependencyNamespace.BaseClass" should be types that follow custom predicate" failed: - TypeDependencyNamespace.BaseClass is not "TypeDependencyNamespace.ChildClass" + TypeDependencyNamespace.BaseClass is not types that follow custom predicate diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesThatTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesThatTest.verified.txt index fbe9ca82e..83eed14f6 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesThatTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesThatTest.verified.txt @@ -1,6 +1,6 @@ ===== No violations ===== -Query: Types that are "AttributeNamespace.ClassWithTwoAttributes" should have attributes that are "AttributeNamespace.Attribute1" +Query: Types that are "AttributeNamespace.ClassWithTwoAttributes" should have any attributes that are "AttributeNamespace.Attribute1" Result: True Description: AttributeNamespace.ClassWithTwoAttributes passed Message: @@ -8,11 +8,11 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "AttributeNamespace.ClassWithTwoAttributes" should have attributes that are "AttributeNamespace.UnusedAttribute" +Query: Types that are "AttributeNamespace.ClassWithTwoAttributes" should have any attributes that are "AttributeNamespace.UnusedAttribute" Result: False Description: AttributeNamespace.ClassWithTwoAttributes only has attributes "AttributeNamespace.Attribute1" and "AttributeNamespace.Attribute2" Message: -"Types that are "AttributeNamespace.ClassWithTwoAttributes" should have attributes that are "AttributeNamespace.UnusedAttribute"" failed: +"Types that are "AttributeNamespace.ClassWithTwoAttributes" should have any attributes that are "AttributeNamespace.UnusedAttribute"" failed: AttributeNamespace.ClassWithTwoAttributes only has attributes "AttributeNamespace.Attribute1" and "AttributeNamespace.Attribute2" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesWithNamedArguments.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesWithNamedArguments.verified.txt index ec17f989a..4c722ba60 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesWithNamedArguments.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAnyAttributesWithNamedArguments.verified.txt @@ -364,20 +364,20 @@ Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments passe Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttr... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttr..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttr... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttr..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have any attributes with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=NotTheValueOfAnyAttribute" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAttributeWithNamedArguments.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAttributeWithNamedArguments.verified.txt index 8b6d3564a..01974f305 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAttributeWithNamedArguments.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveAttributeWithNamedArguments.verified.txt @@ -538,38 +538,38 @@ Message: ----- Predicates ----- -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedPara..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument2" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveNameTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveNameTest.verified.txt index 4e177090d..e9774afd2 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveNameTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.HaveNameTest.verified.txt @@ -62,7 +62,7 @@ Description: TypeDependencyNamespace.BaseClass passed Message: All Evaluations passed -Query: Types that are "TypeDependencyNamespace.BaseClass" should have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0b... +Query: Types that are "TypeDependencyNamespace.BaseClass" should have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" Result: True Description: TypeDependencyNamespace.BaseClass passed Message: @@ -154,7 +154,7 @@ Description: TypeDependencyNamespace.BaseClass passed Message: All Evaluations passed -Query: Types that are "TypeDependencyNamespace.BaseClass" should be Types that have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken... +Query: Types that are "TypeDependencyNamespace.BaseClass" should be Types that have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" Result: True Description: TypeDependencyNamespace.BaseClass passed Message: diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotCallAnyTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotCallAnyTest.verified.txt index 2df182d3c..896f10038 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotCallAnyTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotCallAnyTest.verified.txt @@ -34,7 +34,7 @@ Description: System.Void MethodDependencyNamespace.MethodDependencyClass::Method Message: All Evaluations passed -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should be Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependenc... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should be Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" Result: True Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed Message: @@ -134,59 +134,59 @@ All Evaluations passed ----- Conditions ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.M... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.M..." failed: +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.M... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.M..." failed: +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void Met... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void Met..." failed: +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" ----- Predicates ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void M... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespac... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void M..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespac... +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void M... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespac... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void M..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespac... +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependenc... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void ... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependenc..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void ... +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" @@ -194,7 +194,7 @@ Message: ----- Conditions ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDep... should not call "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" Result: True Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed Result: True @@ -202,13 +202,13 @@ Description: System.Void MethodDependencyNamespace.MethodDependencyClass::Method Message: All Evaluations passed -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDep... should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependen... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDep... should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependen..." failed: +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" and "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" @@ -216,7 +216,7 @@ Message: ----- Predicates ----- -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDep... should be Method members that do not call "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" Result: True Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed Result: True @@ -224,15 +224,15 @@ Description: System.Void MethodDependencyNamespace.MethodDependencyClass::Method Message: All Evaluations passed -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDep... should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependen... +Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDepen... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDepen... +Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDep... should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependen..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDepen... - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDepen... +"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should be Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()"" failed: + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" + System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() is not Method members that do not call any "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2()" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotExistTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotExistTest.verified.txt index 09fdfa4da..7494b2dda 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotExistTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotExistTest.verified.txt @@ -1,6 +1,8 @@ ===== No violations ===== Query: Types that depend on "TypeDependencyNamespace.ChildClass" should not exist +Result: True +Description: There are no objects matching the criteria Message: All Evaluations passed diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAnyAttributesThatTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAnyAttributesThatTest.verified.txt index 891cfccf0..b9153d475 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAnyAttributesThatTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAnyAttributesThatTest.verified.txt @@ -1,6 +1,6 @@ ===== No violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have attributes that are "AttributeNamespace.UnusedAttribute" +Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attributes that are "AttributeNamespace.UnusedAttribute" Result: True Description: AttributeNamespace.ClassWithSingleAttribute passed Message: @@ -8,11 +8,11 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have attributes that are "AttributeNamespace.Attribute1" +Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attributes that are "AttributeNamespace.Attribute1" Result: False Description: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have attributes that are "AttributeNamespace.Attribute1"" failed: +"Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attributes that are "AttributeNamespace.Attribute1"" failed: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt index ff6b97d5b..677216fd0 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt @@ -362,77 +362,77 @@ All Evaluations passed ----- Conditions ----- -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Arg..." failed: +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" ----- Predicates ----- -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False -Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na..." failed: - AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: + AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False -Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na..." failed: - AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: + AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False -Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na..." failed: - AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: + AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" -Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na... +Query: Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Result: False -Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +Description: AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" Message: -"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "Na..." failed: - AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=... +"Types that are "AttributeNamespace.ClassWithSingleAttributeWithNamedArguments" should be Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1"" failed: + AttributeNamespace.ClassWithSingleAttributeWithNamedArguments is not Types that do not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.TypeArgument1" and "NamedParameter2=Argument1" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveNameTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveNameTest.verified.txt index 0ae2354b5..18d5ff558 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveNameTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.NotHaveNameTest.verified.txt @@ -62,7 +62,7 @@ Description: TypeDependencyNamespace.BaseClass passed Message: All Evaluations passed -Query: Types that are "TypeDependencyNamespace.BaseClass" should not have assembly qualified name "TypeDependencyNamespace.ChildClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd... +Query: Types that are "TypeDependencyNamespace.BaseClass" should not have assembly qualified name "TypeDependencyNamespace.ChildClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" Result: True Description: TypeDependencyNamespace.BaseClass passed Message: @@ -154,7 +154,7 @@ Description: TypeDependencyNamespace.BaseClass passed Message: All Evaluations passed -Query: Types that are "TypeDependencyNamespace.BaseClass" should be Types that do not have assembly qualified name "TypeDependencyNamespace.ChildClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, Public... +Query: Types that are "TypeDependencyNamespace.BaseClass" should be Types that do not have assembly qualified name "TypeDependencyNamespace.ChildClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" Result: True Description: TypeDependencyNamespace.BaseClass passed Message: @@ -278,11 +278,11 @@ Message: -Query: Types that are "TypeDependencyNamespace.BaseClass" should not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0... +Query: Types that are "TypeDependencyNamespace.BaseClass" should not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" Result: False Description: TypeDependencyNamespace.BaseClass does have assembly qualified name TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4 Message: -"Types that are "TypeDependencyNamespace.BaseClass" should not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0..." failed: +"Types that are "TypeDependencyNamespace.BaseClass" should not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4"" failed: TypeDependencyNamespace.BaseClass does have assembly qualified name TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4 @@ -415,12 +415,12 @@ Message: -Query: Types that are "TypeDependencyNamespace.BaseClass" should be Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicK... +Query: Types that are "TypeDependencyNamespace.BaseClass" should be Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" Result: False -Description: TypeDependencyNamespace.BaseClass is not Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5... +Description: TypeDependencyNamespace.BaseClass is not Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" Message: -"Types that are "TypeDependencyNamespace.BaseClass" should be Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicK..." failed: - TypeDependencyNamespace.BaseClass is not Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5... +"Types that are "TypeDependencyNamespace.BaseClass" should be Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4"" failed: + TypeDependencyNamespace.BaseClass is not Types that do not have assembly qualified name "TypeDependencyNamespace.BaseClass, DependencyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=015ff5fd0dc0bfa4" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.OnlyHaveAttributesThatTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.OnlyHaveAttributesThatTest.verified.txt index 4643ef533..7301a14a8 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.OnlyHaveAttributesThatTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectSyntaxElementsTests.OnlyHaveAttributesThatTest.verified.txt @@ -1,6 +1,6 @@ ===== No violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes that are "AttributeNamespace.Attribute1" +Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have any attributes that are "AttributeNamespace.Attribute1" Result: True Description: AttributeNamespace.ClassWithSingleAttribute passed Message: @@ -8,11 +8,11 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes that are "AttributeNamespace.UnusedAttribute" +Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have any attributes that are "AttributeNamespace.UnusedAttribute" Result: False Description: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes that are "AttributeNamespace.UnusedAttribute"" failed: +"Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have any attributes that are "AttributeNamespace.UnusedAttribute"" failed: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.ImplementAnyInterfacesTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.ImplementAnyInterfacesTest.verified.txt index e10ffdf37..b82827672 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.ImplementAnyInterfacesTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.ImplementAnyInterfacesTest.verified.txt @@ -204,46 +204,46 @@ Message: Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface" @@ -422,28 +422,28 @@ Message: Query: Interfaces that are "InterfaceAssembly.IBaseInterface" should be types that implement any interface Result: False -Description: InterfaceAssembly.IBaseInterface is not "InterfaceAssembly.IChildInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IBaseInterface is not types that implement any interface Message: "Interfaces that are "InterfaceAssembly.IBaseInterface" should be types that implement any interface" failed: - InterfaceAssembly.IBaseInterface is not "InterfaceAssembly.IChildInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IBaseInterface is not types that implement any interface Query: Interfaces that are "InterfaceAssembly.IBaseInterface" should be types that implement any interface Result: False -Description: InterfaceAssembly.IBaseInterface is not "InterfaceAssembly.IChildInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IBaseInterface is not types that implement any interface Message: "Interfaces that are "InterfaceAssembly.IBaseInterface" should be types that implement any interface" failed: - InterfaceAssembly.IBaseInterface is not "InterfaceAssembly.IChildInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IBaseInterface is not types that implement any interface Query: Interfaces that are "InterfaceAssembly.IBaseInterface" should be types that implement any Interfaces that have name "NotTheNameOfAnyObject" Result: False -Description: InterfaceAssembly.IBaseInterface is not "InterfaceAssembly.IChildInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IBaseInterface is not types that implement any Interfaces that have name "NotTheNameOfAnyObject" Message: "Interfaces that are "InterfaceAssembly.IBaseInterface" should be types that implement any Interfaces that have name "NotTheNameOfAnyObject"" failed: - InterfaceAssembly.IBaseInterface is not "InterfaceAssembly.IChildInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IBaseInterface is not types that implement any Interfaces that have name "NotTheNameOfAnyObject" @@ -558,46 +558,46 @@ Message: Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement any "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" +Description: InterfaceAssembly.IChildInterface is not types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithMultipleDependencies" + InterfaceAssembly.IChildInterface is not types that implement any Interfaces that are "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.NotImplementAnyInterfacesTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.NotImplementAnyInterfacesTest.verified.txt index cd468f61a..81da626b2 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.NotImplementAnyInterfacesTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/TypeSyntaxElementsTests.NotImplementAnyInterfacesTest.verified.txt @@ -204,46 +204,46 @@ Message: Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement "InterfaceAssembly.IBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement "InterfaceAssembly.IBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IOtherChildInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface" @@ -428,37 +428,37 @@ Message: Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any interface Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any interface Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any interface" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any interface Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any interface Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any interface Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any interface" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any interface Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any interface Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any interface Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any interface" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any interface Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any Interfaces that have name "NotTheNameOfAnyObject" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any Interfaces that have name "NotTheNameOfAnyObject" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any Interfaces that have name "NotTheNameOfAnyObject"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any Interfaces that have name "NotTheNameOfAnyObject" @@ -573,46 +573,46 @@ Message: Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Query: Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Result: False -Description: InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" +Description: InterfaceAssembly.IChildInterface is not types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" Message: "Interfaces that are "InterfaceAssembly.IChildInterface" should be types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface"" failed: - InterfaceAssembly.IChildInterface is not "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface" or "InterfaceAssembly.IInterfaceWithoutDependencies" or "System.Runtime.CompilerServices.CompilationRelaxationsAttribute" or "System.Int32" or "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" or "System.Boolean" or "System.Diagnostics.DebuggableAttribute" or "System.Diagnostics.DebuggableAttribute+DebuggingModes" or "System.Runtime.Versioning.TargetFrameworkAttribute" or "System.String" or "System.Reflection.AssemblyCompanyAttribute" or "System.Reflection.AssemblyConfigurationAttribute" or "System.Reflection.AssemblyFileVersionAttribute" or "System.Reflection.AssemblyInformationalVersionAttribute" or "System.Reflection.AssemblyProductAttribute" or "System.Reflection.AssemblyTitleAttribute" + InterfaceAssembly.IChildInterface is not types that do not implement any Interfaces that are "InterfaceAssembly.IBaseInterface" or "InterfaceAssembly.IOtherBaseInterface"