diff --git a/ArchUnitNET/Domain/Extensions/AttributeExtensions.cs b/ArchUnitNET/Domain/Extensions/AttributeExtensions.cs index cc53fcb3a..4e60e4fd3 100644 --- a/ArchUnitNET/Domain/Extensions/AttributeExtensions.cs +++ b/ArchUnitNET/Domain/Extensions/AttributeExtensions.cs @@ -1,13 +1,17 @@ +using System; using System.Linq; namespace ArchUnitNET.Domain.Extensions { public static class AttributeExtensions { + [Obsolete( + "Either HasAttribute() without the useRegularExpressions parameter or HasAttributeMatching() should be used" + )] public static bool HasAttribute( this IHasAttributes a, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return a.Attributes.Any(attribute => @@ -15,10 +19,18 @@ public static bool HasAttribute( ); } + public static bool HasAttribute(this IHasAttributes a, string fullName) + { + return a.Attributes.Any(attribute => attribute.FullNameEquals(fullName)); + } + + [Obsolete( + "Either OnlyHasAttributes() without the useRegularExpressions parameter or OnlyHasAttributesMatching() should be used" + )] public static bool OnlyHasAttributes( this IHasAttributes a, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return a.Attributes.IsNullOrEmpty() @@ -26,5 +38,22 @@ public static bool OnlyHasAttributes( attribute.FullNameMatches(pattern, useRegularExpressions) ); } + + public static bool HasAttributeMatching(this IHasAttributes a, string pattern) + { + return a.Attributes.Any(attribute => attribute.FullNameMatches(pattern)); + } + + public static bool OnlyHasAttributes(this IHasAttributes a, string name) + { + return a.Attributes.IsNullOrEmpty() + || a.Attributes.All(attribute => attribute.FullNameEquals(name)); + } + + public static bool OnlyHasAttributesMatching(this IHasAttributes a, string pattern) + { + return a.Attributes.IsNullOrEmpty() + || a.Attributes.All(attribute => attribute.FullNameMatches(pattern)); + } } } diff --git a/ArchUnitNET/Domain/Extensions/DependencyExtensions.cs b/ArchUnitNET/Domain/Extensions/DependencyExtensions.cs index 621cead2b..c0a3dca4f 100644 --- a/ArchUnitNET/Domain/Extensions/DependencyExtensions.cs +++ b/ArchUnitNET/Domain/Extensions/DependencyExtensions.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using ArchUnitNET.Domain.Dependencies; @@ -6,16 +7,29 @@ namespace ArchUnitNET.Domain.Extensions { public static class DependencyExtensions { + [Obsolete( + "Either CallsMethod() without the useRegularExpressions parameter or CallsMethodMatching() should be used" + )] public static bool CallsMethod( this IHasDependencies type, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return type.GetCalledMethods() .Any(member => member.FullNameMatches(pattern, useRegularExpressions)); } + public static bool CallsMethod(this IHasDependencies type, string fullName) + { + return type.GetCalledMethods().Any(member => member.FullNameEquals(fullName)); + } + + public static bool CallsMethodMatching(this IHasDependencies type, string pattern) + { + return type.GetCalledMethods().Any(member => member.FullNameMatches(pattern)); + } + public static IEnumerable GetCalledMethods(this IHasDependencies type) { return type @@ -30,6 +44,9 @@ public static IEnumerable GetAccessedFieldMembers(this IHasDependen .Select(dependency => (FieldMember)dependency.TargetMember); } + [Obsolete( + "Either DependsOnType() without the useRegularExpressions parameter or DependsOnTypeMatching() should be used" + )] public static bool DependsOn( this IHasDependencies c, string pattern, @@ -40,6 +57,19 @@ public static bool DependsOn( .Any(d => d.FullNameMatches(pattern, useRegularExpressions)); } + public static bool DependsOnType(this IHasDependencies c, string fullName) + { + return c.GetTypeDependencies().Any(d => d.FullNameEquals(fullName)); + } + + public static bool DependsOnTypeMatching(this IHasDependencies c, string pattern) + { + return c.GetTypeDependencies().Any(d => d.FullNameMatches(pattern)); + } + + [Obsolete( + "Either OnlyDependsOnType() without the useRegularExpressions parameter or OnlyDependsOnTypesMatching() should be used" + )] public static bool OnlyDependsOn( this IHasDependencies c, string pattern, @@ -50,6 +80,16 @@ public static bool OnlyDependsOn( .All(d => d.FullNameMatches(pattern, useRegularExpressions)); } + public static bool OnlyDependsOnType(this IHasDependencies c, string fullName) + { + return c.GetTypeDependencies().All(d => d.FullNameEquals(fullName)); + } + + public static bool OnlyDependsOnTypesMatching(this IHasDependencies c, string pattern) + { + return c.GetTypeDependencies().All(d => d.FullNameMatches(pattern)); + } + public static IEnumerable GetTypeDependencies(this IHasDependencies c) { return c.Dependencies.Select(dependency => dependency.Target); diff --git a/ArchUnitNET/Domain/Extensions/MemberExtensions.cs b/ArchUnitNET/Domain/Extensions/MemberExtensions.cs index e2859f106..bc13093a0 100644 --- a/ArchUnitNET/Domain/Extensions/MemberExtensions.cs +++ b/ArchUnitNET/Domain/Extensions/MemberExtensions.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using ArchUnitNET.Domain.Dependencies; @@ -6,15 +7,28 @@ namespace ArchUnitNET.Domain.Extensions { public static class MemberExtensions { + [Obsolete( + "Either IsDeclaredIn() without the useRegularExpressions parameter or IsDeclaredInTypeMatching() should be used" + )] public static bool IsDeclaredIn( this IMember member, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return member.DeclaringType.FullNameMatches(pattern, useRegularExpressions); } + public static bool IsDeclaredIn(this IMember member, string fullName) + { + return member.DeclaringType.FullNameEquals(fullName); + } + + public static bool IsDeclaredInTypeMatching(this IMember member, string pattern) + { + return member.DeclaringType.FullNameMatches(pattern); + } + public static bool IsDeclaredIn(this IMember member, IType type) { return member.DeclaringType.Equals(type); @@ -56,6 +70,9 @@ public static bool HasMethodCallDependencies( return member.GetMethodCallDependencies(getBackwardsDependencies).Any(); } + [Obsolete( + "Either IsCalledByType() without the useRegularExpressions parameter or IsCalledByTypeMatching() should be used" + )] public static bool IsCalledBy( this MethodMember member, string pattern, @@ -69,6 +86,20 @@ public static bool IsCalledBy( ); } + public static bool IsCalledByType(this MethodMember member, string fullName) + { + return member + .GetMethodCallDependencies(true) + .Any(dependency => dependency.Origin.FullNameEquals(fullName)); + } + + public static bool IsCalledByTypeMatching(this MethodMember member, string pattern) + { + return member + .GetMethodCallDependencies(true) + .Any(dependency => dependency.Origin.FullNameMatches(pattern)); + } + public static IEnumerable GetCallingTypes(this MethodMember member) { return member @@ -77,6 +108,9 @@ public static IEnumerable GetCallingTypes(this MethodMember member) .Distinct(); } + [Obsolete( + "Either HasDependencyInMethodBodyToType() without the useRegularExpressions parameter or HasDependencyInMethodBodyToTypeMatching() should be used" + )] public static bool HasDependencyInMethodBodyTo( this MethodMember member, string pattern, @@ -90,6 +124,26 @@ public static bool HasDependencyInMethodBodyTo( ); } + public static bool HasDependencyInMethodBodyToType( + this MethodMember member, + string fullName + ) + { + return member + .GetBodyTypeMemberDependencies() + .Any(dependency => dependency.Target.FullNameEquals(fullName)); + } + + public static bool HasDependencyInMethodBodyToTypeMatching( + this MethodMember member, + string pattern + ) + { + return member + .GetBodyTypeMemberDependencies() + .Any(dependency => dependency.Target.FullNameMatches(pattern)); + } + public static bool HasFieldTypeDependencies( this IMember member, bool getBackwardsDependencies = false diff --git a/ArchUnitNET/Domain/Extensions/NamingExtensions.cs b/ArchUnitNET/Domain/Extensions/NamingExtensions.cs index eb4756685..88d767a2e 100644 --- a/ArchUnitNET/Domain/Extensions/NamingExtensions.cs +++ b/ArchUnitNET/Domain/Extensions/NamingExtensions.cs @@ -36,10 +36,13 @@ public static bool NameContains( return cls.Name.IndexOf(pattern, stringComparison) >= 0; } + [Obsolete( + "Either NameEquals() or NameMatches() without the useRegularExpressions parameter should be used" + )] public static bool NameMatches( this IHasName cls, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { if (useRegularExpressions) @@ -50,10 +53,23 @@ public static bool NameMatches( return string.Equals(cls.Name, pattern, StringComparison.OrdinalIgnoreCase); } + public static bool NameEquals(this IHasName cls, string name) + { + return string.Equals(cls.Name, name, StringComparison.OrdinalIgnoreCase); + } + + public static bool NameMatches(this IHasName cls, string pattern) + { + return pattern != null && Regex.IsMatch(cls.Name, pattern); + } + + [Obsolete( + "Either FullNameEquals() or FullNameMatches() without the useRegularExpressions parameter should be used" + )] public static bool FullNameMatches( this IHasName cls, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { if (useRegularExpressions) @@ -64,6 +80,16 @@ public static bool FullNameMatches( return string.Equals(cls.FullName, pattern, StringComparison.OrdinalIgnoreCase); } + public static bool FullNameEquals(this IHasName cls, string fullName) + { + return string.Equals(cls.FullName, fullName, StringComparison.OrdinalIgnoreCase); + } + + public static bool FullNameMatches(this IHasName cls, string pattern) + { + return pattern != null && Regex.IsMatch(cls.FullName, pattern); + } + public static bool FullNameContains(this IHasName cls, string pattern) { return pattern != null && cls.FullName.ToLower().Contains(pattern.ToLower()); diff --git a/ArchUnitNET/Domain/Extensions/TypeExtensions.cs b/ArchUnitNET/Domain/Extensions/TypeExtensions.cs index b7487344f..d3c47566a 100644 --- a/ArchUnitNET/Domain/Extensions/TypeExtensions.cs +++ b/ArchUnitNET/Domain/Extensions/TypeExtensions.cs @@ -19,10 +19,13 @@ public static bool ImplementsInterface(this IType type, Interface intf) ); } + [Obsolete( + "Either ImplementsInterface() without the useRegularExpressions parameter or ImplementsInterfaceMatching() should be used" + )] public static bool ImplementsInterface( this IType type, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { if (type is GenericParameter) @@ -35,6 +38,30 @@ public static bool ImplementsInterface( ); } + public static bool ImplementsInterface(this IType type, string fullName) + { + if (type is GenericParameter) + { + return false; + } + + return type.ImplementedInterfaces.Any(implementedInterface => + implementedInterface.FullNameEquals(fullName) + ); + } + + public static bool ImplementsInterfaceMatching(this IType type, string pattern) + { + if (type is GenericParameter) + { + return false; + } + + return type.ImplementedInterfaces.Any(implementedInterface => + implementedInterface.FullNameMatches(pattern) + ); + } + public static bool IsAssignableTo(this IType type, IType assignableToType) { if (type is GenericParameter genericParameter) @@ -47,10 +74,13 @@ public static bool IsAssignableTo(this IType type, IType assignableToType) return type.GetAssignableTypes().Contains(assignableToType); } + [Obsolete( + "Either IsAssignableTo() without the useRegularExpressions parameter or IsAssignableToTypeMatching() should be used" + )] public static bool IsAssignableTo( this IType type, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { if (type is GenericParameter genericParameter) @@ -64,6 +94,26 @@ public static bool IsAssignableTo( .Any(t => t.FullNameMatches(pattern, useRegularExpressions)); } + public static bool IsAssignableTo(this IType type, string fullName) + { + if (type is GenericParameter genericParameter) + { + return genericParameter.TypeConstraints.All(t => t.IsAssignableTo(fullName)); + } + + return type.GetAssignableTypes().Any(t => t.FullNameEquals(fullName)); + } + + public static bool IsAssignableToTypeMatching(this IType type, string pattern) + { + if (type is GenericParameter genericParameter) + { + return genericParameter.TypeConstraints.All(t => t.IsAssignableTo(pattern)); + } + + return type.GetAssignableTypes().Any(t => t.FullNameMatches(pattern)); + } + public static bool IsNestedIn(this IType type, IType assignableToType) { if (type is GenericParameter genericParameter) @@ -228,28 +278,57 @@ public static Attribute GetAttributeOfType(this IType type, Class attributeClass ); } + [Obsolete( + "Either ResidesInNamespace() without the useRegularExpressions parameter or ResidesInNamespaceMatching() should be used" + )] public static bool ResidesInNamespace( this IType e, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return e.Namespace.FullNameMatches(pattern, useRegularExpressions); } + public static bool ResidesInNamespace(this IType e, string fullName) + { + return e.Namespace.FullNameEquals(fullName); + } + + public static bool ResidesInNamespaceMatching(this IType e, string pattern) + { + return e.Namespace.FullNameMatches(pattern); + } + + [Obsolete( + "Either ResidesInAssembly() without the useRegularExpressions parameter or ResidesInAssemblyMatching() should be used" + )] public static bool ResidesInAssembly( this IType e, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return e.Assembly.FullNameMatches(pattern, useRegularExpressions); } + public static bool ResidesInAssembly(this IType e, string fullName) + { + return e.Assembly.FullNameEquals(fullName); + } + + public static bool ResidesInAssemblyMatching(this IType e, string pattern) + { + return e.Assembly.FullNameMatches(pattern); + } + + [Obsolete( + "Either IsDeclaredAsFieldIn() without the useRegularExpressions parameter or IsDeclaredAsFieldInTypeMatching() should be used" + )] public static bool IsDeclaredAsFieldIn( this IType type, string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return type.GetFieldTypeDependencies(true) @@ -258,6 +337,18 @@ public static bool IsDeclaredAsFieldIn( ); } + public static bool IsDeclaredAsFieldIn(this IType type, string fullName) + { + return type.GetFieldTypeDependencies(true) + .Any(dependency => dependency.Target.FullNameEquals(fullName)); + } + + public static bool IsDeclaredAsFieldInTypeMatching(this IType type, string pattern) + { + return type.GetFieldTypeDependencies(true) + .Any(dependency => dependency.Target.FullNameMatches(pattern)); + } + public static bool HasDependency(this IType type, ITypeDependency dependency) { return type.Dependencies.Contains(dependency); diff --git a/ArchUnitNET/Domain/PlantUml/Export/DependencyFilters.cs b/ArchUnitNET/Domain/PlantUml/Export/DependencyFilters.cs index e4819c619..b04f9e3a9 100644 --- a/ArchUnitNET/Domain/PlantUml/Export/DependencyFilters.cs +++ b/ArchUnitNET/Domain/PlantUml/Export/DependencyFilters.cs @@ -50,6 +50,9 @@ public static Func FocusOn(IEnumerable types) }; } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static Func FocusOn( string pattern, bool useRegularExpressions = false @@ -70,6 +73,9 @@ public static Func HasOrigin(IEnumerable types) return dependency => types.Contains(dependency.Origin); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static Func HasOrigin( string pattern, bool useRegularExpressions = false @@ -88,6 +94,9 @@ public static Func HasTarget(IEnumerable types) return dependency => types.Contains(dependency.Target); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static Func HasTarget( string pattern, bool useRegularExpressions = false diff --git a/ArchUnitNET/Domain/PlantUml/Import/ClassDiagramAssociation.cs b/ArchUnitNET/Domain/PlantUml/Import/ClassDiagramAssociation.cs index 44f949564..178994f5c 100644 --- a/ArchUnitNET/Domain/PlantUml/Import/ClassDiagramAssociation.cs +++ b/ArchUnitNET/Domain/PlantUml/Import/ClassDiagramAssociation.cs @@ -145,7 +145,7 @@ public bool Contains(IType clazz) { foreach (Stereotype stereotype in _component.Stereotypes) { - if (clazz.ResidesInNamespace(stereotype.AsString(), true)) + if (clazz.ResidesInNamespaceMatching(stereotype.AsString())) { return true; } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsThat.cs index 793abd316..e2d11a5cf 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/GivenObjectsThat.cs @@ -15,6 +15,9 @@ public abstract class GivenObjectsThat protected GivenObjectsThat(IArchRuleCreator ruleCreator) : base(ruleCreator) { } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction Are(string pattern, bool useRegularExpressions = false) { _ruleCreator.AddPredicate( @@ -23,6 +26,9 @@ public TGivenRuleTypeConjunction Are(string pattern, bool useRegularExpressions return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction Are( IEnumerable patterns, bool useRegularExpressions = false @@ -57,6 +63,9 @@ public TGivenRuleTypeConjunction Are(IObjectProvider objects) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction CallAny(string pattern, bool useRegularExpressions = false) { _ruleCreator.AddPredicate( @@ -65,6 +74,9 @@ public TGivenRuleTypeConjunction CallAny(string pattern, bool useRegularExpressi return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction CallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -99,6 +111,9 @@ public TGivenRuleTypeConjunction CallAny(IObjectProvider methods) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DependOnAny( string pattern, bool useRegularExpressions = false @@ -110,6 +125,9 @@ public TGivenRuleTypeConjunction DependOnAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -172,6 +190,9 @@ string description return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction OnlyDependOn( string pattern, bool useRegularExpressions = false @@ -183,6 +204,9 @@ public TGivenRuleTypeConjunction OnlyDependOn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction OnlyDependOn( IEnumerable patterns, bool useRegularExpressions = false @@ -228,6 +252,9 @@ public TGivenRuleTypeConjunction OnlyDependOn(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction HaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -242,6 +269,9 @@ public TGivenRuleTypeConjunction HaveAnyAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction HaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -308,6 +338,9 @@ public TGivenRuleTypeConjunction HaveAnyAttributes(IEnumerable attributes) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction OnlyHaveAttributes( string pattern, bool useRegularExpressions = false @@ -322,6 +355,9 @@ public TGivenRuleTypeConjunction OnlyHaveAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction OnlyHaveAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -412,6 +448,9 @@ params object[] moreArgumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction HaveAttributeWithArguments( string attribute, IEnumerable argumentValues @@ -426,6 +465,9 @@ IEnumerable argumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction HaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -528,6 +570,9 @@ public TGivenRuleTypeConjunction HaveAnyAttributesWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction HaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments @@ -542,6 +587,9 @@ public TGivenRuleTypeConjunction HaveAttributeWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction HaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -618,10 +666,10 @@ public TGivenRuleTypeConjunction HaveAttributeWithNamedArguments( return Create(_ruleCreator); } - public TGivenRuleTypeConjunction HaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either HaveName() without the useRegularExpressions parameter or HaveNameMatching() should be used" + )] + public TGivenRuleTypeConjunction HaveName(string pattern, bool useRegularExpressions) { _ruleCreator.AddPredicate( ObjectPredicatesDefinition.HaveName(pattern, useRegularExpressions) @@ -629,10 +677,24 @@ public TGivenRuleTypeConjunction HaveName( return Create(_ruleCreator); } - public TGivenRuleTypeConjunction HaveFullName( - string pattern, - bool useRegularExpressions = false - ) + public TGivenRuleTypeConjunction HaveName(string name) + { + _ruleCreator.AddPredicate(ObjectPredicatesDefinition.HaveName(name)); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction HaveNameMatching(string pattern) + { + _ruleCreator.AddPredicate( + ObjectPredicatesDefinition.HaveNameMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either HaveFullName() without the useRegularExpressions parameter or HaveFullNameMatching() should be used" + )] + public TGivenRuleTypeConjunction HaveFullName(string pattern, bool useRegularExpressions) { _ruleCreator.AddPredicate( ObjectPredicatesDefinition.HaveFullName(pattern, useRegularExpressions) @@ -640,6 +702,20 @@ public TGivenRuleTypeConjunction HaveFullName( return Create(_ruleCreator); } + public TGivenRuleTypeConjunction HaveFullName(string fullName) + { + _ruleCreator.AddPredicate(ObjectPredicatesDefinition.HaveFullName(fullName)); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction HaveFullNameMatching(string pattern) + { + _ruleCreator.AddPredicate( + ObjectPredicatesDefinition.HaveFullNameMatching(pattern) + ); + return Create(_ruleCreator); + } + public TGivenRuleTypeConjunction HaveNameStartingWith(string pattern) { _ruleCreator.AddPredicate( @@ -710,7 +786,9 @@ public TGivenRuleTypeConjunction ArePrivateProtected() //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreNot(string pattern, bool useRegularExpressions = false) { _ruleCreator.AddPredicate( @@ -719,6 +797,9 @@ public TGivenRuleTypeConjunction AreNot(string pattern, bool useRegularExpressio return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreNot( IEnumerable patterns, bool useRegularExpressions = false @@ -753,6 +834,9 @@ public TGivenRuleTypeConjunction AreNot(IObjectProvider objects) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DoNotCallAny( string pattern, bool useRegularExpressions = false @@ -764,6 +848,9 @@ public TGivenRuleTypeConjunction DoNotCallAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DoNotCallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -798,6 +885,9 @@ public TGivenRuleTypeConjunction DoNotCallAny(IObjectProvider meth return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DoNotDependOnAny( string pattern, bool useRegularExpressions = false @@ -812,6 +902,9 @@ public TGivenRuleTypeConjunction DoNotDependOnAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DoNotDependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -866,6 +959,9 @@ public TGivenRuleTypeConjunction DoNotDependOnAny(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DoNotHaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -880,6 +976,9 @@ public TGivenRuleTypeConjunction DoNotHaveAnyAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction DoNotHaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -974,6 +1073,9 @@ params object[] moreArgumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction DoNotHaveAttributeWithArguments( string attribute, IEnumerable argumentValues @@ -988,6 +1090,9 @@ IEnumerable argumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction DoNotHaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -1004,6 +1109,9 @@ params object[] moreArgumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction DoNotHaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments @@ -1018,6 +1126,9 @@ public TGivenRuleTypeConjunction DoNotHaveAttributeWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction DoNotHaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -1180,10 +1291,10 @@ public TGivenRuleTypeConjunction DoNotHaveAttributeWithNamedArguments( return Create(_ruleCreator); } - public TGivenRuleTypeConjunction DoNotHaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either DoNotHaveName() without the useRegularExpressions parameter or DoNotHaveNameMatching() should be used" + )] + public TGivenRuleTypeConjunction DoNotHaveName(string pattern, bool useRegularExpressions) { _ruleCreator.AddPredicate( ObjectPredicatesDefinition.DoNotHaveName(pattern, useRegularExpressions) @@ -1191,9 +1302,26 @@ public TGivenRuleTypeConjunction DoNotHaveName( return Create(_ruleCreator); } + public TGivenRuleTypeConjunction DoNotHaveName(string name) + { + _ruleCreator.AddPredicate(ObjectPredicatesDefinition.DoNotHaveName(name)); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction DoNotHaveNameMatching(string pattern) + { + _ruleCreator.AddPredicate( + ObjectPredicatesDefinition.DoNotHaveNameMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either DoNotHaveFullName() without the useRegularExpressions parameter or DoNotHaveFullNameMatching() should be used" + )] public TGivenRuleTypeConjunction DoNotHaveFullName( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddPredicate( @@ -1205,6 +1333,22 @@ public TGivenRuleTypeConjunction DoNotHaveFullName( return Create(_ruleCreator); } + public TGivenRuleTypeConjunction DoNotHaveFullName(string fullName) + { + _ruleCreator.AddPredicate( + ObjectPredicatesDefinition.DoNotHaveFullName(fullName) + ); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction DoNotHaveFullNameMatching(string pattern) + { + _ruleCreator.AddPredicate( + ObjectPredicatesDefinition.DoNotHaveFullNameMatching(pattern) + ); + return Create(_ruleCreator); + } + public TGivenRuleTypeConjunction DoNotHaveNameStartingWith(string pattern) { _ruleCreator.AddPredicate( diff --git a/ArchUnitNET/Fluent/Syntax/Elements/IObjectConditions.cs b/ArchUnitNET/Fluent/Syntax/Elements/IObjectConditions.cs index 09750ae1a..b9ec6f58a 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/IObjectConditions.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/IObjectConditions.cs @@ -10,17 +10,41 @@ public interface IObjectConditions where TRuleType : ICanBeAnalyzed { TReturnType Exist(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Be(Types().That().HaveFullName()) instead" + )] TReturnType Be(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Be(Types().That().HaveFullName()) instead" + )] TReturnType Be(IEnumerable patterns, bool useRegularExpressions = false); TReturnType Be(ICanBeAnalyzed firstObject, params ICanBeAnalyzed[] moreObjects); TReturnType Be(IEnumerable objects); TReturnType Be(IObjectProvider objects); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType CallAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType CallAny(IEnumerable patterns, bool useRegularExpressions = false); TReturnType CallAny(MethodMember method, params MethodMember[] moreMethods); TReturnType CallAny(IEnumerable methods); TReturnType CallAny(IObjectProvider methods); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType DependOnAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType DependOnAny(IEnumerable patterns, bool useRegularExpressions = false); TReturnType DependOnAny(IType firstType, params IType[] moreTypes); TReturnType DependOnAny(Type firstType, params Type[] moreTypes); @@ -37,14 +61,30 @@ TReturnType FollowCustomCondition( string description, string failDescription ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] TReturnType OnlyDependOn(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] TReturnType OnlyDependOn(IEnumerable patterns, bool useRegularExpressions = false); TReturnType OnlyDependOn(IType firstType, params IType[] moreTypes); TReturnType OnlyDependOn(Type firstType, params Type[] moreTypes); TReturnType OnlyDependOn(IObjectProvider types); TReturnType OnlyDependOn(IEnumerable types); TReturnType OnlyDependOn(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType HaveAnyAttributes(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType HaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -54,7 +94,15 @@ TReturnType HaveAnyAttributes( TReturnType HaveAnyAttributes(IObjectProvider attributes); TReturnType HaveAnyAttributes(IEnumerable attributes); TReturnType HaveAnyAttributes(IEnumerable attributes); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType OnlyHaveAttributes(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType OnlyHaveAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -69,10 +117,18 @@ TReturnType HaveAnyAttributesWithArguments( object firstArgumentValue, params object[] moreArgumentValues ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithArguments( string attribute, IEnumerable argumentValues ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -100,10 +156,18 @@ TReturnType HaveAnyAttributesWithNamedArguments( (string, object) firstAttributeArgument, params (string, object)[] moreAttributeArguments ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -127,8 +191,20 @@ TReturnType HaveAttributeWithNamedArguments( (string, object) firstAttributeArgument, params (string, object)[] moreAttributeArguments ); - TReturnType HaveName(string pattern, bool useRegularExpressions = false); - TReturnType HaveFullName(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either HaveName() without the useRegularExpressions parameter or HaveNameMatching() should be used" + )] + TReturnType HaveName(string pattern, bool useRegularExpressions); + TReturnType HaveName(string name); + TReturnType HaveNameMatching(string pattern); + + [Obsolete( + "Either HaveFullName() without the useRegularExpressions parameter or HaveFullNameMatching() should be used" + )] + TReturnType HaveFullName(string pattern, bool useRegularExpressions); + TReturnType HaveFullName(string fullName); + TReturnType HaveFullNameMatching(string pattern); TReturnType HaveNameStartingWith(string pattern); TReturnType HaveNameEndingWith(string pattern); TReturnType HaveNameContaining(string pattern); @@ -144,17 +220,41 @@ TReturnType HaveAttributeWithNamedArguments( TReturnType NotExist(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBe(Types().That().HaveFullName()) instead" + )] TReturnType NotBe(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBe(Types().That().HaveFullName()) instead" + )] TReturnType NotBe(IEnumerable patterns, bool useRegularExpressions = false); TReturnType NotBe(ICanBeAnalyzed firstObject, params ICanBeAnalyzed[] moreObjects); TReturnType NotBe(IEnumerable objects); TReturnType NotBe(IObjectProvider objects); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotCallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType NotCallAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotCallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType NotCallAny(IEnumerable patterns, bool useRegularExpressions = false); TReturnType NotCallAny(MethodMember method, params MethodMember[] moreMethods); TReturnType NotCallAny(IEnumerable methods); TReturnType NotCallAny(IObjectProvider methods); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotDependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType NotDependOnAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotDependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType NotDependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -164,7 +264,15 @@ TReturnType NotDependOnAny( TReturnType NotDependOnAny(IObjectProvider types); TReturnType NotDependOnAny(IEnumerable types); TReturnType NotDependOnAny(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType NotHaveAnyAttributes(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType NotHaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -225,8 +333,20 @@ TReturnType NotHaveAttributeWithNamedArguments( (string, object) firstAttributeArgument, params (string, object)[] moreAttributeArguments ); - TReturnType NotHaveName(string pattern, bool useRegularExpressions = false); - TReturnType NotHaveFullName(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either NotHaveName() without the useRegularExpressions parameter or NotHaveNameMatching() should be used" + )] + TReturnType NotHaveName(string pattern, bool useRegularExpressions); + TReturnType NotHaveName(string name); + TReturnType NotHaveNameMatching(string pattern); + + [Obsolete( + "Either NotHaveFullName() without the useRegularExpressions parameter or NotHaveFullNameMatching() should be used" + )] + TReturnType NotHaveFullName(string pattern, bool useRegularExpressions); + TReturnType NotHaveFullName(string fullName); + TReturnType NotHaveFullNameMatching(string pattern); TReturnType NotHaveNameStartingWith(string pattern); TReturnType NotHaveNameEndingWith(string pattern); TReturnType NotHaveNameContaining(string pattern); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/IObjectPredicates.cs b/ArchUnitNET/Fluent/Syntax/Elements/IObjectPredicates.cs index 739abe68d..baec6c04c 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/IObjectPredicates.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/IObjectPredicates.cs @@ -9,17 +9,40 @@ namespace ArchUnitNET.Fluent.Syntax.Elements public interface IObjectPredicates where TRuleType : ICanBeAnalyzed { + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] TReturnType Are(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] TReturnType Are(IEnumerable patterns, bool useRegularExpressions = false); TReturnType Are(ICanBeAnalyzed firstObject, params ICanBeAnalyzed[] moreObjects); TReturnType Are(IEnumerable objects); TReturnType Are(IObjectProvider objects); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType CallAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType CallAny(IEnumerable patterns, bool useRegularExpressions = false); TReturnType CallAny(MethodMember method, params MethodMember[] moreMethods); TReturnType CallAny(IEnumerable methods); TReturnType CallAny(IObjectProvider methods); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType DependOnAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType DependOnAny(IEnumerable patterns, bool useRegularExpressions = false); TReturnType DependOnAny(Type firstType, params Type[] moreTypes); TReturnType DependOnAny(IType firstType, params IType[] moreTypes); @@ -28,14 +51,30 @@ public interface IObjectPredicates TReturnType DependOnAny(IEnumerable types); TReturnType FollowCustomPredicate(IPredicate predicate); TReturnType FollowCustomPredicate(Func predicate, string description); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] TReturnType OnlyDependOn(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] TReturnType OnlyDependOn(IEnumerable patterns, bool useRegularExpressions = false); TReturnType OnlyDependOn(Type firstType, params Type[] moreTypes); TReturnType OnlyDependOn(IType firstType, params IType[] moreTypes); TReturnType OnlyDependOn(IObjectProvider types); TReturnType OnlyDependOn(IEnumerable types); TReturnType OnlyDependOn(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType HaveAnyAttributes(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType HaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -45,7 +84,15 @@ TReturnType HaveAnyAttributes( TReturnType HaveAnyAttributes(IObjectProvider attributes); TReturnType HaveAnyAttributes(IEnumerable attributes); TReturnType HaveAnyAttributes(IEnumerable attributes); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType OnlyHaveAttributes(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType OnlyHaveAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -60,10 +107,18 @@ TReturnType HaveAnyAttributesWithArguments( object firstArgumentValue, params object[] moreArgumentValues ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithArguments( string attribute, IEnumerable argumentValues ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -91,10 +146,18 @@ TReturnType HaveAnyAttributesWithNamedArguments( (string, object) firstAttributeArgument, params (string, object)[] moreAttributeArguments ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType HaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -118,8 +181,20 @@ TReturnType HaveAttributeWithNamedArguments( (string, object) firstAttributeArgument, params (string, object)[] moreAttributeArguments ); - TReturnType HaveName(string pattern, bool useRegularExpressions = false); - TReturnType HaveFullName(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either HaveName() without the useRegularExpressions parameter or HaveNameMatching() should be used" + )] + TReturnType HaveName(string pattern, bool useRegularExpressions); + TReturnType HaveName(string name); + TReturnType HaveNameMatching(string pattern); + + [Obsolete( + "Either HaveFullName() without the useRegularExpressions parameter or HaveFullNameMatching() should be used" + )] + TReturnType HaveFullName(string pattern, bool useRegularExpressions); + TReturnType HaveFullName(string fullName); + TReturnType HaveFullNameMatching(string pattern); TReturnType HaveNameStartingWith(string pattern); TReturnType HaveNameEndingWith(string pattern); TReturnType HaveNameContaining(string pattern); @@ -133,18 +208,40 @@ TReturnType HaveAttributeWithNamedArguments( //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] TReturnType AreNot(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] TReturnType AreNot(IEnumerable patterns, bool useRegularExpressions = false); TReturnType AreNot(ICanBeAnalyzed firstObject, params ICanBeAnalyzed[] moreObjects); TReturnType AreNot(IEnumerable objects); TReturnType AreNot(IObjectProvider objects); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType DoNotCallAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] TReturnType DoNotCallAny(IEnumerable patterns, bool useRegularExpressions = false); TReturnType DoNotCallAny(MethodMember method, params MethodMember[] moreMethods); TReturnType DoNotCallAny(IEnumerable methods); TReturnType DoNotCallAny(IObjectProvider methods); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType DoNotDependOnAny(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] TReturnType DoNotDependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -154,7 +251,15 @@ TReturnType DoNotDependOnAny( TReturnType DoNotDependOnAny(IObjectProvider types); TReturnType DoNotDependOnAny(IEnumerable types); TReturnType DoNotDependOnAny(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType DoNotHaveAnyAttributes(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] TReturnType DoNotHaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -172,10 +277,18 @@ TReturnType DoNotHaveAnyAttributesWithArguments( object firstArgumentValue, params object[] moreArgumentValues ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType DoNotHaveAttributeWithArguments( string attribute, IEnumerable argumentValues ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType DoNotHaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -206,10 +319,18 @@ TReturnType DoNotHaveAnyAttributesWithNamedArguments( (string, object) firstAttributeArgument, params (string, object)[] moreAttributeArguments ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType DoNotHaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType DoNotHaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -233,8 +354,20 @@ TReturnType DoNotHaveAttributeWithNamedArguments( (string, object) firstAttributeArgument, params (string, object)[] moreAttributeArguments ); - TReturnType DoNotHaveName(string pattern, bool useRegularExpressions = false); - TReturnType DoNotHaveFullName(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either DoNotHaveName() without the useRegularExpressions parameter or DoNotHaveNameMatching() should be used" + )] + TReturnType DoNotHaveName(string pattern, bool useRegularExpressions); + TReturnType DoNotHaveName(string name); + TReturnType DoNotHaveNameMatching(string pattern); + + [Obsolete( + "Either DoNotHaveFullName() without the useRegularExpressions parameter or DoNotHaveFullNameMatching() should be used" + )] + TReturnType DoNotHaveFullName(string pattern, bool useRegularExpressions); + TReturnType DoNotHaveFullName(string fullName); + TReturnType DoNotHaveFullNameMatching(string pattern); TReturnType DoNotHaveNameStartingWith(string pattern); TReturnType DoNotHaveNameEndingWith(string pattern); TReturnType DoNotHaveNameContaining(string pattern); diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs index 2aedb59df..d3796a48e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/GivenMembersThat.cs @@ -15,6 +15,9 @@ public class GivenMembersThat public GivenMembersThat(IArchRuleCreator ruleCreator) : base(ruleCreator) { } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreDeclaredIn( string pattern, bool useRegularExpressions = false @@ -26,6 +29,9 @@ public TGivenRuleTypeConjunction AreDeclaredIn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false @@ -91,7 +97,9 @@ public TGivenRuleTypeConjunction AreImmutable() //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreNotDeclaredIn( string pattern, bool useRegularExpressions = false @@ -106,6 +114,9 @@ public TGivenRuleTypeConjunction AreNotDeclaredIn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreNotDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberConditions.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberConditions.cs index d280753ee..7cfdb6216 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberConditions.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberConditions.cs @@ -8,7 +8,14 @@ public interface IMemberConditions : IObjectConditions where TRuleType : ICanBeAnalyzed { + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeDeclaredIn(Types().That().HaveFullName()) instead" + )] TReturnType BeDeclaredIn(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeDeclaredIn(Types().That().HaveFullName()) instead" + )] TReturnType BeDeclaredIn(IEnumerable patterns, bool useRegularExpressions = false); TReturnType BeDeclaredIn(IType firstType, params IType[] moreTypes); TReturnType BeDeclaredIn(Type firstType, params Type[] moreTypes); @@ -19,8 +26,14 @@ public interface IMemberConditions TReturnType BeImmutable(); //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeDeclaredIn(Types().That().HaveFullName()) instead" + )] TReturnType NotBeDeclaredIn(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeDeclaredIn(Types().That().HaveFullName()) instead" + )] TReturnType NotBeDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberPredicates.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberPredicates.cs index 3f3d2b867..9212e6423 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberPredicates.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/IMemberPredicates.cs @@ -8,7 +8,14 @@ public interface IMemberPredicates : IObjectPredicates where TRuleType : ICanBeAnalyzed { + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreDeclaredIn(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false @@ -24,7 +31,14 @@ TRuleTypeConjunction AreDeclaredIn( //Negations + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreNotDeclaredIn(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreNotDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberConditionsDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberConditionsDefinition.cs index 70b09eeb9..999b42383 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberConditionsDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberConditionsDefinition.cs @@ -11,6 +11,9 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Members public static class MemberConditionsDefinition where TRuleType : IMember { + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeDeclaredIn(Types().That().HaveFullName()) instead" + )] public static ICondition BeDeclaredIn( string pattern, bool useRegularExpressions = false @@ -27,6 +30,9 @@ public static ICondition BeDeclaredIn( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeDeclaredIn(Types().That().HaveFullName()) instead" + )] public static ICondition BeDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false @@ -253,7 +259,9 @@ public static RelationCondition BeDeclaredInTypesThat() //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeDeclaredIn(Types().That().HaveFullName()) instead" + )] public static ICondition NotBeDeclaredIn( string pattern, bool useRegularExpressions = false @@ -270,6 +278,9 @@ public static ICondition NotBeDeclaredIn( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeDeclaredIn(Types().That().HaveFullName()) instead" + )] public static ICondition NotBeDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false @@ -487,7 +498,6 @@ public static ICondition NotBeImmutable() //Relation Condition Negations - public static RelationCondition NotBeDeclaredInTypesThat() { return new RelationCondition( diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberPredicatesDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberPredicatesDefinition.cs index 04724d1fa..add62596c 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberPredicatesDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MemberPredicatesDefinition.cs @@ -11,6 +11,9 @@ namespace ArchUnitNET.Fluent.Syntax.Elements.Members public static class MemberPredicatesDefinition where T : IMember { + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] public static IPredicate AreDeclaredIn( string pattern, bool useRegularExpressions = false @@ -26,6 +29,9 @@ public static IPredicate AreDeclaredIn( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] public static IPredicate AreDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false @@ -189,7 +195,9 @@ public static IPredicate AreImmutable() //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNotDeclaredIn( string pattern, bool useRegularExpressions = false @@ -205,6 +213,9 @@ public static IPredicate AreNotDeclaredIn( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNotDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs index 5e030df1e..2b1061917 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MembersShould.cs @@ -16,6 +16,9 @@ public class MembersShould public MembersShould(IArchRuleCreator ruleCreator) : base(ruleCreator) { } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction BeDeclaredIn( string pattern, bool useRegularExpressions = false @@ -27,6 +30,9 @@ public TRuleTypeShouldConjunction BeDeclaredIn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction BeDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false @@ -109,7 +115,9 @@ public ShouldRelateToTypesThat< //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotBeDeclaredIn( string pattern, bool useRegularExpressions = false @@ -124,6 +132,9 @@ public TRuleTypeShouldConjunction NotBeDeclaredIn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotBeDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs index ebdab6aa6..f00b55913 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/GivenMethodMembersThat.cs @@ -23,6 +23,9 @@ public GivenMethodMembersConjunction AreVirtual() return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction AreCalledBy( string pattern, bool useRegularExpressions = false @@ -34,6 +37,9 @@ public GivenMethodMembersConjunction AreCalledBy( return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction AreCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -79,6 +85,9 @@ public GivenMethodMembersConjunction AreCalledBy(IEnumerable types) return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction HaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -93,6 +102,9 @@ public GivenMethodMembersConjunction HaveDependencyInMethodBodyTo( return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction HaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -155,6 +167,9 @@ public GivenMethodMembersConjunction HaveDependencyInMethodBodyTo(IEnumerable patterns, bool useRegularExpressions = false @@ -229,6 +247,9 @@ public GivenMethodMembersConjunction AreNotVirtual() return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction AreNotCalledBy( string pattern, bool useRegularExpressions = false @@ -240,6 +261,9 @@ public GivenMethodMembersConjunction AreNotCalledBy( return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction AreNotCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -288,6 +312,9 @@ public GivenMethodMembersConjunction AreNotCalledBy(IEnumerable types) return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction DoNotHaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -302,6 +329,9 @@ public GivenMethodMembersConjunction DoNotHaveDependencyInMethodBodyTo( return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction DoNotHaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -371,6 +401,9 @@ IEnumerable types return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction DoNotHaveReturnType( string pattern, bool useRegularExpressions = false @@ -382,6 +415,9 @@ public GivenMethodMembersConjunction DoNotHaveReturnType( return new GivenMethodMembersConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] public GivenMethodMembersConjunction DoNotHaveReturnType( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberConditions.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberConditions.cs index 553561830..4509e8ab9 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberConditions.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberConditions.cs @@ -10,17 +10,33 @@ public interface IMethodMemberConditions { TReturnType BeConstructor(); TReturnType BeVirtual(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeCalledBy(Types().That().HaveFullName()) instead" + )] TReturnType BeCalledBy(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeCalledBy(Types().That().HaveFullName()) instead" + )] TReturnType BeCalledBy(IEnumerable patterns, bool useRegularExpressions = false); TReturnType BeCalledBy(IType firstType, params IType[] moreTypes); TReturnType BeCalledBy(Type type, params Type[] moreTypes); TReturnType BeCalledBy(IObjectProvider types); TReturnType BeCalledBy(IEnumerable types); TReturnType BeCalledBy(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TReturnType HaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TReturnType HaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -30,7 +46,15 @@ TReturnType HaveDependencyInMethodBodyTo( TReturnType HaveDependencyInMethodBodyTo(IObjectProvider types); TReturnType HaveDependencyInMethodBodyTo(IEnumerable types); TReturnType HaveDependencyInMethodBodyTo(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] TReturnType HaveReturnType(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] TReturnType HaveReturnType( IEnumerable patterns, bool useRegularExpressions = false @@ -46,17 +70,33 @@ TReturnType HaveReturnType( TReturnType BeNoConstructor(); TReturnType NotBeVirtual(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeCalledBy(Types().That().HaveFullName()) instead" + )] TReturnType NotBeCalledBy(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeCalledBy(Types().That().HaveFullName()) instead" + )] TReturnType NotBeCalledBy(IEnumerable patterns, bool useRegularExpressions = false); TReturnType NotBeCalledBy(IType firstType, params IType[] moreTypes); TReturnType NotBeCalledBy(Type type, params Type[] moreTypes); TReturnType NotBeCalledBy(IObjectProvider types); TReturnType NotBeCalledBy(IEnumerable types); TReturnType NotBeCalledBy(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TReturnType NotHaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TReturnType NotHaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -66,7 +106,15 @@ TReturnType NotHaveDependencyInMethodBodyTo( TReturnType NotHaveDependencyInMethodBodyTo(IObjectProvider types); TReturnType NotHaveDependencyInMethodBodyTo(IEnumerable types); TReturnType NotHaveDependencyInMethodBodyTo(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveReturnType(Types().That().HaveFullName()) instead" + )] TReturnType NotHaveReturnType(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveReturnType(Types().That().HaveFullName()) instead" + )] TReturnType NotHaveReturnType( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberPredicates.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberPredicates.cs index 17c69ee09..7b7d607b9 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberPredicates.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/IMethodMemberPredicates.cs @@ -10,7 +10,15 @@ public interface IMethodMemberPredicates { TRuleTypeConjunction AreConstructors(); TRuleTypeConjunction AreVirtual(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreCalledBy(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -20,11 +28,18 @@ TRuleTypeConjunction AreCalledBy( TRuleTypeConjunction AreCalledBy(IObjectProvider types); TRuleTypeConjunction AreCalledBy(IEnumerable types); TRuleTypeConjunction AreCalledBy(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction HaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false ); + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction HaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -38,7 +53,15 @@ params IType[] moreTypes TRuleTypeConjunction HaveDependencyInMethodBodyTo(IObjectProvider types); TRuleTypeConjunction HaveDependencyInMethodBodyTo(IEnumerable types); TRuleTypeConjunction HaveDependencyInMethodBodyTo(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction HaveReturnType(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction HaveReturnType( IEnumerable patterns, bool useRegularExpressions = false @@ -54,7 +77,15 @@ TRuleTypeConjunction HaveReturnType( TRuleTypeConjunction AreNoConstructors(); TRuleTypeConjunction AreNotVirtual(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreNotCalledBy(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction AreNotCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -64,11 +95,18 @@ TRuleTypeConjunction AreNotCalledBy( TRuleTypeConjunction AreNotCalledBy(IObjectProvider types); TRuleTypeConjunction AreNotCalledBy(IEnumerable types); TRuleTypeConjunction AreNotCalledBy(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction DoNotHaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false ); + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction DoNotHaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -83,10 +121,17 @@ params IType[] moreTypes TRuleTypeConjunction DoNotHaveDependencyInMethodBodyTo(IEnumerable types); TRuleTypeConjunction DoNotHaveDependencyInMethodBodyTo(IEnumerable types); + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction DoNotHaveReturnType( string pattern, bool useRegularExpressions = false ); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] TRuleTypeConjunction DoNotHaveReturnType( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberConditionsDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberConditionsDefinition.cs index 65f6cfdfb..1966a8fdf 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberConditionsDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberConditionsDefinition.cs @@ -28,6 +28,9 @@ public static ICondition BeVirtual() ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeCalledBy(Types().That().HaveFullName()) instead" + )] public static ICondition BeCalledBy( string pattern, bool useRegularExpressions = false @@ -48,6 +51,9 @@ public static ICondition BeCalledBy( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeCalledBy(Types().That().HaveFullName()) instead" + )] public static ICondition BeCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -273,6 +279,9 @@ Architecture architecture return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static ICondition HaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -293,6 +302,9 @@ public static ICondition HaveDependencyInMethodBodyTo( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static ICondition HaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -552,6 +564,9 @@ Architecture architecture return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] public static ICondition HaveReturnType( string pattern, bool useRegularExpressions = false @@ -578,6 +593,9 @@ public static ICondition HaveReturnType( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] public static ICondition HaveReturnType( IEnumerable patterns, bool useRegularExpressions = false @@ -627,7 +645,7 @@ public static ICondition HaveReturnType(IEnumerable types) bool Condition(MethodMember member) { - return typeList.Any(type => member.ReturnType.FullNameMatches(type.FullName)); + return typeList.Any(type => member.ReturnType.FullNameEquals(type.FullName)); } return new SimpleCondition( @@ -648,7 +666,7 @@ Architecture architecture var methodMemberList = methodMembers.ToList(); var passedObjects = methodMemberList .Where(methodMember => - typeList.Any(type => methodMember.ReturnType.FullNameMatches(type.FullName)) + typeList.Any(type => methodMember.ReturnType.FullNameEquals(type.FullName)) ) .ToList(); foreach (var failedObject in methodMemberList.Except(passedObjects)) @@ -720,6 +738,9 @@ public static ICondition NotBeVirtual() ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeCalledBy(Types().That().HaveFullName()) instead" + )] public static ICondition NotBeCalledBy( string pattern, bool useRegularExpressions = false @@ -756,6 +777,9 @@ var type in member ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeCalledBy(Types().That().HaveFullName()) instead" + )] public static ICondition NotBeCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -987,6 +1011,9 @@ Architecture architecture return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static ICondition NotHaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -1023,6 +1050,9 @@ var type in member ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static ICondition NotHaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -1144,7 +1174,7 @@ IEnumerable types IEnumerable Condition(IEnumerable methodMembers) { var methodMemberList = methodMembers.ToList(); - var passedObjects = methodMemberList + var failedObjects = methodMemberList .Where(methodMember => methodMember .GetBodyTypeMemberDependencies() @@ -1157,27 +1187,27 @@ IEnumerable Condition(IEnumerable methodMembers) if (typeList.IsNullOrEmpty()) { failDescription = - "does not have dependencies in method body to one of no types (always true)"; + "does have dependencies in method body to one of no types (always false)"; } else { failDescription = typeList - .Where(type => !type.Equals(firstType)) + .Where(type => !Equals(type, firstType)) .Distinct() .Aggregate( - "does not have dependencies in method body to \"" + "does have dependencies in method body to \"" + firstType.FullName + "\"", (current, type) => current + " or \"" + type.FullName + "\"" ); } - foreach (var failedObject in methodMemberList.Except(passedObjects)) + foreach (var failedObject in failedObjects) { yield return new ConditionResult(failedObject, false, failDescription); } - foreach (var passedObject in passedObjects) + foreach (var passedObject in methodMemberList.Except(failedObjects)) { yield return new ConditionResult(passedObject, true); } @@ -1186,15 +1216,16 @@ IEnumerable Condition(IEnumerable methodMembers) string description; if (typeList.IsNullOrEmpty()) { - description = "have dependencies in method body to one of no types (always false)"; + description = + "not have dependencies in method body to one of no types (always true)"; } else { description = typeList - .Where(type => !type.Equals(firstType)) + .Where(type => !Equals(type, firstType)) .Distinct() .Aggregate( - "have dependencies in method body to \"" + firstType.FullName + "\"", + "not have dependencies in method body to \"" + firstType.FullName + "\"", (current, type) => current + " or \"" + type.FullName + "\"" ); } @@ -1287,6 +1318,9 @@ Architecture architecture return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveReturnType(Types().That().HaveFullName()) instead" + )] public static ICondition NotHaveReturnType( string pattern, bool useRegularExpressions = false @@ -1313,6 +1347,9 @@ public static ICondition NotHaveReturnType( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveReturnType(Types().That().HaveFullName()) instead" + )] public static ICondition NotHaveReturnType( IEnumerable patterns, bool useRegularExpressions = false @@ -1362,7 +1399,7 @@ public static ICondition NotHaveReturnType(IEnumerable type bool Condition(MethodMember member) { - return typeList.All(type => !member.ReturnType.FullNameMatches(type.FullName)); + return typeList.All(type => !member.ReturnType.FullNameEquals(type.FullName)); } return new SimpleCondition( @@ -1383,9 +1420,7 @@ Architecture architecture var methodMemberList = methodMembers.ToList(); var passedObjects = methodMemberList .Where(methodMember => - typeList.All(type => - !methodMember.ReturnType.FullNameMatches(type.FullName) - ) + typeList.All(type => !methodMember.ReturnType.FullNameEquals(type.FullName)) ) .ToList(); foreach (var failedObject in methodMemberList.Except(passedObjects)) diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberPredicatesDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberPredicatesDefinition.cs index eb4156020..a57f3822d 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberPredicatesDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberPredicatesDefinition.cs @@ -23,6 +23,9 @@ public static IPredicate AreVirtual() return new SimplePredicate(member => member.IsVirtual, "are virtual"); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] public static IPredicate AreCalledBy( string pattern, bool useRegularExpressions = false @@ -38,6 +41,9 @@ public static IPredicate AreCalledBy( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] public static IPredicate AreCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -184,6 +190,9 @@ Architecture architecture return new ArchitecturePredicate(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static IPredicate HaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -199,6 +208,9 @@ public static IPredicate HaveDependencyInMethodBodyTo( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static IPredicate HaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -365,6 +377,9 @@ Architecture architecture return new ArchitecturePredicate(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] public static IPredicate HaveReturnType( string pattern, bool useRegularExpressions = false @@ -380,6 +395,9 @@ public static IPredicate HaveReturnType( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] public static IPredicate HaveReturnType( IEnumerable patterns, bool useRegularExpressions = false @@ -420,7 +438,7 @@ public static IPredicate HaveReturnType(IEnumerable types) "have return type \"" + string.Join("\" or \"", typeStringList) + "\""; return new SimplePredicate( - member => typeList.Any(type => member.ReturnType.FullNameMatches(type.FullName)), + member => typeList.Any(type => member.ReturnType.FullNameEquals(type.FullName)), description ); } @@ -435,7 +453,7 @@ Architecture architecture var typeList = types.GetObjects(architecture).ToList(); var methodMemberList = methodMembers.ToList(); return methodMemberList.Where(methodMember => - typeList.Any(type => methodMember.ReturnType.FullNameMatches(type.FullName)) + typeList.Any(type => methodMember.ReturnType.FullNameEquals(type.FullName)) ); } @@ -485,6 +503,9 @@ public static IPredicate AreNotVirtual() ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNotCalledBy( string pattern, bool useRegularExpressions = false @@ -500,6 +521,9 @@ public static IPredicate AreNotCalledBy( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNotCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -649,6 +673,9 @@ Architecture architecture return new ArchitecturePredicate(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static IPredicate DoNotHaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -664,6 +691,9 @@ public static IPredicate DoNotHaveDependencyInMethodBodyTo( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public static IPredicate DoNotHaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -836,6 +866,9 @@ Architecture architecture return new ArchitecturePredicate(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] public static IPredicate DoNotHaveReturnType( string pattern, bool useRegularExpressions = false @@ -851,6 +884,9 @@ public static IPredicate DoNotHaveReturnType( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] public static IPredicate DoNotHaveReturnType( IEnumerable patterns, bool useRegularExpressions = false @@ -891,7 +927,7 @@ public static IPredicate DoNotHaveReturnType(IEnumerable ty "do not have return type \"" + string.Join("\" or \"", typeStringList) + "\""; return new SimplePredicate( - member => typeList.Any(type => !member.ReturnType.FullNameMatches(type.FullName)), + member => typeList.Any(type => !member.ReturnType.FullNameEquals(type.FullName)), description ); } @@ -906,7 +942,7 @@ Architecture architecture var typeList = types.GetObjects(architecture).ToList(); var methodMemberList = methodMembers.ToList(); return methodMemberList.Where(methodMember => - typeList.All(type => !methodMember.ReturnType.FullNameMatches(type.FullName)) + typeList.All(type => !methodMember.ReturnType.FullNameEquals(type.FullName)) ); } diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs index 9e8915778..05655c6e0 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMembersShould.cs @@ -23,6 +23,9 @@ public MethodMembersShouldConjunction BeVirtual() return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeCalledBy(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction BeCalledBy( string pattern, bool useRegularExpressions = false @@ -34,6 +37,9 @@ public MethodMembersShouldConjunction BeCalledBy( return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeCalledBy(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction BeCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -77,6 +83,9 @@ public MethodMembersShouldConjunction BeCalledBy(IEnumerable types) return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction HaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -91,6 +100,9 @@ public MethodMembersShouldConjunction HaveDependencyInMethodBodyTo( return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction HaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -153,6 +165,9 @@ public MethodMembersShouldConjunction HaveDependencyInMethodBodyTo(IEnumerable patterns, bool useRegularExpressions = false @@ -227,6 +245,9 @@ public MethodMembersShouldConjunction NotBeVirtual() return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeCalledBy(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction NotBeCalledBy( string pattern, bool useRegularExpressions = false @@ -238,6 +259,9 @@ public MethodMembersShouldConjunction NotBeCalledBy( return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeCalledBy(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction NotBeCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -286,6 +310,9 @@ public MethodMembersShouldConjunction NotBeCalledBy(IEnumerable types) return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction NotHaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -300,6 +327,9 @@ public MethodMembersShouldConjunction NotHaveDependencyInMethodBodyTo( return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction NotHaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -369,6 +399,9 @@ IEnumerable types return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveReturnType(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction NotHaveReturnType( string pattern, bool useRegularExpressions = false @@ -380,6 +413,9 @@ public MethodMembersShouldConjunction NotHaveReturnType( return new MethodMembersShouldConjunction(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveReturnType(Types().That().HaveFullName()) instead" + )] public MethodMembersShouldConjunction NotHaveReturnType( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs index 30b24c26b..ce69f4af2 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/ShouldRelateToMethodMembersThat.cs @@ -28,6 +28,9 @@ public TRuleTypeShouldConjunction AreVirtual() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreCalledBy( string pattern, bool useRegularExpressions = false @@ -39,6 +42,9 @@ public TRuleTypeShouldConjunction AreCalledBy( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreCalledBy(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -90,6 +96,9 @@ public TRuleTypeShouldConjunction AreCalledBy(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -104,6 +113,9 @@ public TRuleTypeShouldConjunction HaveDependencyInMethodBodyTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -164,6 +176,9 @@ public TRuleTypeShouldConjunction HaveDependencyInMethodBodyTo(IEnumerable return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveReturnType( string pattern, bool useRegularExpressions = false @@ -175,6 +190,9 @@ public TRuleTypeShouldConjunction HaveReturnType( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveReturnType(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveReturnType( IEnumerable patterns, bool useRegularExpressions = false @@ -243,6 +261,9 @@ public TRuleTypeShouldConjunction AreNotVirtual() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNotCalledBy( string pattern, bool useRegularExpressions = false @@ -254,6 +275,9 @@ public TRuleTypeShouldConjunction AreNotCalledBy( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotCalledBy(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNotCalledBy( IEnumerable patterns, bool useRegularExpressions = false @@ -305,6 +329,9 @@ public TRuleTypeShouldConjunction AreNotCalledBy(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotHaveDependencyInMethodBodyTo( string pattern, bool useRegularExpressions = false @@ -319,6 +346,9 @@ public TRuleTypeShouldConjunction DoNotHaveDependencyInMethodBodyTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveDependencyInMethodBodyTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotHaveDependencyInMethodBodyTo( IEnumerable patterns, bool useRegularExpressions = false @@ -386,6 +416,9 @@ public TRuleTypeShouldConjunction DoNotHaveDependencyInMethodBodyTo(IEnumerable< return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotHaveReturnType( string pattern, bool useRegularExpressions = false @@ -397,6 +430,9 @@ public TRuleTypeShouldConjunction DoNotHaveReturnType( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveReturnType(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotHaveReturnType( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs index 2603cc9e1..ab3673602 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Members/ShouldRelateToMembersThat.cs @@ -15,6 +15,9 @@ public class ShouldRelateToMembersThat ruleCreator) : base(ruleCreator) { } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreDeclaredIn( string pattern, bool useRegularExpressions = false @@ -29,6 +32,9 @@ public TRuleTypeShouldConjunction AreDeclaredIn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false @@ -109,7 +115,9 @@ public TRuleTypeShouldConjunction AreImmutable() //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNotDeclaredIn( string pattern, bool useRegularExpressions = false @@ -124,6 +132,9 @@ public TRuleTypeShouldConjunction AreNotDeclaredIn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotDeclaredIn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNotDeclaredIn( IEnumerable patterns, bool useRegularExpressions = false diff --git a/ArchUnitNET/Fluent/Syntax/Elements/ObjectConditionsDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/ObjectConditionsDefinition.cs index e2101f903..2aa164514 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/ObjectConditionsDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/ObjectConditionsDefinition.cs @@ -19,6 +19,9 @@ public static ICondition Exist() return new ExistsCondition(true); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Be(Types().That().HaveFullName()) instead" + )] public static ICondition Be(string pattern, bool useRegularExpressions = false) { return new SimpleCondition( @@ -36,6 +39,9 @@ public static ICondition Be(string pattern, bool useRegularExpression ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Be(Types().That().HaveFullName()) instead" + )] public static ICondition Be( IEnumerable patterns, bool useRegularExpressions = false @@ -173,6 +179,9 @@ Architecture architecture ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public static ICondition CallAny( string pattern, bool useRegularExpressions = false @@ -193,6 +202,9 @@ public static ICondition CallAny( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public static ICondition CallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -342,6 +354,9 @@ IEnumerable Condition(IEnumerable ruleTypes) return new EnumerableCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public static ICondition DependOnAny( string pattern, bool useRegularExpressions = false @@ -362,6 +377,9 @@ public static ICondition DependOnAny( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public static ICondition DependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -606,6 +624,9 @@ string failDescription return new SimpleCondition(condition, description, failDescription); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public static ICondition OnlyDependOn( string pattern, bool useRegularExpressions = false @@ -639,6 +660,9 @@ ConditionResult Condition(TRuleType ruleType) ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public static ICondition OnlyDependOn( IEnumerable patterns, bool useRegularExpressions = false @@ -869,6 +893,9 @@ var type in failedObject.GetTypeDependencies().Except(archUnitTypeList) return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public static ICondition HaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -889,6 +916,9 @@ public static ICondition HaveAnyAttributes( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public static ICondition HaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -1101,6 +1131,9 @@ Architecture architecture return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public static ICondition OnlyHaveAttributes( string pattern, bool useRegularExpressions = false @@ -1121,6 +1154,9 @@ public static ICondition OnlyHaveAttributes( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public static ICondition OnlyHaveAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -1363,6 +1399,9 @@ params object[] moreArgumentValues return HaveAnyAttributesWithArguments(argumentValues); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition HaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -1406,6 +1445,9 @@ public static ICondition HaveAnyAttributesWithNamedArguments( return HaveAnyAttributesWithNamedArguments(attributeArguments); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition HaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -1517,6 +1559,9 @@ bool Condition(TRuleType obj, Architecture architecture) return new ArchitectureCondition(Condition, failDescription, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition HaveAttributeWithArguments( [NotNull] string attribute, IEnumerable argumentValues @@ -1862,6 +1907,9 @@ bool Condition(TRuleType obj, Architecture architecture) return new ArchitectureCondition(Condition, failDescription, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition HaveAttributeWithNamedArguments( [NotNull] string attribute, IEnumerable<(string, object)> attributeArguments @@ -2146,10 +2194,10 @@ bool Condition(TRuleType obj, Architecture architecture) return new ArchitectureCondition(Condition, description, failDescription); } - public static ICondition HaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either HaveName() without the useRegularExpressions parameter or HaveNameMatching() should be used" + )] + public static ICondition HaveName(string pattern, bool useRegularExpressions) { return new SimpleCondition( obj => obj.NameMatches(pattern, useRegularExpressions), @@ -2162,10 +2210,28 @@ public static ICondition HaveName( ); } - public static ICondition HaveFullName( - string pattern, - bool useRegularExpressions = false - ) + public static ICondition HaveName(string name) + { + return new SimpleCondition( + obj => obj.NameEquals(name), + obj => "does have name " + obj.Name, + $"have name \"{name}\"" + ); + } + + public static ICondition HaveNameMatching(string pattern) + { + return new SimpleCondition( + obj => obj.NameMatches(pattern), + obj => "does have name " + obj.Name, + $"have name matching \"{pattern}\"" + ); + } + + [Obsolete( + "Either HaveFullName() without the useRegularExpressions parameter or HaveFullNameMatching() should be used" + )] + public static ICondition HaveFullName(string pattern, bool useRegularExpressions) { return new SimpleCondition( obj => obj.FullNameMatches(pattern, useRegularExpressions), @@ -2178,6 +2244,24 @@ public static ICondition HaveFullName( ); } + public static ICondition HaveFullName(string name) + { + return new SimpleCondition( + obj => obj.FullNameEquals(name), + obj => "does have full name " + obj.FullName, + "have full name \"" + name + "\"" + ); + } + + public static ICondition HaveFullNameMatching(string pattern) + { + return new SimpleCondition( + obj => obj.FullNameMatches(pattern), + obj => "does have full name " + obj.FullName, + "have full name matching \"" + pattern + "\"" + ); + } + public static ICondition HaveNameStartingWith(string pattern) { return new SimpleCondition( @@ -2315,6 +2399,9 @@ public static ICondition NotExist() return new ExistsCondition(false); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBe(Types().That().HaveFullName()) instead" + )] public static ICondition NotBe( string pattern, bool useRegularExpressions = false @@ -2331,6 +2418,9 @@ public static ICondition NotBe( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBe(Types().That().HaveFullName()) instead" + )] public static ICondition NotBe( IEnumerable patterns, bool useRegularExpressions = false @@ -2452,6 +2542,9 @@ Architecture architecture ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public static ICondition NotCallAny( string pattern, bool useRegularExpressions = false @@ -2485,6 +2578,9 @@ ConditionResult Condition(TRuleType ruleType) ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public static ICondition NotCallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -2636,6 +2732,9 @@ IEnumerable Condition(IEnumerable ruleTypes) return new EnumerableCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotDependOnAny(Types().That().HaveFullName()) instead" + )] public static ICondition NotDependOnAny( string pattern, bool useRegularExpressions = false @@ -2669,6 +2768,9 @@ ConditionResult Condition(TRuleType ruleType) ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotDependOnAny(Types().That().HaveFullName()) instead" + )] public static ICondition NotDependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -2897,6 +2999,9 @@ var type in failedObject.GetTypeDependencies().Intersect(archUnitTypeList) return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition NotHaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -2917,6 +3022,9 @@ public static ICondition NotHaveAnyAttributes( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition NotHaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -3160,6 +3268,9 @@ params object[] moreArgumentValues return NotHaveAnyAttributesWithArguments(argumentValues); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition NotHaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -3203,6 +3314,9 @@ public static ICondition NotHaveAnyAttributesWithNamedArguments( return NotHaveAnyAttributesWithNamedArguments(attributeArguments); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition NotHaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -3314,6 +3428,9 @@ bool Condition(TRuleType obj, Architecture architecture) return new ArchitectureCondition(Condition, failDescription, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition NotHaveAttributeWithArguments( [NotNull] string attribute, IEnumerable argumentValues @@ -3661,6 +3778,9 @@ t.Value is ITypeInstance typeInstance return new ArchitectureCondition(Condition, failDescription, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition NotHaveAttributeWithNamedArguments( [NotNull] string attribute, IEnumerable<(string, object)> attributeArguments @@ -3945,10 +4065,10 @@ bool Condition(TRuleType obj, Architecture architecture) return new ArchitectureCondition(Condition, failDescription, description); } - public static ICondition NotHaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either NotHaveName() without the useRegularExpressions parameter or NotHaveNameMatching() should be used" + )] + public static ICondition NotHaveName(string pattern, bool useRegularExpressions) { return new SimpleCondition( obj => !obj.NameMatches(pattern, useRegularExpressions), @@ -3961,9 +4081,30 @@ public static ICondition NotHaveName( ); } + public static ICondition NotHaveName(string name) + { + return new SimpleCondition( + obj => !obj.NameEquals(name), + obj => "does have name " + obj.Name, + $"not have name \"{name}\"" + ); + } + + public static ICondition NotHaveNameMatching(string pattern) + { + return new SimpleCondition( + obj => !obj.NameMatches(pattern), + obj => "does have name " + obj.Name, + $"not have name matching \"{pattern}\"" + ); + } + + [Obsolete( + "Either NotHaveFullName() without the useRegularExpressions parameter or NotHaveFullNameMatching() should be used" + )] public static ICondition NotHaveFullName( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return new SimpleCondition( @@ -3977,6 +4118,24 @@ public static ICondition NotHaveFullName( ); } + public static ICondition NotHaveFullName(string fullName) + { + return new SimpleCondition( + obj => !obj.FullNameEquals(fullName), + obj => "does have full name " + obj.FullName, + "not have full name \"" + fullName + "\"" + ); + } + + public static ICondition NotHaveFullNameMatching(string pattern) + { + return new SimpleCondition( + obj => !obj.FullNameMatches(pattern), + obj => "does have full name " + obj.FullName, + "not have full name matching \"" + pattern + "\"" + ); + } + public static ICondition NotHaveNameStartingWith(string pattern) { return new SimpleCondition( diff --git a/ArchUnitNET/Fluent/Syntax/Elements/ObjectPredicatesDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/ObjectPredicatesDefinition.cs index 0d4fbe9e5..e42d9cb14 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/ObjectPredicatesDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/ObjectPredicatesDefinition.cs @@ -14,6 +14,9 @@ namespace ArchUnitNET.Fluent.Syntax.Elements public static class ObjectPredicatesDefinition where T : ICanBeAnalyzed { + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] public static IPredicate Are(string pattern, bool useRegularExpressions = false) { return new SimplePredicate( @@ -26,6 +29,9 @@ public static IPredicate Are(string pattern, bool useRegularExpressions = fal ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] public static IPredicate Are( IEnumerable patterns, bool useRegularExpressions = false @@ -111,6 +117,9 @@ IEnumerable Filter(IEnumerable objects, Architecture architecture) return new ArchitecturePredicate(Filter, "are " + objectProvider.Description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public static IPredicate CallAny(string pattern, bool useRegularExpressions = false) { return new SimplePredicate( @@ -123,6 +132,9 @@ public static IPredicate CallAny(string pattern, bool useRegularExpressions = ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public static IPredicate CallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -207,6 +219,9 @@ IEnumerable Filter(IEnumerable objects) return new EnumerablePredicate(Filter, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public static IPredicate DependOnAny(string pattern, bool useRegularExpressions = false) { return new SimplePredicate( @@ -219,6 +234,9 @@ public static IPredicate DependOnAny(string pattern, bool useRegularExpressio ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public static IPredicate DependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -368,6 +386,9 @@ string description return new SimplePredicate(predicate, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public static IPredicate OnlyDependOn(string pattern, bool useRegularExpressions = false) { return new SimplePredicate( @@ -380,6 +401,9 @@ public static IPredicate OnlyDependOn(string pattern, bool useRegularExpressi ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public static IPredicate OnlyDependOn( IEnumerable patterns, bool useRegularExpressions = false @@ -525,6 +549,9 @@ IEnumerable Filter(IEnumerable objects, Architecture architecture) return new ArchitecturePredicate(Filter, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public static IPredicate HaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -540,6 +567,9 @@ public static IPredicate HaveAnyAttributes( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public static IPredicate HaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -671,6 +701,9 @@ IEnumerable Filter(IEnumerable objects, Architecture architecture) return new ArchitecturePredicate(Filter, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public static IPredicate OnlyHaveAttributes( string pattern, bool useRegularExpressions = false @@ -686,6 +719,9 @@ public static IPredicate OnlyHaveAttributes( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public static IPredicate OnlyHaveAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -841,6 +877,9 @@ params object[] moreArgumentValues return HaveAnyAttributesWithArguments(argumentValues); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate HaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -884,6 +923,9 @@ public static IPredicate HaveAnyAttributesWithNamedArguments( return HaveAnyAttributesWithNamedArguments(attributeArguments); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate HaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -971,6 +1013,9 @@ bool Predicate(T obj, Architecture architecture) return new ArchitecturePredicate(Predicate, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate HaveAttributeWithArguments( [NotNull] string attribute, IEnumerable argumentValues @@ -1254,6 +1299,9 @@ bool Predicate(T obj, Architecture architecture) return new ArchitecturePredicate(Predicate, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate HaveAttributeWithNamedArguments( [NotNull] string attribute, IEnumerable<(string, object)> attributeArguments @@ -1496,7 +1544,10 @@ bool Predicate(T obj, Architecture architecture) return new ArchitecturePredicate(Predicate, description); } - public static IPredicate HaveName(string pattern, bool useRegularExpressions = false) + [Obsolete( + "Either HaveName() without the useRegularExpressions parameter or HaveNameMatching() should be used" + )] + public static IPredicate HaveName(string pattern, bool useRegularExpressions) { return new SimplePredicate( obj => obj.NameMatches(pattern, useRegularExpressions), @@ -1504,7 +1555,26 @@ public static IPredicate HaveName(string pattern, bool useRegularExpressions ); } - public static IPredicate HaveFullName(string pattern, bool useRegularExpressions = false) + public static IPredicate HaveName(string name) + { + return new SimplePredicate( + obj => obj.NameEquals(name), + "have name \"" + name + "\"" + ); + } + + public static IPredicate HaveNameMatching(string pattern) + { + return new SimplePredicate( + obj => obj.NameMatches(pattern), + "have name matching \"" + pattern + "\"" + ); + } + + [Obsolete( + "Either HaveFullName() without the useRegularExpressions parameter or HaveFullNameMatching() should be used" + )] + public static IPredicate HaveFullName(string pattern, bool useRegularExpressions) { return new SimplePredicate( obj => obj.FullNameMatches(pattern, useRegularExpressions), @@ -1516,6 +1586,22 @@ public static IPredicate HaveFullName(string pattern, bool useRegularExpressi ); } + public static IPredicate HaveFullName(string fullName) + { + return new SimplePredicate( + obj => obj.FullNameEquals(fullName), + "have full name \"" + fullName + "\"" + ); + } + + public static IPredicate HaveFullNameMatching(string pattern) + { + return new SimplePredicate( + obj => obj.FullNameMatches(pattern), + "have full name matching \"" + pattern + "\"" + ); + } + public static IPredicate HaveNameStartingWith(string pattern) { return new SimplePredicate( @@ -1586,7 +1672,9 @@ public static IPredicate ArePrivateProtected() //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNot(string pattern, bool useRegularExpressions = false) { return new SimplePredicate( @@ -1599,6 +1687,9 @@ public static IPredicate AreNot(string pattern, bool useRegularExpressions = ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNot( IEnumerable patterns, bool useRegularExpressions = false @@ -1683,6 +1774,9 @@ IEnumerable Filter(IEnumerable objects, Architecture architecture) return new ArchitecturePredicate(Filter, "are not " + objectProvider.Description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public static IPredicate DoNotCallAny(string pattern, bool useRegularExpressions = false) { return new SimplePredicate( @@ -1695,6 +1789,9 @@ public static IPredicate DoNotCallAny(string pattern, bool useRegularExpressi ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public static IPredicate DoNotCallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -1784,6 +1881,9 @@ IEnumerable Filter(IEnumerable objects) return new EnumerablePredicate(Filter, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] public static IPredicate DoNotDependOnAny( string pattern, bool useRegularExpressions = false @@ -1799,6 +1899,9 @@ public static IPredicate DoNotDependOnAny( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] public static IPredicate DoNotDependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -1940,6 +2043,9 @@ IEnumerable Filter(IEnumerable objects, Architecture architecture) return new ArchitecturePredicate(Filter, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public static IPredicate DoNotHaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -1955,6 +2061,9 @@ public static IPredicate DoNotHaveAnyAttributes( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public static IPredicate DoNotHaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -2111,6 +2220,9 @@ params object[] moreArgumentValues return DoNotHaveAnyAttributesWithArguments(argumentValues); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate DoNotHaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -2154,6 +2266,9 @@ public static IPredicate DoNotHaveAnyAttributesWithNamedArguments( return DoNotHaveAnyAttributesWithNamedArguments(attributeArguments); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate DoNotHaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -2241,6 +2356,9 @@ bool Predicate(T obj, Architecture architecture) return new ArchitecturePredicate(Predicate, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate DoNotHaveAttributeWithArguments( [NotNull] string attribute, IEnumerable argumentValues @@ -2526,6 +2644,9 @@ t.Value is ITypeInstance typeInstance return new ArchitecturePredicate(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate DoNotHaveAttributeWithNamedArguments( [NotNull] string attribute, IEnumerable<(string, object)> attributeArguments @@ -2768,10 +2889,10 @@ bool Predicate(T obj, Architecture architecture) return new ArchitecturePredicate(Predicate, description); } - public static IPredicate DoNotHaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either DoNotHaveName() without the useRegularExpressions parameter or DoNotHaveNameMatching() should be used" + )] + public static IPredicate DoNotHaveName(string pattern, bool useRegularExpressions) { return new SimplePredicate( obj => !obj.NameMatches(pattern, useRegularExpressions), @@ -2783,10 +2904,26 @@ public static IPredicate DoNotHaveName( ); } - public static IPredicate DoNotHaveFullName( - string pattern, - bool useRegularExpressions = false - ) + public static IPredicate DoNotHaveName(string name) + { + return new SimplePredicate( + obj => !obj.NameEquals(name), + $"do not have name \"{name}\"" + ); + } + + public static IPredicate DoNotHaveNameMatching(string pattern) + { + return new SimplePredicate( + obj => !obj.NameMatches(pattern), + $"do not have name matching \"{pattern}\"" + ); + } + + [Obsolete( + "Either DoNotHaveFullName() without the useRegularExpressions parameter or DoNotHaveFullNameMatching() should be used" + )] + public static IPredicate DoNotHaveFullName(string pattern, bool useRegularExpressions) { return new SimplePredicate( obj => !obj.FullNameMatches(pattern, useRegularExpressions), @@ -2798,6 +2935,22 @@ public static IPredicate DoNotHaveFullName( ); } + public static IPredicate DoNotHaveFullName(string fullName) + { + return new SimplePredicate( + obj => !obj.FullNameEquals(fullName), + "do not have full name \"" + fullName + "\"" + ); + } + + public static IPredicate DoNotHaveFullNameMatching(string pattern) + { + return new SimplePredicate( + obj => !obj.FullNameMatches(pattern), + "do not have full name matching \"" + pattern + "\"" + ); + } + public static IPredicate DoNotHaveNameStartingWith(string pattern) { return new SimplePredicate( diff --git a/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShould.cs index fc37e6ccc..9112d17fc 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/ObjectsShould.cs @@ -26,6 +26,9 @@ public TRuleTypeShouldConjunction Exist() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Be(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction Be(string pattern, bool useRegularExpressions = false) { _ruleCreator.AddCondition( @@ -34,6 +37,9 @@ public TRuleTypeShouldConjunction Be(string pattern, bool useRegularExpressions return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Be(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction Be( IEnumerable patterns, bool useRegularExpressions = false @@ -68,6 +74,9 @@ public TRuleTypeShouldConjunction Be(IObjectProvider objects) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction CallAny( string pattern, bool useRegularExpressions = false @@ -79,6 +88,9 @@ public TRuleTypeShouldConjunction CallAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction CallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -113,6 +125,9 @@ public TRuleTypeShouldConjunction CallAny(IObjectProvider methods) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DependOnAny( string pattern, bool useRegularExpressions = false @@ -124,6 +139,9 @@ public TRuleTypeShouldConjunction DependOnAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -202,6 +220,9 @@ string failDescription return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyDependOn( string pattern, bool useRegularExpressions = false @@ -213,6 +234,9 @@ public TRuleTypeShouldConjunction OnlyDependOn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyDependOn( IEnumerable patterns, bool useRegularExpressions = false @@ -258,6 +282,9 @@ public TRuleTypeShouldConjunction OnlyDependOn(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -272,6 +299,9 @@ public TRuleTypeShouldConjunction HaveAnyAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -338,6 +368,9 @@ public TRuleTypeShouldConjunction HaveAnyAttributes(IEnumerable attributes return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyHaveAttributes( string pattern, bool useRegularExpressions = false @@ -352,6 +385,9 @@ public TRuleTypeShouldConjunction OnlyHaveAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyHaveAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -442,6 +478,9 @@ params object[] moreArgumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithArguments( string attribute, IEnumerable argumentValues @@ -456,6 +495,9 @@ IEnumerable argumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -558,6 +600,9 @@ public TRuleTypeShouldConjunction HaveAnyAttributesWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments @@ -572,6 +617,9 @@ public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -648,10 +696,10 @@ public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( return Create(_ruleCreator); } - public TRuleTypeShouldConjunction HaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either HaveName() without the useRegularExpressions parameter or HaveNameMatching() should be used" + )] + public TRuleTypeShouldConjunction HaveName(string pattern, bool useRegularExpressions) { _ruleCreator.AddCondition( ObjectConditionsDefinition.HaveName(pattern, useRegularExpressions) @@ -659,10 +707,24 @@ public TRuleTypeShouldConjunction HaveName( return Create(_ruleCreator); } - public TRuleTypeShouldConjunction HaveFullName( - string pattern, - bool useRegularExpressions = false - ) + public TRuleTypeShouldConjunction HaveName(string name) + { + _ruleCreator.AddCondition(ObjectConditionsDefinition.HaveName(name)); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction HaveNameMatching(string pattern) + { + _ruleCreator.AddCondition( + ObjectConditionsDefinition.HaveNameMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either HaveFullName() without the useRegularExpressions parameter or HaveFullNameMatching() should be used" + )] + public TRuleTypeShouldConjunction HaveFullName(string pattern, bool useRegularExpressions) { _ruleCreator.AddCondition( ObjectConditionsDefinition.HaveFullName(pattern, useRegularExpressions) @@ -670,6 +732,20 @@ public TRuleTypeShouldConjunction HaveFullName( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction HaveFullName(string fullName) + { + _ruleCreator.AddCondition(ObjectConditionsDefinition.HaveFullName(fullName)); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction HaveFullNameMatching(string pattern) + { + _ruleCreator.AddCondition( + ObjectConditionsDefinition.HaveFullNameMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction HaveNameStartingWith(string pattern) { _ruleCreator.AddCondition( @@ -808,6 +884,9 @@ public TRuleTypeShouldConjunction NotExist() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBe(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotBe(string pattern, bool useRegularExpressions = false) { _ruleCreator.AddCondition( @@ -816,6 +895,9 @@ public TRuleTypeShouldConjunction NotBe(string pattern, bool useRegularExpressio return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBe(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotBe( IEnumerable patterns, bool useRegularExpressions = false @@ -850,6 +932,9 @@ public TRuleTypeShouldConjunction NotBe(IObjectProvider objects) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotCallAny( string pattern, bool useRegularExpressions = false @@ -861,6 +946,9 @@ public TRuleTypeShouldConjunction NotCallAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotCallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -895,6 +983,9 @@ public TRuleTypeShouldConjunction NotCallAny(IObjectProvider metho return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotDependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotDependOnAny( string pattern, bool useRegularExpressions = false @@ -906,6 +997,9 @@ public TRuleTypeShouldConjunction NotDependOnAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotDependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotDependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -954,6 +1048,9 @@ public TRuleTypeShouldConjunction NotDependOnAny(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotHaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -968,6 +1065,9 @@ public TRuleTypeShouldConjunction NotHaveAnyAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotHaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -1062,6 +1162,9 @@ params object[] moreArgumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction NotHaveAttributeWithArguments( string attribute, IEnumerable argumentValues @@ -1076,6 +1179,9 @@ IEnumerable argumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction NotHaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -1178,6 +1284,9 @@ public TRuleTypeShouldConjunction NotHaveAnyAttributesWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction NotHaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments @@ -1192,6 +1301,9 @@ public TRuleTypeShouldConjunction NotHaveAttributeWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction NotHaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -1268,10 +1380,10 @@ public TRuleTypeShouldConjunction NotHaveAttributeWithNamedArguments( return Create(_ruleCreator); } - public TRuleTypeShouldConjunction NotHaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either NotHaveName() without the useRegularExpressions parameter or NotHaveNameMatching() should be used" + )] + public TRuleTypeShouldConjunction NotHaveName(string pattern, bool useRegularExpressions) { _ruleCreator.AddCondition( ObjectConditionsDefinition.NotHaveName(pattern, useRegularExpressions) @@ -1279,9 +1391,26 @@ public TRuleTypeShouldConjunction NotHaveName( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction NotHaveName(string name) + { + _ruleCreator.AddCondition(ObjectConditionsDefinition.NotHaveName(name)); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction NotHaveNameMatching(string pattern) + { + _ruleCreator.AddCondition( + ObjectConditionsDefinition.NotHaveNameMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either NotHaveFullName() without the useRegularExpressions parameter or NotHaveFullNameMatching() should be used" + )] public TRuleTypeShouldConjunction NotHaveFullName( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddCondition( @@ -1293,6 +1422,22 @@ public TRuleTypeShouldConjunction NotHaveFullName( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction NotHaveFullName(string fullName) + { + _ruleCreator.AddCondition( + ObjectConditionsDefinition.NotHaveFullName(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction NotHaveFullNameMatching(string pattern) + { + _ruleCreator.AddCondition( + ObjectConditionsDefinition.NotHaveFullNameMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction NotHaveNameStartingWith(string pattern) { _ruleCreator.AddCondition( diff --git a/ArchUnitNET/Fluent/Syntax/Elements/ShouldRelateToObjectsThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/ShouldRelateToObjectsThat.cs index 157d8e0b8..cb211d169 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/ShouldRelateToObjectsThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/ShouldRelateToObjectsThat.cs @@ -16,6 +16,9 @@ public class ShouldRelateToObjectsThat ruleCreator) : base(ruleCreator) { } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction Are(string pattern, bool useRegularExpressions = false) { _ruleCreator.ContinueComplexCondition( @@ -24,6 +27,9 @@ public TRuleTypeShouldConjunction Are(string pattern, bool useRegularExpressions return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use Are(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction Are( IEnumerable patterns, bool useRegularExpressions = false @@ -62,6 +68,9 @@ public TRuleTypeShouldConjunction Are(IObjectProvider objects) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction CallAny( string pattern, bool useRegularExpressions = false @@ -73,6 +82,9 @@ public TRuleTypeShouldConjunction CallAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use CallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction CallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -111,6 +123,9 @@ public TRuleTypeShouldConjunction CallAny(IObjectProvider methods) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DependOnAny( string pattern, bool useRegularExpressions = false @@ -125,6 +140,9 @@ public TRuleTypeShouldConjunction DependOnAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -201,6 +219,9 @@ string description return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyDependOn( string pattern, bool useRegularExpressions = false @@ -215,6 +236,9 @@ public TRuleTypeShouldConjunction OnlyDependOn( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyDependOn(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyDependOn( IEnumerable patterns, bool useRegularExpressions = false @@ -269,6 +293,9 @@ public TRuleTypeShouldConjunction OnlyDependOn(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -283,6 +310,9 @@ public TRuleTypeShouldConjunction HaveAnyAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use HaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction HaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -349,6 +379,9 @@ public TRuleTypeShouldConjunction HaveAnyAttributes(IEnumerable attributes return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyHaveAttributes( string pattern, bool useRegularExpressions = false @@ -363,6 +396,9 @@ public TRuleTypeShouldConjunction OnlyHaveAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use OnlyHaveAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction OnlyHaveAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -455,6 +491,9 @@ params object[] moreArgumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithArguments( string attribute, IEnumerable argumentValues @@ -469,6 +508,9 @@ IEnumerable argumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -571,6 +613,9 @@ public TRuleTypeShouldConjunction HaveAnyAttributesWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments @@ -585,6 +630,9 @@ public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -661,10 +709,10 @@ public TRuleTypeShouldConjunction HaveAttributeWithNamedArguments( return Create(_ruleCreator); } - public TRuleTypeShouldConjunction HaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either HaveName() without the useRegularExpressions parameter or HaveNameMatching() should be used" + )] + public TRuleTypeShouldConjunction HaveName(string pattern, bool useRegularExpressions) { _ruleCreator.ContinueComplexCondition( ObjectPredicatesDefinition.HaveName(pattern, useRegularExpressions) @@ -672,10 +720,26 @@ public TRuleTypeShouldConjunction HaveName( return Create(_ruleCreator); } - public TRuleTypeShouldConjunction HaveFullName( - string pattern, - bool useRegularExpressions = false - ) + public TRuleTypeShouldConjunction HaveName(string name) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.HaveName(name) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction HaveNameMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.HaveNameMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either HaveFullName() without the useRegularExpressions parameter or HaveFullNameMatching() should be used" + )] + public TRuleTypeShouldConjunction HaveFullName(string pattern, bool useRegularExpressions) { _ruleCreator.ContinueComplexCondition( ObjectPredicatesDefinition.HaveFullName( @@ -686,6 +750,22 @@ public TRuleTypeShouldConjunction HaveFullName( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction HaveFullName(string fullName) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.HaveFullName(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction HaveFullNameMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.HaveFullNameMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction HaveNameStartingWith(string pattern) { _ruleCreator.ContinueComplexCondition( @@ -768,7 +848,9 @@ public TRuleTypeShouldConjunction ArePrivateProtected() //Negations - + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNot(string pattern, bool useRegularExpressions = false) { _ruleCreator.ContinueComplexCondition( @@ -777,6 +859,9 @@ public TRuleTypeShouldConjunction AreNot(string pattern, bool useRegularExpressi return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNot(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNot( IEnumerable patterns, bool useRegularExpressions = false @@ -815,6 +900,9 @@ public TRuleTypeShouldConjunction AreNot(IObjectProvider objects return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotCallAny( string pattern, bool useRegularExpressions = false @@ -829,6 +917,9 @@ public TRuleTypeShouldConjunction DoNotCallAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotCallAny(MethodMembers().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotCallAny( IEnumerable patterns, bool useRegularExpressions = false @@ -870,6 +961,9 @@ public TRuleTypeShouldConjunction DoNotCallAny(IObjectProvider met return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotDependOnAny( string pattern, bool useRegularExpressions = false @@ -884,6 +978,9 @@ public TRuleTypeShouldConjunction DoNotDependOnAny( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotDependOnAny(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotDependOnAny( IEnumerable patterns, bool useRegularExpressions = false @@ -941,6 +1038,9 @@ public TRuleTypeShouldConjunction DoNotDependOnAny(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotHaveAnyAttributes( string pattern, bool useRegularExpressions = false @@ -955,6 +1055,9 @@ public TRuleTypeShouldConjunction DoNotHaveAnyAttributes( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use DoNotHaveAnyAttributes(Attributes().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction DoNotHaveAnyAttributes( IEnumerable patterns, bool useRegularExpressions = false @@ -1135,6 +1238,9 @@ public TRuleTypeShouldConjunction DoNotHaveAnyAttributesWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction DoNotHaveAttributeWithArguments( string attribute, IEnumerable argumentValues @@ -1149,6 +1255,9 @@ IEnumerable argumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction DoNotHaveAttributeWithArguments( string attribute, object firstArgumentValue, @@ -1165,6 +1274,9 @@ params object[] moreArgumentValues return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction DoNotHaveAttributeWithNamedArguments( string attribute, IEnumerable<(string, object)> attributeArguments @@ -1179,6 +1291,9 @@ public TRuleTypeShouldConjunction DoNotHaveAttributeWithNamedArguments( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction DoNotHaveAttributeWithNamedArguments( string attribute, (string, object) firstAttributeArgument, @@ -1255,10 +1370,10 @@ public TRuleTypeShouldConjunction DoNotHaveAttributeWithNamedArguments( return Create(_ruleCreator); } - public TRuleTypeShouldConjunction DoNotHaveName( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either DoNotHaveName() without the useRegularExpressions parameter or DoNotHaveNameMatching() should be used" + )] + public TRuleTypeShouldConjunction DoNotHaveName(string pattern, bool useRegularExpressions) { _ruleCreator.ContinueComplexCondition( ObjectPredicatesDefinition.DoNotHaveName( @@ -1269,9 +1384,28 @@ public TRuleTypeShouldConjunction DoNotHaveName( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction DoNotHaveName(string name) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.DoNotHaveName(name) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction DoNotHaveNameMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.DoNotHaveName(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either DoNotHaveFullName() without the useRegularExpressions parameter or DoNotHaveFullNameMatching() should be used" + )] public TRuleTypeShouldConjunction DoNotHaveFullName( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.ContinueComplexCondition( @@ -1283,6 +1417,22 @@ public TRuleTypeShouldConjunction DoNotHaveFullName( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction DoNotHaveFullName(string fullName) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.DoNotHaveFullName(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction DoNotHaveFullNameMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + ObjectPredicatesDefinition.DoNotHaveFullNameMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction DoNotHaveNameStartingWith(string pattern) { _ruleCreator.ContinueComplexCondition( diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs index a79ea7851..be976f8b0 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/GivenTypesThat.cs @@ -29,6 +29,9 @@ public TGivenRuleTypeConjunction Are(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreAssignableTo( string pattern, bool useRegularExpressions = false @@ -40,6 +43,9 @@ public TGivenRuleTypeConjunction AreAssignableTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -137,6 +143,9 @@ public TGivenRuleTypeConjunction AreStructs() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction ImplementInterface( string pattern, bool useRegularExpressions = false @@ -163,9 +172,12 @@ public TGivenRuleTypeConjunction ImplementInterface(Type intf) return Create(_ruleCreator); } + [Obsolete( + "Either ResideInNamespace() without the useRegularExpressions parameter or ResideInNamespaceMatching() should be used" + )] public TGivenRuleTypeConjunction ResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddPredicate( @@ -177,13 +189,32 @@ public TGivenRuleTypeConjunction ResideInNamespace( return Create(_ruleCreator); } + public TGivenRuleTypeConjunction ResideInNamespace(string fullName) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.ResideInNamespace(fullName) + ); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction ResideInNamespaceMatching(string pattern) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.ResideInNamespace(pattern) + ); + return Create(_ruleCreator); + } + /// Matches the types that reside in the assembly. /// Name of the assembly to match. /// Indicates if pattern shall be considered a regular expression. /// In case of not using regular expression pattern has to be Assembly Full Name. + [Obsolete( + "Either ResideInAssembly() without the useRegularExpressions parameter or ResideInAssemblyMatching() should be used" + )] public TGivenRuleTypeConjunction ResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddPredicate( @@ -192,6 +223,22 @@ public TGivenRuleTypeConjunction ResideInAssembly( return Create(_ruleCreator); } + public TGivenRuleTypeConjunction ResideInAssembly(string fullName) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.ResideInAssembly(fullName) + ); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction ResideInAssemblyMatching(string pattern) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.ResideInAssemblyMatching(pattern) + ); + return Create(_ruleCreator); + } + public TGivenRuleTypeConjunction ResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies @@ -267,6 +314,9 @@ public TGivenRuleTypeConjunction AreNot(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreNotAssignableTo( string pattern, bool useRegularExpressions = false @@ -281,6 +331,9 @@ public TGivenRuleTypeConjunction AreNotAssignableTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] public TGivenRuleTypeConjunction AreNotAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -356,6 +409,9 @@ public TGivenRuleTypeConjunction AreNotStructs() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TGivenRuleTypeConjunction DoNotImplementInterface( string pattern, bool useRegularExpressions = false @@ -386,9 +442,12 @@ public TGivenRuleTypeConjunction DoNotImplementInterface(Type intf) return Create(_ruleCreator); } + [Obsolete( + "Either DoNotResideInNamespace() without the useRegularExpressions parameter or DoNotResideInNamespaceMatching() should be used" + )] public TGivenRuleTypeConjunction DoNotResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddPredicate( @@ -400,9 +459,28 @@ public TGivenRuleTypeConjunction DoNotResideInNamespace( return Create(_ruleCreator); } + public TGivenRuleTypeConjunction DoNotResideInNamespace(string fullName) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.DoNotResideInNamespace(fullName) + ); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction DoNotResideInNamespaceMatching(string pattern) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.DoNotResideInNamespaceMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either DoNotResideInAssembly() without the useRegularExpressions parameter or DoNotResideInAssemblyMatching() should be used" + )] public TGivenRuleTypeConjunction DoNotResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddPredicate( @@ -414,6 +492,22 @@ public TGivenRuleTypeConjunction DoNotResideInAssembly( return Create(_ruleCreator); } + public TGivenRuleTypeConjunction DoNotResideInAssembly(string fullName) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.DoNotResideInAssembly(fullName) + ); + return Create(_ruleCreator); + } + + public TGivenRuleTypeConjunction DoNotResideInAssemblyMatching(string pattern) + { + _ruleCreator.AddPredicate( + TypePredicatesDefinition.DoNotResideInAssemblyMatching(pattern) + ); + return Create(_ruleCreator); + } + public TGivenRuleTypeConjunction DoNotResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypeConditions.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypeConditions.cs index 025031c29..f1ac496c5 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypeConditions.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypeConditions.cs @@ -11,7 +11,15 @@ public interface ITypeConditions { TReturnType Be(Type firstType, params Type[] moreTypes); TReturnType Be(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType BeAssignableTo(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType BeAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -24,11 +32,27 @@ TReturnType BeAssignableTo( TReturnType BeValueTypes(); TReturnType BeEnums(); TReturnType BeStructs(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType ImplementInterface(string pattern, bool useRegularExpressions = false); TReturnType ImplementInterface(Interface intf); TReturnType ImplementInterface(Type intf); - TReturnType ResideInNamespace(string pattern, bool useRegularExpressions = false); - TReturnType ResideInAssembly(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either ResideInNamespace() without the useRegularExpressions parameter or ResideInNamespaceMatching() should be used" + )] + TReturnType ResideInNamespace(string pattern, bool useRegularExpressions); + TReturnType ResideInNamespace(string fullName); + TReturnType ResideInNamespaceMatching(string pattern); + + [Obsolete( + "Either ResideInAssembly() without the useRegularExpressions parameter or ResideInAssemblyMatching() should be used" + )] + TReturnType ResideInAssembly(string pattern, bool useRegularExpressions); + TReturnType ResideInAssembly(string fullName); + TReturnType ResideInAssemblyMatching(string pattern); TReturnType ResideInAssembly(Assembly assembly, params Assembly[] moreAssemblies); TReturnType ResideInAssembly( Domain.Assembly assembly, @@ -45,7 +69,15 @@ params Domain.Assembly[] moreAssemblies TReturnType NotBe(Type firstType, params Type[] moreTypes); TReturnType NotBe(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType NotBeAssignableTo(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType NotBeAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -58,11 +90,27 @@ TReturnType NotBeAssignableTo( TReturnType NotBeValueTypes(); TReturnType NotBeEnums(); TReturnType NotBeStructs(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType NotImplementInterface(string pattern, bool useRegularExpressions = false); TReturnType NotImplementInterface(Interface intf); TReturnType NotImplementInterface(Type intf); - TReturnType NotResideInNamespace(string pattern, bool useRegularExpressions = false); - TReturnType NotResideInAssembly(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either NotResideInNamespace() without the useRegularExpressions parameter or NotResideInNamespaceMatching() should be used" + )] + TReturnType NotResideInNamespace(string pattern, bool useRegularExpressions); + TReturnType NotResideInNamespace(string fullName); + TReturnType NotResideInNamespaceMatching(string pattern); + + [Obsolete( + "Either NotResideInAssembly() without the useRegularExpressions parameter or NotResideInAssemblyMatching() should be used" + )] + TReturnType NotResideInAssembly(string fullName); + TReturnType NotResideInAssemblyMatching(string pattern); + TReturnType NotResideInAssembly(string pattern, bool useRegularExpressions); TReturnType NotResideInAssembly(Assembly assembly, params Assembly[] moreAssemblies); TReturnType NotResideInAssembly( Domain.Assembly assembly, diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypePredicates.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypePredicates.cs index e3379abcc..c08a42630 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypePredicates.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/ITypePredicates.cs @@ -11,7 +11,15 @@ public interface ITypePredicates { TReturnType Are(Type firstType, params Type[] moreTypes); TReturnType Are(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType AreAssignableTo(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType AreAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -24,11 +32,27 @@ TReturnType AreAssignableTo( TReturnType AreValueTypes(); TReturnType AreEnums(); TReturnType AreStructs(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType ImplementInterface(string pattern, bool useRegularExpressions = false); TReturnType ImplementInterface(Interface intf); TReturnType ImplementInterface(Type intf); - TReturnType ResideInNamespace(string pattern, bool useRegularExpressions = false); - TReturnType ResideInAssembly(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either ResideInNamespace() without the useRegularExpressions parameter or ResideInNamespaceMatching() should be used" + )] + TReturnType ResideInNamespace(string pattern, bool useRegularExpressions); + TReturnType ResideInNamespace(string fullName); + TReturnType ResideInNamespaceMatching(string pattern); + + [Obsolete( + "Either ResideInAssembly() without the useRegularExpressions parameter or ResideInAssemblyMatching() should be used" + )] + TReturnType ResideInAssembly(string pattern, bool useRegularExpressions); + TReturnType ResideInAssembly(string fullName); + TReturnType ResideInAssemblyMatching(string pattern); TReturnType ResideInAssembly(Assembly assembly, params Assembly[] moreAssemblies); TReturnType ResideInAssembly( Domain.Assembly assembly, @@ -45,7 +69,15 @@ params Domain.Assembly[] moreAssemblies TReturnType AreNot(Type firstType, params Type[] moreTypes); TReturnType AreNot(IEnumerable types); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType AreNotAssignableTo(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] TReturnType AreNotAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -58,11 +90,26 @@ TReturnType AreNotAssignableTo( TReturnType AreNotValueTypes(); TReturnType AreNotEnums(); TReturnType AreNotStructs(); + + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] TReturnType DoNotImplementInterface(string pattern, bool useRegularExpressions = false); TReturnType DoNotImplementInterface(Interface intf); TReturnType DoNotImplementInterface(Type intf); - TReturnType DoNotResideInNamespace(string pattern, bool useRegularExpressions = false); - TReturnType DoNotResideInAssembly(string pattern, bool useRegularExpressions = false); + + [Obsolete( + "Either DoNotResideInNamespace() without the useRegularExpressions parameter or DoNotResideInNamespaceMatching() should be used" + )] + TReturnType DoNotResideInNamespace(string pattern, bool useRegularExpressions); + TReturnType DoNotResideInNamespace(string fullName); + + [Obsolete( + "Either DoNotResideInAssembly() without the useRegularExpressions parameter or DoNotResideInAssemblyMatching() should be used" + )] + TReturnType DoNotResideInAssembly(string pattern, bool useRegularExpressions); + TReturnType DoNotResideInAssembly(string fullName); + TReturnType DoNotResideInAssemblyMatching(string pattern); TReturnType DoNotResideInAssembly(Assembly assembly, params Assembly[] moreAssemblies); TReturnType DoNotResideInAssembly( Domain.Assembly assembly, diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs index 9b521a3e0..975f3027e 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/ShouldRelateToTypesThat.cs @@ -32,6 +32,9 @@ public TRuleTypeShouldConjunction Are(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreAssignableTo( string pattern, bool useRegularExpressions = false @@ -46,6 +49,9 @@ public TRuleTypeShouldConjunction AreAssignableTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -164,6 +170,9 @@ public TRuleTypeShouldConjunction AreStructs() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction ImplementInterface( string pattern, bool useRegularExpressions = false @@ -194,9 +203,12 @@ public TRuleTypeShouldConjunction ImplementInterface(Type intf) return Create(_ruleCreator); } + [Obsolete( + "Either ResideInNamespace() without the useRegularExpressions parameter or ResideInNamespaceMatching() should be used" + )] public TRuleTypeShouldConjunction ResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.ContinueComplexCondition( @@ -208,9 +220,28 @@ public TRuleTypeShouldConjunction ResideInNamespace( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction ResideInNamespace(string fullName) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.ResideInNamespace(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction ResideInNamespaceMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.ResideInNamespaceMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either ResideInAssembly() without the useRegularExpressions parameter or ResideInAssemblyMatching() should be used" + )] public TRuleTypeShouldConjunction ResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.ContinueComplexCondition( @@ -222,6 +253,22 @@ public TRuleTypeShouldConjunction ResideInAssembly( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction ResideInAssembly(string fullName) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.ResideInAssembly(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction ResideInAssemblyMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.ResideInAssemblyMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction ResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies @@ -303,6 +350,9 @@ public TRuleTypeShouldConjunction AreNot(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNotAssignableTo( string pattern, bool useRegularExpressions = false @@ -317,6 +367,9 @@ public TRuleTypeShouldConjunction AreNotAssignableTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction AreNotAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -401,6 +454,9 @@ public TRuleTypeShouldConjunction AreNotStructs() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction DoNotImplementInterface( string pattern, bool useRegularExpressions = false @@ -431,9 +487,12 @@ public TRuleTypeShouldConjunction DoNotImplementInterface(Type intf) return Create(_ruleCreator); } + [Obsolete( + "Either DoNotResideInNamespace() without the useRegularExpressions parameter or DoNotResideInNamespaceMatching() should be used" + )] public TRuleTypeShouldConjunction DoNotResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.ContinueComplexCondition( @@ -445,9 +504,28 @@ public TRuleTypeShouldConjunction DoNotResideInNamespace( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction DoNotResideInNamespace(string fullName) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.DoNotResideInNamespace(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction DoNotResideInNamespaceMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.DoNotResideInNamespaceMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either DoNotResideInAssembly() without the useRegularExpressions parameter or DoNotResideInAssemblyMatching() should be used" + )] public TRuleTypeShouldConjunction DoNotResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.ContinueComplexCondition( @@ -459,6 +537,22 @@ public TRuleTypeShouldConjunction DoNotResideInAssembly( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction DoNotResideInAssembly(string fullName) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.DoNotResideInAssembly(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction DoNotResideInAssemblyMatching(string pattern) + { + _ruleCreator.ContinueComplexCondition( + TypePredicatesDefinition.DoNotResideInAssemblyMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction DoNotResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypeConditionsDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypeConditionsDefinition.cs index 632b7d604..54f6faead 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypeConditionsDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypeConditionsDefinition.cs @@ -84,6 +84,9 @@ Architecture architecture return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeAssignableTo(Types().That().HaveFullName()) instead" + )] public static ICondition BeAssignableTo( string pattern, bool useRegularExpressions = false @@ -108,6 +111,9 @@ public static ICondition BeAssignableTo( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeAssignableTo(Types().That().HaveFullName()) instead" + )] public static ICondition BeAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -529,6 +535,9 @@ public static ICondition BeStructs() ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition ImplementInterface( string pattern, bool useRegularExpressions = false @@ -617,9 +626,12 @@ Architecture architecture ); } + [Obsolete( + "Either ResideInNamespace() without the useRegularExpressions parameter or ResideInNamespaceMatching() should be used" + )] public static ICondition ResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return new SimpleCondition( @@ -633,9 +645,30 @@ public static ICondition ResideInNamespace( ); } + public static ICondition ResideInNamespace(string fullName) + { + return new SimpleCondition( + type => type.ResidesInNamespace(fullName), + obj => "does reside in " + obj.Namespace.FullName, + "reside in namespace with full name \"" + fullName + "\"" + ); + } + + public static ICondition ResideInNamespaceMatching(string pattern) + { + return new SimpleCondition( + type => type.ResidesInNamespace(pattern), + obj => "does reside in " + obj.Namespace.FullName, + "reside in namespace with full name matching \"" + pattern + "\"" + ); + } + + [Obsolete( + "Either ResideInAssembly() without the useRegularExpressions parameter or ResideInAssemblyMatching() should be used" + )] public static ICondition ResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return new SimpleCondition( @@ -649,6 +682,24 @@ public static ICondition ResideInAssembly( ); } + public static ICondition ResideInAssembly(string fullName) + { + return new SimpleCondition( + type => type.ResidesInAssembly(fullName), + obj => "does reside in " + obj.Assembly.FullName, + "reside in assembly with full name \"" + fullName + "\"" + ); + } + + public static ICondition ResideInAssemblyMatching(string pattern) + { + return new SimpleCondition( + type => type.ResidesInAssemblyMatching(pattern), + obj => "does reside in " + obj.Assembly.FullName, + "reside in assembly with full name matching \"" + pattern + "\"" + ); + } + public static ICondition ResideInAssembly( System.Reflection.Assembly assembly, params System.Reflection.Assembly[] moreAssemblies @@ -750,9 +801,7 @@ ConditionResult Condition(TRuleType ruleType) { if ( classDiagramAssociation.Contains(dependency) - && !allAllowedTargets.Any(pattern => - dependency.FullNameMatches(pattern, true) - ) + && !allAllowedTargets.Any(pattern => dependency.FullNameMatches(pattern)) ) { dynamicFailDescription += pass @@ -890,6 +939,9 @@ Architecture architecture return new ArchitectureCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeAssignableTo(Types().That().HaveFullName()) instead" + )] public static ICondition NotBeAssignableTo( string pattern, bool useRegularExpressions = false @@ -920,6 +972,9 @@ ConditionResult Condition(TRuleType ruleType) return new SimpleCondition(Condition, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeAssignableTo(Types().That().HaveFullName()) instead" + )] public static ICondition NotBeAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -1209,6 +1264,9 @@ public static ICondition NotBeStructs() ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static ICondition NotImplementInterface( string pattern, bool useRegularExpressions = false @@ -1293,9 +1351,12 @@ Architecture architecture ); } + [Obsolete( + "Either NotResideInNamespace() without the useRegularExpressions parameter or NotResideInNamespaceMatching() should be used" + )] public static ICondition NotResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return new SimpleCondition( @@ -1309,9 +1370,30 @@ public static ICondition NotResideInNamespace( ); } + public static ICondition NotResideInNamespace(string fullName) + { + return new SimpleCondition( + type => !type.ResidesInNamespace(fullName), + obj => "does reside in " + obj.Namespace.FullName, + "not reside in namespace with full name \"" + fullName + "\"" + ); + } + + public static ICondition NotResideInNamespaceMatching(string pattern) + { + return new SimpleCondition( + type => !type.ResidesInNamespaceMatching(pattern), + obj => "does reside in " + obj.Namespace.FullName, + "not reside in namespace with full name matching \"" + pattern + "\"" + ); + } + + [Obsolete( + "Either NotResideInAssembly() without the useRegularExpressions parameter or NotResideInAssemblyMatching() should be used" + )] public static ICondition NotResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return new SimpleCondition( @@ -1325,6 +1407,24 @@ public static ICondition NotResideInAssembly( ); } + public static ICondition NotResideInAssembly(string fullName) + { + return new SimpleCondition( + type => !type.ResidesInAssembly(fullName), + obj => "does reside in " + obj.Assembly.FullName, + "not reside in assembly with full name \"" + fullName + "\"" + ); + } + + public static ICondition NotResideInAssemblyMatching(string pattern) + { + return new SimpleCondition( + type => !type.ResidesInAssemblyMatching(pattern), + obj => "does reside in " + obj.Assembly.FullName, + "not reside in assembly with full name matching \"" + pattern + "\"" + ); + } + public static ICondition NotResideInAssembly( System.Reflection.Assembly assembly, params System.Reflection.Assembly[] moreAssemblies diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypePredicatesDefinition.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypePredicatesDefinition.cs index 380819aec..9f118501c 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypePredicatesDefinition.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypePredicatesDefinition.cs @@ -63,6 +63,9 @@ IEnumerable Filter(IEnumerable ruleTypes, Architecture architecture) return new ArchitecturePredicate(Filter, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] public static IPredicate AreAssignableTo( string pattern, bool useRegularExpressions = false @@ -80,6 +83,9 @@ public static IPredicate AreAssignableTo( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreAssignableTo(Types().That().HaveFullName()) instead" + )] public static IPredicate AreAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -364,6 +370,9 @@ public static IPredicate AreStructs() return new SimplePredicate(type => type is Struct, "are structs"); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate ImplementInterface( string pattern, bool useRegularExpressions = false @@ -411,10 +420,10 @@ IEnumerable Condition(IEnumerable ruleTypes, Architecture architecture) ); } - public static IPredicate ResideInNamespace( - string pattern, - bool useRegularExpressions = false - ) + [Obsolete( + "Either ResideInNamespace() without the useRegularExpressions parameter or ResideInNamespaceMatching() should be used" + )] + public static IPredicate ResideInNamespace(string pattern, bool useRegularExpressions) { return new SimplePredicate( type => type.ResidesInNamespace(pattern, useRegularExpressions), @@ -426,10 +435,26 @@ public static IPredicate ResideInNamespace( ); } - public static IPredicate ResideInAssembly( - string pattern, - bool useRegularExpressions = false - ) + public static IPredicate ResideInNamespace(string fullName) + { + return new SimplePredicate( + type => type.ResidesInNamespace(fullName), + "reside in namespace with full name \"" + fullName + "\"" + ); + } + + public static IPredicate ResideInNamespaceMatching(string pattern) + { + return new SimplePredicate( + type => type.ResidesInNamespaceMatching(pattern), + "reside in namespace with full name matching \"" + pattern + "\"" + ); + } + + [Obsolete( + "Either ResideInAssembly() without the useRegularExpressions parameter or ResideInAssemblyMatching() should be used" + )] + public static IPredicate ResideInAssembly(string pattern, bool useRegularExpressions) { return new SimplePredicate( type => type.ResidesInAssembly(pattern, useRegularExpressions), @@ -441,6 +466,22 @@ public static IPredicate ResideInAssembly( ); } + public static IPredicate ResideInAssembly(string fullName) + { + return new SimplePredicate( + type => type.ResidesInAssembly(fullName), + "reside in assembly with full name \"" + fullName + "\"" + ); + } + + public static IPredicate ResideInAssemblyMatching(string pattern) + { + return new SimplePredicate( + type => type.ResidesInAssembly(pattern), + "reside in assembly with full name matching \"" + pattern + "\"" + ); + } + public static IPredicate ResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies @@ -569,6 +610,9 @@ IEnumerable Filter(IEnumerable ruleTypes, Architecture architecture) return new ArchitecturePredicate(Filter, description); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNotAssignableTo( string pattern, bool useRegularExpressions = false @@ -586,6 +630,9 @@ public static IPredicate AreNotAssignableTo( ); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use AreNotAssignableTo(Types().That().HaveFullName()) instead" + )] public static IPredicate AreNotAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -762,6 +809,9 @@ public static IPredicate AreNotStructs() return new SimplePredicate(cls => !(cls is Struct), "are not structs"); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public static IPredicate DoNotImplementInterface( string pattern, bool useRegularExpressions = false @@ -809,9 +859,12 @@ IEnumerable Condition(IEnumerable ruleTypes, Architecture architecture) ); } + [Obsolete( + "Either DoNotResideInNamespace() without the useRegularExpressions parameter or DoNotResideInNamespaceMatching() should be used" + )] public static IPredicate DoNotResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return new SimplePredicate( @@ -824,9 +877,28 @@ public static IPredicate DoNotResideInNamespace( ); } + public static IPredicate DoNotResideInNamespace(string fullName) + { + return new SimplePredicate( + type => !type.ResidesInNamespace(fullName), + "do not reside in namespace with full name \"" + fullName + "\"" + ); + } + + public static IPredicate DoNotResideInNamespaceMatching(string pattern) + { + return new SimplePredicate( + type => !type.ResidesInNamespace(pattern), + "do not reside in namespace with full name matching \"" + pattern + "\"" + ); + } + + [Obsolete( + "Either DoNotResideInAssembly() without the useRegularExpressions parameter or DoNotResideInAssemblyMatching() should be used" + )] public static IPredicate DoNotResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { return new SimplePredicate( @@ -839,6 +911,22 @@ public static IPredicate DoNotResideInAssembly( ); } + public static IPredicate DoNotResideInAssembly(string fullName) + { + return new SimplePredicate( + type => !type.ResidesInAssembly(fullName), + "do not reside in assembly with full name \"" + fullName + "\"" + ); + } + + public static IPredicate DoNotResideInAssemblyMatching(string pattern) + { + return new SimplePredicate( + type => !type.ResidesInAssembly(pattern), + "do not reside in assembly with full name matching \"" + pattern + "\"" + ); + } + public static IPredicate DoNotResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies diff --git a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs index 22f25327d..bb9c4819f 100644 --- a/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs +++ b/ArchUnitNET/Fluent/Syntax/Elements/Types/TypesShould.cs @@ -29,6 +29,9 @@ public TRuleTypeShouldConjunction Be(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction BeAssignableTo( string pattern, bool useRegularExpressions = false @@ -40,6 +43,9 @@ public TRuleTypeShouldConjunction BeAssignableTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use BeAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction BeAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -137,6 +143,9 @@ public TRuleTypeShouldConjunction BeStructs() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction ImplementInterface( string pattern, bool useRegularExpressions = false @@ -163,9 +172,12 @@ public TRuleTypeShouldConjunction ImplementInterface(Type intf) return Create(_ruleCreator); } + [Obsolete( + "Either ResideInNamespace() without the useRegularExpressions parameter or ResideInNamespaceMatching() should be used" + )] public TRuleTypeShouldConjunction ResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddCondition( @@ -177,9 +189,28 @@ public TRuleTypeShouldConjunction ResideInNamespace( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction ResideInNamespace(string fullName) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.ResideInNamespace(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction ResideInNamespaceMatching(string pattern) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.ResideInNamespaceMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either ResideInAssembly() without the useRegularExpressions parameter or ResideInAssemblyMatching() should be used" + )] public TRuleTypeShouldConjunction ResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddCondition( @@ -188,6 +219,22 @@ public TRuleTypeShouldConjunction ResideInAssembly( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction ResideInAssembly(string fullName) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.ResideInAssembly(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction ResideInAssemblyMatching(string pattern) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.ResideInAssemblyMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction ResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies @@ -280,6 +327,9 @@ public TRuleTypeShouldConjunction NotBe(IEnumerable types) return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotBeAssignableTo( string pattern, bool useRegularExpressions = false @@ -294,6 +344,9 @@ public TRuleTypeShouldConjunction NotBeAssignableTo( return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update. You can use NotBeAssignableTo(Types().That().HaveFullName()) instead" + )] public TRuleTypeShouldConjunction NotBeAssignableTo( IEnumerable patterns, bool useRegularExpressions = false @@ -363,6 +416,9 @@ public TRuleTypeShouldConjunction NotBeStructs() return Create(_ruleCreator); } + [Obsolete( + "Another overload of this method should be used. This will be removed in a future update." + )] public TRuleTypeShouldConjunction NotImplementInterface( string pattern, bool useRegularExpressions = false @@ -393,9 +449,12 @@ public TRuleTypeShouldConjunction NotImplementInterface(Type intf) return Create(_ruleCreator); } + [Obsolete( + "Either NotResideInNamespace() without the useRegularExpressions parameter or NotResideInNamespaceMatching() should be used" + )] public TRuleTypeShouldConjunction NotResideInNamespace( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddCondition( @@ -407,9 +466,28 @@ public TRuleTypeShouldConjunction NotResideInNamespace( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction NotResideInNamespace(string fullName) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.NotResideInNamespace(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction NotResideInNamespaceMatching(string pattern) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.NotResideInNamespaceMatching(pattern) + ); + return Create(_ruleCreator); + } + + [Obsolete( + "Either NotResideInAssembly() without the useRegularExpressions parameter or NotResideInAssemblyMatching() should be used" + )] public TRuleTypeShouldConjunction NotResideInAssembly( string pattern, - bool useRegularExpressions = false + bool useRegularExpressions ) { _ruleCreator.AddCondition( @@ -421,6 +499,22 @@ public TRuleTypeShouldConjunction NotResideInAssembly( return Create(_ruleCreator); } + public TRuleTypeShouldConjunction NotResideInAssembly(string fullName) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.NotResideInAssembly(fullName) + ); + return Create(_ruleCreator); + } + + public TRuleTypeShouldConjunction NotResideInAssemblyMatching(string pattern) + { + _ruleCreator.AddCondition( + TypeConditionsDefinition.NotResideInAssemblyMatching(pattern) + ); + return Create(_ruleCreator); + } + public TRuleTypeShouldConjunction NotResideInAssembly( Assembly assembly, params Assembly[] moreAssemblies diff --git a/ArchUnitNETTests/ArchitectureTests/ArchUnitArchitectureTests.cs b/ArchUnitNETTests/ArchitectureTests/ArchUnitArchitectureTests.cs index 6b29fd4d6..df12379e0 100644 --- a/ArchUnitNETTests/ArchitectureTests/ArchUnitArchitectureTests.cs +++ b/ArchUnitNETTests/ArchitectureTests/ArchUnitArchitectureTests.cs @@ -25,7 +25,7 @@ public void DomainHasNoDependencyOnFluent() .That() .ResideInNamespace(DomainNamespace) .Should() - .NotDependOnAny(FluentNamespace) + .NotDependOnAny(Types().That().ResideInNamespace(FluentNamespace)) .Check(_architecture); } @@ -36,7 +36,7 @@ public void DomainHasNoDependencyOnLoader() .That() .ResideInNamespace(DomainNamespace) .Should() - .NotDependOnAny(LoaderNamespace) + .NotDependOnAny(Types().That().ResideInNamespace(LoaderNamespace)) .Check(_architecture); } @@ -47,7 +47,7 @@ public void LoaderHasNoDependencyOnFluent() .That() .ResideInNamespace(LoaderNamespace) .Should() - .NotDependOnAny(FluentNamespace) + .NotDependOnAny(Types().That().ResideInNamespace(FluentNamespace)) .Check(_architecture); } @@ -58,7 +58,7 @@ public void FluentHasNoDependencyOnLoader() .That() .ResideInNamespace(FluentNamespace) .Should() - .NotDependOnAny(LoaderNamespace) + .NotDependOnAny(Types().That().ResideInNamespace(LoaderNamespace)) .Check(_architecture); } } diff --git a/ArchUnitNETTests/Dependencies/ExternalDependenciesTests.cs b/ArchUnitNETTests/Dependencies/ExternalDependenciesTests.cs index 073c4de95..73a751428 100644 --- a/ArchUnitNETTests/Dependencies/ExternalDependenciesTests.cs +++ b/ArchUnitNETTests/Dependencies/ExternalDependenciesTests.cs @@ -31,13 +31,7 @@ public void PropertyDependencyTest() .HaveFullName(typeof(PropertyDependency).FullName) .Should() .NotDependOnAny(typeof(Class2)); - var notDependOnAnyRuleString = Classes() - .That() - .HaveFullName(typeof(PropertyDependency).FullName) - .Should() - .NotDependOnAny(typeof(Class2).FullName); Assert.False(notDependOnAnyRuleClass.HasNoViolations(Architecture)); //Class2 does not exist in Architecture - Assert.False(notDependOnAnyRuleString.HasNoViolations(Architecture)); Assert.False(notDependOnAnyRuleClass.HasNoViolations(ArchitectureExternalDependency)); } @@ -49,13 +43,7 @@ public void MethodBodyDependencyTest() .HaveFullName(typeof(MethodBodyDependency).FullName) .Should() .NotDependOnAny(typeof(Class3)); - var notDependOnAnyRuleString = Classes() - .That() - .HaveFullName(typeof(MethodBodyDependency).FullName) - .Should() - .NotDependOnAny(typeof(Class3).FullName); Assert.False(notDependOnAnyRuleClass.HasNoViolations(Architecture)); //Class3 does not exist in Architecture - Assert.False(notDependOnAnyRuleString.HasNoViolations(Architecture)); Assert.False(notDependOnAnyRuleClass.HasNoViolations(ArchitectureBothAssemblies)); } @@ -67,13 +55,7 @@ public void MethodArgumentDependencyTest() .HaveFullName(typeof(MethodArgumentDependency).FullName) .Should() .NotDependOnAny(typeof(Class2)); - var notDependOnAnyRuleString = Classes() - .That() - .HaveFullName(typeof(MethodArgumentDependency).FullName) - .Should() - .NotDependOnAny(typeof(Class2).FullName); Assert.False(notDependOnAnyRuleClass.HasNoViolations(Architecture)); //Class3 does not exist in Architecture - Assert.False(notDependOnAnyRuleString.HasNoViolations(Architecture)); } [Fact] @@ -84,13 +66,7 @@ public void FieldDependencyTest() .HaveFullName(typeof(FieldDependency).FullName) .Should() .NotDependOnAny(typeof(Class2)); - var notDependOnAnyRuleString = Classes() - .That() - .HaveFullName(typeof(FieldDependency).FullName) - .Should() - .NotDependOnAny(typeof(Class2).FullName); Assert.False(notDependOnAnyRuleClass.HasNoViolations(Architecture)); //Class3 does not exist in Architecture - Assert.False(notDependOnAnyRuleString.HasNoViolations(Architecture)); } } diff --git a/ArchUnitNETTests/Dependencies/StringDependenciesTests.cs b/ArchUnitNETTests/Dependencies/StringDependenciesTests.cs index f1e105a55..89de5af09 100644 --- a/ArchUnitNETTests/Dependencies/StringDependenciesTests.cs +++ b/ArchUnitNETTests/Dependencies/StringDependenciesTests.cs @@ -65,6 +65,8 @@ public void PropertyStringDependencyFound() ); } } +#pragma warning disable CS0219 // Variable is assigned but its value is never used +#pragma warning disable CS0414 // Field is assigned but its value is never used internal class ClassWithStringField { diff --git a/ArchUnitNETTests/Domain/Dependencies/Attributes/AttributeDependencyTests.cs b/ArchUnitNETTests/Domain/Dependencies/Attributes/AttributeDependencyTests.cs index 69b5b45e0..f853b59dc 100644 --- a/ArchUnitNETTests/Domain/Dependencies/Attributes/AttributeDependencyTests.cs +++ b/ArchUnitNETTests/Domain/Dependencies/Attributes/AttributeDependencyTests.cs @@ -72,7 +72,7 @@ public void ClassAttributeInnerDependencyAssignedToOriginClass() //Assert Assert.All( expectedClassTargets, - targetClass => Assert.True(_originClass.DependsOn(targetClass.FullName)) + targetClass => Assert.True(_originClass.DependsOnType(targetClass.FullName)) ); } @@ -81,7 +81,7 @@ public void ForbidAttributeForClass() { Assert.All( _eventHandlerImplementClasses, - cls => Assert.False(cls.DependsOn("forbidden")) + cls => Assert.False(cls.DependsOnTypeMatching("forbidden")) ); } @@ -100,7 +100,7 @@ public void MemberAttributeInnerDependencyAssignedToOriginClass() //Assert Assert.All( expectedClassTargets, - targetClass => Assert.True(_originClass.DependsOn(targetClass.FullName)) + targetClass => Assert.True(_originClass.DependsOnType(targetClass.FullName)) ); } diff --git a/ArchUnitNETTests/Domain/Extensions/TypeExtensionTests.cs b/ArchUnitNETTests/Domain/Extensions/TypeExtensionTests.cs index 4eaab1ee0..021899dd7 100644 --- a/ArchUnitNETTests/Domain/Extensions/TypeExtensionTests.cs +++ b/ArchUnitNETTests/Domain/Extensions/TypeExtensionTests.cs @@ -68,15 +68,21 @@ public void FullNameContainsTest() [Fact] public void FullNameMatchesTest() { - Assert.True(_fieldMember.FullNameMatches("(?i)ieLda", true)); - Assert.True(_propertyOriginClass.FullNameMatches("(?i)sswITH", true)); - Assert.False(_methodOriginClass.FullNameMatches("ClassMethod")); - Assert.False(_methodMember.FullNameMatches("")); - Assert.True(_methodMember.FullNameMatches(_methodMember.FullName)); - Assert.True(_methodMember.FullNameMatches(_methodMember.FullName.ToLower())); + Assert.True(_fieldMember.FullNameMatches("(?i)ieLda")); + Assert.True(_propertyOriginClass.FullNameMatches("(?i)sswITH")); Assert.False(_exampleAttribute.FullNameMatches(null)); } + [Fact] + public void FullNameEqualsTest() + { + Assert.False(_methodOriginClass.FullNameEquals("ClassMethod")); + Assert.False(_methodMember.FullNameEquals("")); + Assert.True(_methodMember.FullNameEquals(_methodMember.FullName)); + Assert.True(_methodMember.FullNameEquals(_methodMember.FullName.ToLower())); + Assert.False(_exampleAttribute.FullNameEquals(null)); + } + [Fact] public void HasMembersWithFullNameTest() { @@ -193,21 +199,27 @@ public void NameEndsWithTest() [Fact] public void NameMatchesTest() { - Assert.True(_fieldMember.NameMatches("(?i)ieLda", true)); - Assert.True(_propertyOriginClass.NameMatches("(?i)sswITH", true)); - Assert.False(_methodOriginClass.NameMatches("ClassMethod")); - Assert.False(_methodMember.NameMatches("")); - Assert.True(_methodMember.NameMatches(_methodMember.Name)); - Assert.True(_methodMember.NameMatches(_methodMember.Name.ToLower())); + Assert.True(_fieldMember.NameMatches("(?i)ieLda")); + Assert.True(_propertyOriginClass.NameMatches("(?i)sswITH")); Assert.False(_exampleAttribute.NameMatches(null)); } + [Fact] + public void NameEqualsTest() + { + Assert.False(_methodOriginClass.NameEquals("ClassMethod")); + Assert.False(_methodMember.NameEquals("")); + Assert.True(_methodMember.NameEquals(_methodMember.Name)); + Assert.True(_methodMember.NameEquals(_methodMember.Name.ToLower())); + Assert.False(_exampleAttribute.NameEquals(null)); + } + [Fact] public void NamespaceMatchAsExpected() { Assert.True(_exampleAttribute.ResidesInNamespace(ExpectedAttributeNamespace)); Assert.False(_exampleAttribute.ResidesInNamespace(ParentAttributeNamespace)); - Assert.True(_exampleAttribute.ResidesInNamespace(ParentAttributeNamespace, true)); + Assert.True(_exampleAttribute.ResidesInNamespaceMatching(ParentAttributeNamespace)); Assert.True(_regexUtilsTests.ResidesInNamespace(ExpectedRegexUtilsTestNamespace)); Assert.False(_exampleAttribute.ResidesInNamespace(string.Empty)); } diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/MemberSyntaxElementsTests.cs b/ArchUnitNETTests/Fluent/Syntax/Elements/MemberSyntaxElementsTests.cs index 41e54877e..7b426d199 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/MemberSyntaxElementsTests.cs +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/MemberSyntaxElementsTests.cs @@ -32,22 +32,17 @@ public MemberSyntaxElementsTests() typeof(InternalTestClass), }; - private readonly List _falseTypesPattern = new List - { - StaticTestTypes.PublicTestClass.FullName, - StaticTestTypes.InternalTestClass.FullName, - }; - - private readonly List _falseTypeConstructors = new List - { - PublicTestClassConstructor, - InternalTestClassConstructor, - }; + private static readonly IObjectProvider FalseTypeConstructors = + MethodMembers() + .That() + .HaveFullName("System.Void ArchUnitNETTests.Domain.PublicTestClass::.ctor()") + .Or() + .HaveFullName("System.Void ArchUnitNETTests.Domain.InternalTestClass::.ctor()"); - private const string PublicTestClassConstructor = - "System.Void ArchUnitNETTests.Domain.PublicTestClass::.ctor()"; - private const string InternalTestClassConstructor = - "System.Void ArchUnitNETTests.Domain.InternalTestClass::.ctor()"; + private static readonly IObjectProvider PublicTestClassConstructor = + MethodMembers() + .That() + .HaveFullName("System.Void ArchUnitNETTests.Domain.PublicTestClass::.ctor()"); [Fact] public void DeclaredInTest() @@ -120,42 +115,28 @@ public void DeclaredInTest() .Should() .BeDeclaredIn(_falseTypes1) .AndShould() - .NotBe(_falseTypeConstructors); + .NotBe(FalseTypeConstructors); var notDeclaredInOtherTypeMultiple1 = Members() .That() .Are(member) .Should() .NotBeDeclaredIn(_falseTypes1) .OrShould() - .Be(_falseTypeConstructors); + .Be(FalseTypeConstructors); var declaredInOtherTypeMultiple2 = Members() .That() .Are(member) .Should() .BeDeclaredIn(_falseTypes2) .AndShould() - .NotBe(_falseTypeConstructors); + .NotBe(FalseTypeConstructors); var notDeclaredInOtherTypeMultiple2 = Members() .That() .Are(member) .Should() .NotBeDeclaredIn(_falseTypes2) .OrShould() - .Be(_falseTypeConstructors); - var declaredInOtherTypeMultiplePattern = Members() - .That() - .Are(member) - .Should() - .BeDeclaredIn(_falseTypesPattern) - .AndShould() - .NotBe(_falseTypeConstructors); - var notDeclaredInOtherTypeMultiplePattern = Members() - .That() - .Are(member) - .Should() - .NotBeDeclaredIn(_falseTypesPattern) - .OrShould() - .Be(_falseTypeConstructors); + .Be(FalseTypeConstructors); Assert.True(declaredInRightTypeFluent.HasNoViolations(Architecture)); Assert.False(notDeclaredInRightTypeFluent.HasNoViolations(Architecture)); @@ -163,8 +144,6 @@ public void DeclaredInTest() Assert.True(notDeclaredInOtherTypeMultiple1.HasNoViolations(Architecture)); Assert.False(declaredInOtherTypeMultiple2.HasNoViolations(Architecture)); Assert.True(notDeclaredInOtherTypeMultiple2.HasNoViolations(Architecture)); - Assert.False(declaredInOtherTypeMultiplePattern.HasNoViolations(Architecture)); - Assert.True(notDeclaredInOtherTypeMultiplePattern.HasNoViolations(Architecture)); } foreach (var type in _types) @@ -198,11 +177,6 @@ public void DeclaredInTest() .AreDeclaredIn(StaticTestTypes.PublicTestClass) .Should() .Be(PublicTestClassConstructor); - var emptyTypeHasOnlyConstructorPattern = Members() - .That() - .AreDeclaredIn(typeof(PublicTestClass).FullName) - .Should() - .Be(PublicTestClassConstructor); var allMembersAreNotDeclaredInEmptyType1 = Members() .That() .AreNotDeclaredIn(typeof(PublicTestClass)) @@ -213,18 +187,11 @@ public void DeclaredInTest() .AreNotDeclaredIn(StaticTestTypes.PublicTestClass) .Should() .Be(Members().That().AreNot(PublicTestClassConstructor)); - var allMembersAreNotDeclaredInEmptyTypePattern = Members() - .That() - .AreNotDeclaredIn(typeof(PublicTestClass).FullName) - .Should() - .Be(Members().That().AreNot(PublicTestClassConstructor)); Assert.True(emptyTypeHasOnlyConstructor1.HasNoViolations(Architecture)); Assert.True(emptyTypeHasOnlyConstructor2.HasNoViolations(Architecture)); - Assert.True(emptyTypeHasOnlyConstructorPattern.HasNoViolations(Architecture)); Assert.True(allMembersAreNotDeclaredInEmptyType1.HasNoViolations(Architecture)); Assert.True(allMembersAreNotDeclaredInEmptyType2.HasNoViolations(Architecture)); - Assert.True(allMembersAreNotDeclaredInEmptyTypePattern.HasNoViolations(Architecture)); //Multiple Arguments @@ -232,41 +199,27 @@ public void DeclaredInTest() .That() .AreDeclaredIn(_falseTypes1) .Should() - .Be(_falseTypeConstructors); + .Be(FalseTypeConstructors); var emptyTypeHasOnlyConstructorMultiple2 = Members() .That() .AreDeclaredIn(_falseTypes2) .Should() - .Be(_falseTypeConstructors); - var emptyTypeHasOnlyConstructorMultiplePattern = Members() - .That() - .AreDeclaredIn(_falseTypesPattern) - .Should() - .Be(_falseTypeConstructors); + .Be(FalseTypeConstructors); var allMembersAreNotDeclaredInEmptyTypeMultiple1 = Members() .That() .AreNotDeclaredIn(_falseTypes1) .Should() - .Be(Members().That().AreNot(_falseTypeConstructors)); + .Be(Members().That().AreNot(FalseTypeConstructors)); var allMembersAreNotDeclaredInEmptyTypeMultiple2 = Members() .That() .AreNotDeclaredIn(_falseTypes2) .Should() - .Be(Members().That().AreNot(_falseTypeConstructors)); - var allMembersAreNotDeclaredInEmptyTypeMultiplePattern = Members() - .That() - .AreNotDeclaredIn(_falseTypesPattern) - .Should() - .Be(Members().That().AreNot(_falseTypeConstructors)); + .Be(Members().That().AreNot(FalseTypeConstructors)); Assert.True(emptyTypeHasOnlyConstructorMultiple1.HasNoViolations(Architecture)); Assert.True(emptyTypeHasOnlyConstructorMultiple2.HasNoViolations(Architecture)); - Assert.True(emptyTypeHasOnlyConstructorMultiplePattern.HasNoViolations(Architecture)); Assert.True(allMembersAreNotDeclaredInEmptyTypeMultiple1.HasNoViolations(Architecture)); Assert.True(allMembersAreNotDeclaredInEmptyTypeMultiple2.HasNoViolations(Architecture)); - Assert.True( - allMembersAreNotDeclaredInEmptyTypeMultiplePattern.HasNoViolations(Architecture) - ); } [Fact] diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/MethodMemberSyntaxElementsTests.cs b/ArchUnitNETTests/Fluent/Syntax/Elements/MethodMemberSyntaxElementsTests.cs index 71d552e45..ba31a1b45 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/MethodMemberSyntaxElementsTests.cs +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/MethodMemberSyntaxElementsTests.cs @@ -190,7 +190,7 @@ public void CalledByTest() foreach ( var callingType in methodMember .GetMethodCallDependencies(true) - .Select(dependency => dependency.Origin.FullName) + .Select(dependency => dependency.Origin) ) { var methodIsCalledByRightType = MethodMembers() @@ -212,12 +212,12 @@ var callingType in methodMember .That() .Are(methodMember) .Should() - .BeCalledBy(typeof(PublicTestClass).FullName); + .BeCalledBy(typeof(PublicTestClass)); var methodIsNotCalledByFalseType = MethodMembers() .That() .Are(methodMember) .Should() - .NotBeCalledBy(typeof(PublicTestClass).FullName); + .NotBeCalledBy(typeof(PublicTestClass)); Assert.False(methodIsCalledByFalseType.HasNoViolations(Architecture)); Assert.True(methodIsNotCalledByFalseType.HasNoViolations(Architecture)); @@ -227,15 +227,15 @@ var callingType in methodMember { var calledMethodsShouldBeCalled = MethodMembers() .That() - .AreCalledBy(type.FullName) + .AreCalledBy(type) .Should() - .BeCalledBy(type.FullName) + .BeCalledBy(type) .WithoutRequiringPositiveResults(); var notCalledMethodsShouldNotBeCalled = MethodMembers() .That() - .AreNotCalledBy(type.FullName) + .AreNotCalledBy(type) .Should() - .NotBeCalledBy(type.FullName); + .NotBeCalledBy(type); Assert.True(calledMethodsShouldBeCalled.HasNoViolations(Architecture)); Assert.True(notCalledMethodsShouldNotBeCalled.HasNoViolations(Architecture)); @@ -243,12 +243,12 @@ var callingType in methodMember var emptyTypeCallsNoMethods = MethodMembers() .That() - .AreCalledBy(typeof(PublicTestClass).FullName) + .AreCalledBy(typeof(PublicTestClass)) .Should() .NotExist(); var methodsNotCalledByEmptyTypeShouldExist = MethodMembers() .That() - .AreNotCalledBy(typeof(PublicTestClass).FullName) + .AreNotCalledBy(typeof(PublicTestClass)) .Should() .Exist(); @@ -264,7 +264,7 @@ public void HaveDependencyInMethodBodyTest() foreach ( var dependency in methodMember .GetBodyTypeMemberDependencies() - .Select(dependency => dependency.Target.FullName) + .Select(dependency => dependency.Target) ) { var hasRightDependency = MethodMembers() @@ -287,15 +287,15 @@ var dependency in methodMember { var dependentMethodsShouldBeDependent = MethodMembers() .That() - .HaveDependencyInMethodBodyTo(type.FullName) + .HaveDependencyInMethodBodyTo(type) .Should() - .HaveDependencyInMethodBodyTo(type.FullName) + .HaveDependencyInMethodBodyTo(type) .WithoutRequiringPositiveResults(); var notDependentMethodsShouldNotBeDependent = MethodMembers() .That() - .DoNotHaveDependencyInMethodBodyTo(type.FullName) + .DoNotHaveDependencyInMethodBodyTo(type) .Should() - .NotHaveDependencyInMethodBodyTo(type.FullName); + .NotHaveDependencyInMethodBodyTo(type); Assert.True(dependentMethodsShouldBeDependent.HasNoViolations(Architecture)); Assert.True(notDependentMethodsShouldNotBeDependent.HasNoViolations(Architecture)); @@ -305,21 +305,6 @@ var dependency in methodMember [Fact] public void HaveReturnTypeConditionTest() { - var stringReturnTypes = new List { "Void", "String", "ReturnTypeClass" }; - var retTypeWithString = MethodMembers() - .That() - .HaveFullNameContaining("ReturnTypeMethod") - .Should() - .HaveReturnType(stringReturnTypes, true); - var retTypeWithStringFail = MethodMembers() - .That() - .HaveFullNameContaining("ReturnTypeMethod") - .Should() - .HaveReturnType("bool", true); - - Assert.True(retTypeWithString.HasNoViolations(Architecture)); - Assert.False(retTypeWithStringFail.HasNoViolations(Architecture)); - var retTypeWithType = MethodMembers() .That() .HaveFullNameContaining("ReturnTypeMethod") @@ -367,21 +352,6 @@ public void HaveReturnTypeConditionTest() [Fact] public void NotHaveReturnTypeConditionTest() { - var stringReturnTypes = new List { "Void", "String", "ReturnTypeClass" }; - var retTypeWithString = MethodMembers() - .That() - .HaveFullNameContaining("ReturnTypeMethod") - .Should() - .NotHaveReturnType("bool", true); - var retTypeWithStringFail = MethodMembers() - .That() - .HaveFullNameContaining("ReturnTypeMethod") - .Should() - .NotHaveReturnType(stringReturnTypes, true); - - Assert.True(retTypeWithString.HasNoViolations(Architecture)); - Assert.False(retTypeWithStringFail.HasNoViolations(Architecture)); - var retTypeWithType = MethodMembers() .That() .HaveFullNameContaining("ReturnTypeMethod") @@ -429,28 +399,6 @@ public void NotHaveReturnTypeConditionTest() [Fact] public void HaveReturnTypePredicateTest() { - var stringReturnTypes = new List { "void", "string" }; - var retTypeWithString = MethodMembers() - .That() - .HaveFullNameContaining("ReturnTypeMethod") - .And() - .HaveReturnType(stringReturnTypes, true) - .Should() - .HaveFullNameContaining("Void") - .OrShould() - .HaveFullNameContaining("String") - .WithoutRequiringPositiveResults(); - var retTypeWithStringNegate = MethodMembers() - .That() - .DoNotHaveReturnType("String", true) - .And() - .HaveFullNameContaining("ReturnTypeMethod") - .Should() - .NotHaveFullNameContaining("String"); - - Assert.True(retTypeWithString.HasNoViolations(Architecture)); - Assert.True(retTypeWithStringNegate.HasNoViolations(Architecture)); - var retTypeWithType = MethodMembers() .That() .HaveFullNameContaining("ReturnTypeMethod") @@ -472,12 +420,12 @@ public void HaveReturnTypePredicateTest() var objectProviderClass = Classes().That().HaveFullNameContaining("ReturnTypeClass"); var retTypeWithObjectProvider = MethodMembers() .That() - .HaveReturnType("ReturnTypeClass", true) + .HaveReturnType(objectProviderClass) .Should() .HaveFullNameContaining("ReturnTypeMethodClass"); var retTypeWithObjectProviderFail = MethodMembers() .That() - .DoNotHaveReturnType("ReturnTypeClass", true) + .DoNotHaveReturnType(objectProviderClass) .And() .HaveFullNameContaining("ReturnTypeMethod") .Should() diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs b/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs index ab8ca00a3..803608b48 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs @@ -38,26 +38,14 @@ public void AreTest() var otherTypesAreNotThisType = Types().That().AreNot(type).Should().NotBe(type); var otherTypesAreThisType = Types().That().AreNot(type).Should().Be(type); - var typeIsItselfPattern = Types() - .That() - .Are(type.FullName) - .Should() - .Be(type.FullName); - var typeIsNotItselfPattern = Types() - .That() - .Are(type.FullName) - .Should() - .NotBe(type.FullName); + var typeIsItselfPattern = Types().That().Are(type).Should().Be(type); + var typeIsNotItselfPattern = Types().That().Are(type).Should().NotBe(type); var otherTypesAreNotThisTypePattern = Types() .That() - .AreNot(type.FullName) + .AreNot(type) .Should() - .NotBe(type.FullName); - var otherTypesAreThisTypePattern = Types() - .That() - .AreNot(type.FullName) - .Should() - .Be(type.FullName); + .NotBe(type); + var otherTypesAreThisTypePattern = Types().That().AreNot(type).Should().Be(type); Assert.True(typeIsItself.HasNoViolations(Architecture)); Assert.False(typeIsNotItself.HasNoViolations(Architecture)); @@ -91,40 +79,13 @@ public void AreTest() .Should() .NotBe(StaticTestTypes.PublicTestClass); - var publicTestClassIsPublicPattern = Types() - .That() - .Are(StaticTestTypes.PublicTestClass.FullName) - .Should() - .BePublic(); - var publicTestClassIsNotPublicPattern = Types() - .That() - .Are(StaticTestTypes.PublicTestClass.FullName) - .Should() - .NotBePublic(); - var notPublicTypesAreNotPublicTestClassPattern = Types() - .That() - .AreNotPublic() - .Should() - .NotBe(StaticTestTypes.PublicTestClass.FullName); - var publicTypesAreNotPublicTestClassPattern = Types() - .That() - .ArePublic() - .Should() - .NotBe(StaticTestTypes.PublicTestClass.FullName); - Assert.True(publicTestClassIsPublic.HasNoViolations(Architecture)); Assert.False(publicTestClassIsNotPublic.HasNoViolations(Architecture)); Assert.True(notPublicTypesAreNotPublicTestClass.HasNoViolations(Architecture)); Assert.False(publicTypesAreNotPublicTestClass.HasNoViolations(Architecture)); - Assert.True(publicTestClassIsPublicPattern.HasNoViolations(Architecture)); - Assert.False(publicTestClassIsNotPublicPattern.HasNoViolations(Architecture)); - Assert.True(notPublicTypesAreNotPublicTestClassPattern.HasNoViolations(Architecture)); - Assert.False(publicTypesAreNotPublicTestClassPattern.HasNoViolations(Architecture)); - //Tests with multiple arguments - var publicTestClassAndInternalTestClassIsPublicOrInternal = Types() .That() .Are(StaticTestTypes.PublicTestClass, StaticTestTypes.InternalTestClass) @@ -195,31 +156,6 @@ public void AreTest() .Should() .NotBe(list); - var patternList = new List - { - StaticTestTypes.PublicTestClass.FullName, - StaticTestTypes.InternalTestClass.FullName, - }; - var publicTestClassAndInternalTestClassIsPublicOrInternalPattern = Types() - .That() - .Are(patternList) - .Should() - .BePublic() - .OrShould() - .BeInternal(); - var publicTestClassAndInternalTestClassIsPublicPattern = Types() - .That() - .Are(patternList) - .Should() - .BePublic(); - var notPublicAndNotInternalClassesAreNotPublicTestClassOrInternalTestClassPattern = - Types().That().AreNotPublic().And().AreNotInternal().Should().NotBe(patternList); - var internalTypesAreNotPublicTestClassOrInternalTestClassPattern = Types() - .That() - .AreInternal() - .Should() - .NotBe(patternList); - Assert.True( listPublicTestClassAndInternalTestClassIsPublicOrInternal.HasNoViolations( Architecture @@ -238,25 +174,6 @@ public void AreTest() Architecture ) ); - - Assert.True( - publicTestClassAndInternalTestClassIsPublicOrInternalPattern.HasNoViolations( - Architecture - ) - ); - Assert.False( - publicTestClassAndInternalTestClassIsPublicPattern.HasNoViolations(Architecture) - ); - Assert.True( - notPublicAndNotInternalClassesAreNotPublicTestClassOrInternalTestClassPattern.HasNoViolations( - Architecture - ) - ); - Assert.False( - internalTypesAreNotPublicTestClassOrInternalTestClassPattern.HasNoViolations( - Architecture - ) - ); } [Fact] @@ -264,57 +181,37 @@ public void DependOnPatternTest() { foreach (var type in _types) { - //One Argument - var typesDependOnOwnDependencies = Types() .That() - .DependOnAny(type.FullName) + .DependOnAny(type) .Should() - .DependOnAny(type.FullName) + .DependOnAny(type) .WithoutRequiringPositiveResults(); var typeDoesNotDependOnFalseDependency = Types() .That() .Are(type) .Should() - .NotDependOnAny(NoTypeName); + .NotDependOnAny(Types().That().HaveFullName(NoTypeName)); var typeDependsOnFalseDependency = Types() .That() .Are(type) .Should() - .DependOnAny(NoTypeName) + .DependOnAny(Types().That().HaveFullName(NoTypeName)) .WithoutRequiringPositiveResults(); Assert.True(typesDependOnOwnDependencies.HasNoViolations(Architecture)); Assert.True(typeDoesNotDependOnFalseDependency.HasNoViolations(Architecture)); Assert.False(typeDependsOnFalseDependency.HasNoViolations(Architecture)); - - //Multiple Arguments - - var patternList = new List { type.FullName, NoTypeName }; - var typesDependOnOwnDependenciesMultiple = Types() - .That() - .DependOnAny(patternList) - .Should() - .DependOnAny(patternList) - .WithoutRequiringPositiveResults(); - var typeDependsOnFalseDependencyMultiple = Types() - .That() - .Are(patternList) - .Should() - .DependOnAny(NoTypeName); - - Assert.True(typesDependOnOwnDependenciesMultiple.HasNoViolations(Architecture)); - Assert.False(typeDependsOnFalseDependencyMultiple.HasNoViolations(Architecture)); } var noTypeDependsOnFalseDependency = Types() .That() - .DependOnAny(NoTypeName) + .DependOnAny(Types().That().HaveFullName(NoTypeName)) .Should() .NotExist(); var typesDoNotDependsOnFalseDependency = Types() .That() - .DoNotDependOnAny(NoTypeName) + .DoNotDependOnAny(Types().That().HaveFullName(NoTypeName)) .Should() .Exist(); diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectsShouldTests.cs b/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectsShouldTests.cs index d11a8b2bf..33136092c 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectsShouldTests.cs +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/ObjectsShouldTests.cs @@ -18,10 +18,6 @@ public async Task BeTest() var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ChildClass).Should(); - should.Be(helper.ChildClass.FullName).AssertNoViolations(helper); - should.Be("^.*\\.ChildClass$", true).AssertNoViolations(helper); - should.Be([helper.ChildClass.FullName]).AssertNoViolations(helper); - should.Be(["^.*\\.ChildClass$"], true).AssertNoViolations(helper); should.Be(helper.ChildClass).AssertNoViolations(helper); should.Be(helper.ChildClassSystemType).AssertNoViolations(helper); should.Be(Classes().That().Are(helper.ChildClass)).AssertNoViolations(helper); @@ -30,10 +26,6 @@ public async Task BeTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ChildClass).Should(); - should.Be(helper.ClassWithoutDependencies.FullName).AssertOnlyViolations(helper); - should.Be("^.*\\.ClassWithoutDependencies$", true).AssertOnlyViolations(helper); - should.Be([helper.ClassWithoutDependencies.FullName]).AssertOnlyViolations(helper); - should.Be(["^.*\\.ClassWithoutDependencies$"], true).AssertOnlyViolations(helper); should.Be(helper.ClassWithoutDependencies).AssertOnlyViolations(helper); should.Be(helper.ClassWithoutDependenciesSystemType).AssertOnlyViolations(helper); should @@ -42,23 +34,16 @@ public async Task BeTest() should.Be([helper.ClassWithoutDependencies]).AssertOnlyViolations(helper); should.Be([helper.ClassWithoutDependenciesSystemType]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent type"); - should = Types().That().Are(helper.BaseClass).Should(); - should.Be(helper.NonExistentObjectName).AssertOnlyViolations(helper); - should.Be([helper.NonExistentObjectName]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.BaseClass).Should(); - should.Be(new List()).AssertOnlyViolations(helper); should.Be(new List()).AssertOnlyViolations(helper); should.Be(new List()).AssertOnlyViolations(helper); - should.Be(Classes().That().Are(helper.NonExistentObjectName)).AssertOnlyViolations(helper); + should + .Be(Classes().That().HaveFullName(helper.NonExistentObjectName)) + .AssertOnlyViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ChildClass).Should(); - should - .Be([helper.ClassWithoutDependencies.FullName, helper.BaseClass.FullName]) - .AssertOnlyViolations(helper); should.Be(helper.ClassWithoutDependencies, helper.BaseClass).AssertOnlyViolations(helper); should.Be([helper.ClassWithoutDependencies, helper.BaseClass]).AssertOnlyViolations(helper); should @@ -483,47 +468,27 @@ public async Task CallAnyTest() var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); var should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.CallAny(helper.CalledMethod.FullName).AssertNoViolations(helper); - should.CallAny("^.*::CalledMethod\\(\\)$", true).AssertNoViolations(helper); - should.CallAny([helper.CalledMethod.FullName]).AssertNoViolations(helper); - should.CallAny(["^.*::CalledMethod\\(\\)$"], true).AssertNoViolations(helper); should.CallAny(helper.CalledMethod).AssertNoViolations(helper); should.CallAny([helper.CalledMethod]).AssertNoViolations(helper); should.CallAny(MethodMembers().That().Are(helper.CalledMethod)).AssertNoViolations(helper); helper.AddSnapshotHeader("Violations"); should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.CallAny(helper.MethodWithoutDependencies.FullName).AssertOnlyViolations(helper); - should.CallAny([helper.MethodWithoutDependencies.FullName]).AssertOnlyViolations(helper); should.CallAny(helper.MethodWithoutDependencies).AssertOnlyViolations(helper); should.CallAny([helper.MethodWithoutDependencies]).AssertOnlyViolations(helper); should .CallAny(MethodMembers().That().Are(helper.MethodWithoutDependencies)) .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent method member"); - should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.CallAny(helper.NonExistentObjectName).AssertOnlyViolations(helper); - should.CallAny([helper.NonExistentObjectName]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Empty arguments"); should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.CallAny(new List()).AssertOnlyViolations(helper); should.CallAny(new List()).AssertOnlyViolations(helper); should - .CallAny(MethodMembers().That().Are(helper.NonExistentObjectName)) + .CallAny(MethodMembers().That().HaveFullName(helper.NonExistentObjectName)) .AssertOnlyViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = MethodMembers().That().Are(helper.MethodWithMultipleDependencies).Should(); - should - .CallAny( - [ - helper.MethodWithoutDependencies.FullName, - helper.MethodWithMultipleDependencies.FullName, - ] - ) - .AssertOnlyViolations(helper); should .CallAny(helper.MethodWithoutDependencies, helper.MethodWithMultipleDependencies) .AssertOnlyViolations(helper); @@ -560,10 +525,6 @@ public async Task DependOnAnyTest() var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ChildClass).Should(); - should.DependOnAny(helper.BaseClass.FullName).AssertNoViolations(helper); - should.DependOnAny("^.*\\.BaseClass$", true).AssertNoViolations(helper); - should.DependOnAny([helper.BaseClass.FullName]).AssertNoViolations(helper); - should.DependOnAny(["^.*\\.BaseClass$"], true).AssertNoViolations(helper); should.DependOnAny(helper.BaseClass).AssertNoViolations(helper); should.DependOnAny(helper.BaseClassSystemType).AssertNoViolations(helper); should.DependOnAny(Classes().That().Are(helper.BaseClass)).AssertNoViolations(helper); @@ -571,9 +532,10 @@ public async Task DependOnAnyTest() should.DependOnAny([helper.BaseClassSystemType]).AssertNoViolations(helper); helper.AddSnapshotHeader("Violations"); - should = Types().That().Are(helper.ClassWithMultipleDependencies.FullName).Should(); - should.DependOnAny(helper.ClassWithoutDependencies.FullName).AssertOnlyViolations(helper); - should.DependOnAny([helper.ClassWithoutDependencies.FullName]).AssertOnlyViolations(helper); + should = Types() + .That() + .HaveFullName(helper.ClassWithMultipleDependencies.FullName) + .Should(); should.DependOnAny(helper.ClassWithoutDependencies).AssertOnlyViolations(helper); should.DependOnAny(helper.ClassWithoutDependenciesSystemType).AssertOnlyViolations(helper); should @@ -584,31 +546,22 @@ public async Task DependOnAnyTest() .DependOnAny([helper.ClassWithoutDependenciesSystemType]) .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent type"); - should = Types().That().Are(helper.ClassWithMultipleDependencies.FullName).Should(); - should.DependOnAny(helper.NonExistentObjectName).AssertOnlyViolations(helper); - should.DependOnAny([helper.NonExistentObjectName]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Type outside of architecture"); - should = Types().That().Are(helper.ClassWithMultipleDependencies.FullName).Should(); + should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); should .DependOnAny(typeof(AttributeNamespace.ClassWithoutAttributes)) .AssertOnlyViolations(helper); helper.AddSnapshotHeader("Empty arguments"); - should = Types().That().Are(helper.ClassWithMultipleDependencies.FullName).Should(); - should.DependOnAny(new List()).AssertOnlyViolations(helper); + should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); should.DependOnAny(new List()).AssertOnlyViolations(helper); should.DependOnAny(new List()).AssertOnlyViolations(helper); should - .DependOnAny(Classes().That().Are(helper.NonExistentObjectName)) + .DependOnAny(Classes().That().HaveFullName(helper.NonExistentObjectName)) .AssertOnlyViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); - should = Types().That().Are(helper.ClassWithMultipleDependencies.FullName).Should(); - should - .DependOnAny([helper.ClassWithoutDependencies.FullName, helper.BaseClass.FullName]) - .AssertOnlyViolations(helper); + should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); should .DependOnAny(helper.ClassWithoutDependencies, helper.BaseClass) .AssertOnlyViolations(helper); @@ -624,9 +577,7 @@ public async Task DependOnAnyTest() helper.AddSnapshotHeader("Input without dependencies"); should = Types().That().Are(helper.ClassWithoutDependencies).Should(); - should - .DependOnAny([helper.BaseClass.FullName, helper.ChildClass.FullName]) - .AssertOnlyViolations(helper); + should.DependOnAny([helper.BaseClass, helper.ChildClass]).AssertOnlyViolations(helper); helper.AddSnapshotHeader("Multiple inputs"); Types() @@ -679,7 +630,7 @@ public async Task ExistTest() helper.AddSnapshotHeader("Violations"); Types() .That() - .Are(helper.NonExistentObjectName) + .HaveFullName(helper.NonExistentObjectName) .Should() .Exist() .AssertOnlyViolations(helper); @@ -762,10 +713,6 @@ public async Task HaveAnyAttributesTest() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ClassWithAttributes).Should(); - should.HaveAnyAttributes(helper.Attribute1.FullName).AssertNoViolations(helper); - should.HaveAnyAttributes("^.*\\.Attribute1$", true).AssertNoViolations(helper); - should.HaveAnyAttributes([helper.Attribute1.FullName]).AssertNoViolations(helper); - should.HaveAnyAttributes(["^.*\\.Attribute1$"], true).AssertNoViolations(helper); should.HaveAnyAttributes(helper.Attribute1).AssertNoViolations(helper); should.HaveAnyAttributes([helper.Attribute1]).AssertNoViolations(helper); should.HaveAnyAttributes(helper.Attribute1SystemType).AssertNoViolations(helper); @@ -776,8 +723,6 @@ public async Task HaveAnyAttributesTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ClassWithAttributes).Should(); - should.HaveAnyAttributes(helper.UnusedAttribute.FullName).AssertOnlyViolations(helper); - should.HaveAnyAttributes([helper.UnusedAttribute.FullName]).AssertOnlyViolations(helper); should.HaveAnyAttributes(helper.UnusedAttribute).AssertOnlyViolations(helper); should.HaveAnyAttributes([helper.UnusedAttribute]).AssertOnlyViolations(helper); should.HaveAnyAttributes(helper.UnusedAttributeSystemType).AssertOnlyViolations(helper); @@ -786,25 +731,16 @@ public async Task HaveAnyAttributesTest() .HaveAnyAttributes(Attributes().That().Are(helper.UnusedAttribute)) .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent attribute"); - should = Types().That().Are(helper.ClassWithAttributes).Should(); - should.HaveAnyAttributes(helper.NonExistentObjectName).AssertOnlyViolations(helper); - should.HaveAnyAttributes([helper.NonExistentObjectName]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ClassWithAttributes).Should(); - should.HaveAnyAttributes(new List()).AssertOnlyViolations(helper); should.HaveAnyAttributes(new List()).AssertOnlyViolations(helper); should.HaveAnyAttributes(new List()).AssertOnlyViolations(helper); should - .HaveAnyAttributes(Attributes().That().Are(helper.NonExistentObjectName)) + .HaveAnyAttributes(Attributes().That().HaveFullName(helper.NonExistentObjectName)) .AssertOnlyViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithAttributes).Should(); - should - .HaveAnyAttributes([helper.Attribute1.FullName, helper.UnusedAttribute.FullName]) - .AssertNoViolations(helper); should .HaveAnyAttributes(helper.Attribute1, helper.UnusedAttribute) .AssertNoViolations(helper); @@ -1041,18 +977,6 @@ public async Task HaveAttributeWithArgumentsTest() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations with type arguments"); var should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute1Parameter3Value - ) - .AssertNoViolations(helper); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter3Value] - ) - .AssertNoViolations(helper); should .HaveAttributeWithArguments(helper.Attribute1, helper.Attribute1Parameter3Value) .AssertNoViolations(helper); @@ -1074,18 +998,6 @@ public async Task HaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("No violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute1Parameter1Value - ) - .AssertNoViolations(helper); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter1Value] - ) - .AssertNoViolations(helper); should .HaveAttributeWithArguments(helper.Attribute1, helper.Attribute1Parameter1Value) .AssertNoViolations(helper); @@ -1107,18 +1019,6 @@ public async Task HaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Violations with type arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute1Parameter3InvalidValue - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter3InvalidValue] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithArguments(helper.Attribute1, helper.Attribute1Parameter3InvalidValue) .AssertOnlyViolations(helper); @@ -1143,18 +1043,6 @@ public async Task HaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute2Parameter2Value - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute2Parameter2Value] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithArguments(helper.Attribute1, helper.Attribute2Parameter2Value) .AssertOnlyViolations(helper); @@ -1174,15 +1062,6 @@ public async Task HaveAttributeWithArgumentsTest() ) .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent attribute"); - should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments( - helper.NonExistentObjectName, - helper.Attribute1Parameter1Value - ) - .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Type outside of architecture"); should = Types().That().Are(helper.ClassWithArguments).Should(); should @@ -1194,9 +1073,6 @@ public async Task HaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Null argument"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments(helper.Attribute1.FullName, null) - .AssertOnlyViolations(helper); should.HaveAttributeWithArguments(helper.Attribute1, null).AssertOnlyViolations(helper); should .HaveAttributeWithArguments(helper.Attribute1SystemType, null) @@ -1204,9 +1080,6 @@ public async Task HaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments(helper.Attribute1.FullName, new List()) - .AssertNoViolations(helper); should .HaveAttributeWithArguments(helper.Attribute1, new List()) .AssertNoViolations(helper); @@ -1216,12 +1089,6 @@ public async Task HaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter1Value, helper.Attribute1Parameter2Value] - ) - .AssertNoViolations(helper); should .HaveAttributeWithArguments( helper.Attribute1, @@ -1271,18 +1138,6 @@ public async Task HaveAttributeWithNamedArguments() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations with type arguments"); var should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1Pair - ) - .AssertNoViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1Pair] - ) - .AssertNoViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1310,18 +1165,6 @@ public async Task HaveAttributeWithNamedArguments() helper.AddSnapshotHeader("No violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter2Pair - ) - .AssertNoViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter2Pair] - ) - .AssertNoViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1349,18 +1192,6 @@ public async Task HaveAttributeWithNamedArguments() helper.AddSnapshotHeader("Violations with type arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1InvalidNamePair - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1InvalidNamePair] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1385,18 +1216,6 @@ public async Task HaveAttributeWithNamedArguments() [helper.Attribute1NamedParameter1InvalidNamePair] ) .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1InvalidValuePair - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1InvalidValuePair] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1424,18 +1243,6 @@ public async Task HaveAttributeWithNamedArguments() helper.AddSnapshotHeader("Violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter2InvalidNamePair - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter2InvalidNamePair] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1460,18 +1267,6 @@ public async Task HaveAttributeWithNamedArguments() [helper.Attribute1NamedParameter2InvalidNamePair] ) .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter2InvalidValuePair - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter2InvalidValuePair] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1499,18 +1294,6 @@ public async Task HaveAttributeWithNamedArguments() helper.AddSnapshotHeader("Unused attribute"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithNamedArguments( - helper.UnusedAttribute.FullName, - helper.Attribute1NamedParameter1Pair - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.UnusedAttribute.FullName, - [helper.Attribute1NamedParameter1Pair] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithNamedArguments( helper.UnusedAttribute, @@ -1547,9 +1330,6 @@ public async Task HaveAttributeWithNamedArguments() helper.AddSnapshotHeader("Emtpy arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithNamedArguments(helper.Attribute1.FullName, []) - .AssertNoViolations(helper); should.HaveAttributeWithNamedArguments(helper.Attribute1, []).AssertNoViolations(helper); should .HaveAttributeWithNamedArguments(helper.Attribute1SystemType, []) @@ -1557,19 +1337,6 @@ public async Task HaveAttributeWithNamedArguments() helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1Pair, - helper.Attribute2NamedParameter2Pair - ) - .AssertOnlyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1Pair, helper.Attribute2NamedParameter2Pair] - ) - .AssertOnlyViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1599,18 +1366,6 @@ public async Task HaveAttributeWithNamedArguments() helper.AddSnapshotHeader("Multiple inputs"); should = Types().That().Are(helper.ClassWithArguments, helper.ClassWithAttributes).Should(); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1Pair - ) - .AssertAnyViolations(helper); - should - .HaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1Pair] - ) - .AssertAnyViolations(helper); should .HaveAttributeWithNamedArguments( helper.Attribute1, @@ -1645,9 +1400,9 @@ public async Task HaveNameTest() helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.BaseClass).Should(); should.HaveName(helper.BaseClass.Name).AssertNoViolations(helper); - should.HaveName("^Base.*$", true).AssertNoViolations(helper); + should.HaveNameMatching("^Base.*$").AssertNoViolations(helper); should.HaveFullName(helper.BaseClass.FullName).AssertNoViolations(helper); - should.HaveFullName("^.*\\.Base.*$", true).AssertNoViolations(helper); + should.HaveFullNameMatching("^.*\\.Base.*$").AssertNoViolations(helper); should.HaveNameContaining("Base").AssertNoViolations(helper); should.HaveFullNameContaining(helper.BaseClass.Namespace.Name).AssertNoViolations(helper); should.HaveNameStartingWith("Base").AssertNoViolations(helper); @@ -1656,9 +1411,9 @@ public async Task HaveNameTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.BaseClass).Should(); should.HaveName(helper.BaseClass.FullName).AssertOnlyViolations(helper); - should.HaveName("^.*\\.Base.*$", false).AssertOnlyViolations(helper); + should.HaveName("^.*\\.Base.*$").AssertOnlyViolations(helper); should.HaveFullName(helper.BaseClass.Name).AssertOnlyViolations(helper); - should.HaveFullName("^Base.*$", false).AssertOnlyViolations(helper); + should.HaveFullName("^Base.*$").AssertOnlyViolations(helper); should.HaveNameContaining(helper.BaseClass.Namespace.Name).AssertOnlyViolations(helper); should.HaveFullNameContaining(helper.NonExistentObjectName).AssertOnlyViolations(helper); should.HaveNameStartingWith(helper.BaseClass.Namespace.Name).AssertOnlyViolations(helper); @@ -1671,11 +1426,7 @@ public async Task NotBeTest() { var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); - var should = Types().That().DependOnAny(helper.BaseClass.FullName).Should(); - should.NotBe(helper.ClassWithoutDependencies.FullName).AssertNoViolations(helper); - should.NotBe("^.*\\.ClassWithoutDependencies$", true).AssertNoViolations(helper); - should.NotBe([helper.ClassWithoutDependencies.FullName]).AssertNoViolations(helper); - should.NotBe("^.*\\.ClassWithoutDependencies$", true).AssertNoViolations(helper); + var should = Types().That().DependOnAny(helper.BaseClass).Should(); should.NotBe(helper.ClassWithoutDependencies).AssertNoViolations(helper); should.NotBe(helper.ClassWithoutDependenciesSystemType).AssertNoViolations(helper); should @@ -1685,32 +1436,23 @@ public async Task NotBeTest() should.NotBe([helper.ClassWithoutDependenciesSystemType]).AssertNoViolations(helper); helper.AddSnapshotHeader("Violations"); - should = Types().That().DependOnAny(helper.BaseClass.FullName).Should(); - should.NotBe(helper.ChildClass.FullName).AssertAnyViolations(helper); - should.NotBe([helper.ChildClass.FullName]).AssertAnyViolations(helper); + should = Types().That().DependOnAny(helper.BaseClass).Should(); should.NotBe(helper.ChildClass).AssertAnyViolations(helper); should.NotBe(helper.ChildClassSystemType).AssertAnyViolations(helper); should.NotBe(Classes().That().Are(helper.ChildClass)).AssertAnyViolations(helper); should.NotBe([helper.ChildClass]).AssertAnyViolations(helper); should.NotBe([helper.ChildClassSystemType]).AssertAnyViolations(helper); - helper.AddSnapshotHeader("Non-existent type"); - should = Types().That().DependOnAny(helper.BaseClass.FullName).Should(); - should.NotBe(helper.NonExistentObjectName).AssertNoViolations(helper); - should.NotBe([helper.NonExistentObjectName]).AssertNoViolations(helper); - helper.AddSnapshotHeader("Empty arguments"); - should = Types().That().DependOnAny(helper.BaseClass.FullName).Should(); - should.NotBe(new List()).AssertNoViolations(helper); + should = Types().That().DependOnAny(helper.BaseClass).Should(); should.NotBe(new List()).AssertNoViolations(helper); should.NotBe(new List()).AssertNoViolations(helper); - should.NotBe(Classes().That().Are(helper.NonExistentObjectName)).AssertNoViolations(helper); - - helper.AddSnapshotHeader("Multiple arguments"); - should = Types().That().DependOnAny(helper.BaseClass.FullName).Should(); should - .NotBe([helper.ClassWithoutDependencies.FullName, helper.BaseClass.FullName]) + .NotBe(Classes().That().HaveFullName(helper.NonExistentObjectName)) .AssertNoViolations(helper); + + helper.AddSnapshotHeader("Multiple arguments"); + should = Types().That().DependOnAny(helper.BaseClass).Should(); should.NotBe(helper.ClassWithoutDependencies, helper.BaseClass).AssertNoViolations(helper); should .NotBe([helper.ClassWithoutDependencies, helper.BaseClass]) @@ -1730,10 +1472,6 @@ public async Task NotCallAnyTest() var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); var should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.NotCallAny(helper.MethodWithoutDependencies.FullName).AssertNoViolations(helper); - should.NotCallAny("^.*\\.MethodWithoutDependencies$", true).AssertNoViolations(helper); - should.NotCallAny([helper.MethodWithoutDependencies.FullName]).AssertNoViolations(helper); - should.NotCallAny("^.*\\.MethodWithoutDependencies$", true).AssertNoViolations(helper); should.NotCallAny(helper.MethodWithoutDependencies).AssertNoViolations(helper); should.NotCallAny([helper.MethodWithoutDependencies]).AssertNoViolations(helper); should @@ -1742,41 +1480,18 @@ public async Task NotCallAnyTest() helper.AddSnapshotHeader("Violations"); should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.NotCallAny(helper.CalledMethod.FullName).AssertOnlyViolations(helper); - should.NotCallAny([helper.CalledMethod.FullName]).AssertOnlyViolations(helper); should.NotCallAny(helper.CalledMethod).AssertOnlyViolations(helper); should.NotCallAny([helper.CalledMethod]).AssertOnlyViolations(helper); should .NotCallAny(MethodMembers().That().Are(helper.CalledMethod)) .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent method member"); - should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.NotCallAny(helper.NonExistentObjectName).AssertNoViolations(helper); - should.NotCallAny([helper.NonExistentObjectName]).AssertNoViolations(helper); - helper.AddSnapshotHeader("Empty arguments"); should = MethodMembers().That().Are(helper.MethodWithSingleDependency).Should(); - should.NotCallAny(new List()).AssertNoViolations(helper); should.NotCallAny(new List()).AssertNoViolations(helper); - should - .NotCallAny(MethodMembers().That().Are(helper.NonExistentObjectName)) - .AssertNoViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = MethodMembers().That().Are(helper.MethodWithMultipleDependencies).Should(); - should - .NotCallAny("^.*::(MethodWithoutDependencies|CalledMethod[0-9])\\(\\)$", true) - .AssertOnlyViolations(helper); - should - .NotCallAny( - [ - helper.MethodWithoutDependencies.FullName, - helper.CalledMethod1.FullName, - helper.CalledMethod2.FullName, - ] - ) - .AssertOnlyViolations(helper); should .NotCallAny( helper.MethodWithoutDependencies, @@ -1847,12 +1562,6 @@ public async Task NotDependOnAnyTest() var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ChildClass).Should(); - should.NotDependOnAny(helper.ClassWithoutDependencies.FullName).AssertNoViolations(helper); - should.NotDependOnAny("^.*\\.ClassWithoutDependencies$", true).AssertNoViolations(helper); - should - .NotDependOnAny([helper.ClassWithoutDependencies.FullName]) - .AssertNoViolations(helper); - should.NotDependOnAny("^.*\\.ClassWithoutDependencies$", true).AssertNoViolations(helper); should.NotDependOnAny(helper.ClassWithoutDependencies).AssertNoViolations(helper); should.NotDependOnAny(helper.ClassWithoutDependenciesSystemType).AssertNoViolations(helper); should @@ -1865,19 +1574,12 @@ public async Task NotDependOnAnyTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ChildClass).Should(); - should.NotDependOnAny(helper.BaseClass.FullName).AssertOnlyViolations(helper); - should.NotDependOnAny([helper.BaseClass.FullName]).AssertOnlyViolations(helper); should.NotDependOnAny(helper.BaseClass).AssertOnlyViolations(helper); should.NotDependOnAny(helper.BaseClassSystemType).AssertOnlyViolations(helper); should.NotDependOnAny(Classes().That().Are(helper.BaseClass)).AssertOnlyViolations(helper); should.NotDependOnAny([helper.BaseClass]).AssertOnlyViolations(helper); should.NotDependOnAny([helper.BaseClassSystemType]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent type"); - should = Types().That().Are(helper.ChildClass).Should(); - should.NotDependOnAny(helper.NonExistentObjectName).AssertNoViolations(helper); - should.NotDependOnAny([helper.NonExistentObjectName]).AssertNoViolations(helper); - helper.AddSnapshotHeader("Type outside of architecture"); should = Types().That().Are(helper.ChildClass).Should(); should @@ -1886,18 +1588,11 @@ public async Task NotDependOnAnyTest() helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ChildClass).Should(); - should.NotDependOnAny(new List()).AssertNoViolations(helper); should.NotDependOnAny(new List()).AssertNoViolations(helper); should.NotDependOnAny(new List()).AssertNoViolations(helper); - should - .NotDependOnAny(Classes().That().Are(helper.NonExistentObjectName)) - .AssertNoViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ChildClass).Should(); - should - .NotDependOnAny([helper.ClassWithoutDependencies.FullName, helper.BaseClass.FullName]) - .AssertOnlyViolations(helper); should .NotDependOnAny(helper.ClassWithoutDependencies, helper.BaseClass) .AssertOnlyViolations(helper); @@ -1913,12 +1608,6 @@ public async Task NotDependOnAnyTest() helper.AddSnapshotHeader("Input with multiple dependencies"); should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); - should - .NotDependOnAny("^.*\\.(BaseClassWithMember|OtherBaseClass)$", true) - .AssertOnlyViolations(helper); - should - .NotDependOnAny([helper.BaseClassWithMember.FullName, helper.OtherBaseClass.FullName]) - .AssertOnlyViolations(helper); should .NotDependOnAny(helper.BaseClassWithMember, helper.OtherBaseClass) .AssertOnlyViolations(helper); @@ -1958,10 +1647,6 @@ public async Task NotHaveAnyAttributesTest() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should.NotHaveAnyAttributes(helper.UnusedAttribute.FullName).AssertNoViolations(helper); - should.NotHaveAnyAttributes("^.*\\.UnusedAttribute$", true).AssertNoViolations(helper); - should.NotHaveAnyAttributes([helper.UnusedAttribute.FullName]).AssertNoViolations(helper); - should.NotHaveAnyAttributes("^.*\\.UnusedAttribute$", true).AssertNoViolations(helper); should.NotHaveAnyAttributes(helper.UnusedAttribute).AssertNoViolations(helper); should.NotHaveAnyAttributes([helper.UnusedAttribute]).AssertNoViolations(helper); should.NotHaveAnyAttributes(helper.UnusedAttributeSystemType).AssertNoViolations(helper); @@ -1972,8 +1657,6 @@ public async Task NotHaveAnyAttributesTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should.NotHaveAnyAttributes(helper.Attribute1.FullName).AssertOnlyViolations(helper); - should.NotHaveAnyAttributes([helper.Attribute1.FullName]).AssertOnlyViolations(helper); should.NotHaveAnyAttributes(helper.Attribute1).AssertOnlyViolations(helper); should.NotHaveAnyAttributes([helper.Attribute1]).AssertOnlyViolations(helper); should.NotHaveAnyAttributes(helper.Attribute1SystemType).AssertOnlyViolations(helper); @@ -1982,11 +1665,6 @@ public async Task NotHaveAnyAttributesTest() .NotHaveAnyAttributes(Attributes().That().Are(helper.Attribute1)) .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent attribute"); - should = Types().That().Are(helper.ClassWithoutAttributes).Should(); - should.NotHaveAnyAttributes(helper.NonExistentObjectName).AssertNoViolations(helper); - should.NotHaveAnyAttributes([helper.NonExistentObjectName]).AssertNoViolations(helper); - helper.AddSnapshotHeader("Type outside of architecture"); should = Types().That().Are(helper.ClassWithAttributes).Should(); should @@ -1995,17 +1673,12 @@ public async Task NotHaveAnyAttributesTest() helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ClassWithoutAttributes).Should(); - should.NotHaveAnyAttributes(new List()).AssertNoViolations(helper); should.NotHaveAnyAttributes(new List()).AssertNoViolations(helper); should.NotHaveAnyAttributes(new List()).AssertNoViolations(helper); should - .NotHaveAnyAttributes(Attributes().That().Are(helper.NonExistentObjectName)) - .AssertNoViolations(helper); - should = Types().That().Are(helper.NonExistentObjectName).Should(); - should - .NotHaveAnyAttributes(new List()) - .WithoutRequiringPositiveResults() + .NotHaveAnyAttributes(Attributes().That().HaveFullName(helper.NonExistentObjectName)) .AssertNoViolations(helper); + should = Types().That().HaveFullName(helper.NonExistentObjectName).Should(); should .NotHaveAnyAttributes(new List()) .WithoutRequiringPositiveResults() @@ -2015,15 +1688,12 @@ public async Task NotHaveAnyAttributesTest() .WithoutRequiringPositiveResults() .AssertNoViolations(helper); should - .NotHaveAnyAttributes(Attributes().That().Are(helper.NonExistentObjectName)) + .NotHaveAnyAttributes(Attributes().That().HaveFullName(helper.NonExistentObjectName)) .WithoutRequiringPositiveResults() .AssertNoViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithAttributes).Should(); - should - .NotHaveAnyAttributes([helper.Attribute1.FullName, helper.Attribute2.FullName]) - .AssertOnlyViolations(helper); should .NotHaveAnyAttributes(helper.Attribute1, helper.Attribute2) .AssertOnlyViolations(helper); @@ -2248,18 +1918,6 @@ public async Task NotHaveAttributeWithArgumentsTest() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations with type arguments"); var should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute2Parameter1Value - ) - .AssertNoViolations(helper); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute2Parameter1Value] - ) - .AssertNoViolations(helper); should .NotHaveAttributeWithArguments(helper.Attribute1, helper.Attribute2Parameter1Value) .AssertNoViolations(helper); @@ -2281,18 +1939,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("No violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute2Parameter1Value - ) - .AssertNoViolations(helper); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute2Parameter1Value] - ) - .AssertNoViolations(helper); should .NotHaveAttributeWithArguments(helper.Attribute1, helper.Attribute2Parameter1Value) .AssertNoViolations(helper); @@ -2314,18 +1960,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Violations with type arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute1Parameter1Value - ) - .AssertOnlyViolations(helper); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter1Value] - ) - .AssertOnlyViolations(helper); should .NotHaveAttributeWithArguments(helper.Attribute1, helper.Attribute1Parameter1Value) .AssertOnlyViolations(helper); @@ -2347,18 +1981,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute1Parameter2Value - ) - .AssertOnlyViolations(helper); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter2Value] - ) - .AssertOnlyViolations(helper); should .NotHaveAttributeWithArguments(helper.Attribute1, helper.Attribute1Parameter2Value) .AssertOnlyViolations(helper); @@ -2380,18 +2002,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Unused attribute"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments( - helper.UnusedAttribute.FullName, - helper.Attribute1Parameter1Value - ) - .AssertNoViolations(helper); - should - .NotHaveAttributeWithArguments( - helper.UnusedAttribute.FullName, - [helper.Attribute1Parameter1Value] - ) - .AssertNoViolations(helper); should .NotHaveAttributeWithArguments(helper.UnusedAttribute, helper.Attribute1Parameter1Value) .AssertNoViolations(helper); @@ -2422,9 +2032,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Null argument"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments(helper.UnusedAttribute.FullName, null) - .AssertNoViolations(helper); should .NotHaveAttributeWithArguments(helper.UnusedAttribute, null) .AssertNoViolations(helper); @@ -2434,9 +2041,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments(helper.Attribute1.FullName, []) - .AssertOnlyViolations(helper); should.NotHaveAttributeWithArguments(helper.Attribute1, []).AssertOnlyViolations(helper); should .NotHaveAttributeWithArguments(helper.Attribute1SystemType, []) @@ -2444,19 +2048,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute1Parameter3Value, - helper.Attribute1Parameter2Value - ) - .AssertOnlyViolations(helper); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter3Value, helper.Attribute1Parameter2Value] - ) - .AssertOnlyViolations(helper); should .NotHaveAttributeWithArguments( helper.Attribute1, @@ -2486,18 +2077,6 @@ public async Task NotHaveAttributeWithArgumentsTest() helper.AddSnapshotHeader("Multiple inputs"); should = Types().That().Are(helper.ClassWithArguments, helper.ClassWithAttributes).Should(); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - helper.Attribute1Parameter1Value - ) - .AssertAnyViolations(helper); - should - .NotHaveAttributeWithArguments( - helper.Attribute1.FullName, - [helper.Attribute1Parameter1Value] - ) - .AssertAnyViolations(helper); should .NotHaveAttributeWithArguments(helper.Attribute1, helper.Attribute1Parameter1Value) .AssertAnyViolations(helper); @@ -2526,18 +2105,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations with type arguments"); var should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute2NamedParameter1Pair - ) - .AssertNoViolations(helper); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute2NamedParameter1Pair] - ) - .AssertNoViolations(helper); should .NotHaveAttributeWithNamedArguments( helper.Attribute1, @@ -2565,18 +2132,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() helper.AddSnapshotHeader("No violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute2NamedParameter1Pair - ) - .AssertNoViolations(helper); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute2NamedParameter1Pair] - ) - .AssertNoViolations(helper); should .NotHaveAttributeWithNamedArguments( helper.Attribute1, @@ -2604,18 +2159,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() helper.AddSnapshotHeader("Violations with type arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1Pair - ) - .AssertOnlyViolations(helper); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1Pair] - ) - .AssertOnlyViolations(helper); should .NotHaveAttributeWithNamedArguments( helper.Attribute1, @@ -2643,18 +2186,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() helper.AddSnapshotHeader("Violations with value arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter2Pair - ) - .AssertOnlyViolations(helper); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter2Pair] - ) - .AssertOnlyViolations(helper); should .NotHaveAttributeWithNamedArguments( helper.Attribute1, @@ -2682,18 +2213,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() helper.AddSnapshotHeader("Unused attribute"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithNamedArguments( - helper.UnusedAttribute.FullName, - helper.Attribute1NamedParameter1Pair - ) - .AssertNoViolations(helper); - should - .NotHaveAttributeWithNamedArguments( - helper.UnusedAttribute.FullName, - [helper.Attribute1NamedParameter1Pair] - ) - .AssertNoViolations(helper); should .NotHaveAttributeWithNamedArguments( helper.UnusedAttribute, @@ -2730,9 +2249,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithNamedArguments(helper.Attribute1.FullName, []) - .AssertOnlyViolations(helper); should .NotHaveAttributeWithNamedArguments(helper.Attribute1, []) .AssertOnlyViolations(helper); @@ -2742,19 +2258,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithArguments).Should(); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1Pair, - helper.Attribute1NamedParameter2Pair - ) - .AssertOnlyViolations(helper); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1Pair, helper.Attribute1NamedParameter2Pair] - ) - .AssertOnlyViolations(helper); should .NotHaveAttributeWithNamedArguments( helper.Attribute1, @@ -2784,18 +2287,6 @@ public async Task NotHaveAttributeWithNamedArgumentsTest() helper.AddSnapshotHeader("Multiple inputs"); should = Types().That().Are(helper.ClassWithArguments, helper.ClassWithAttributes).Should(); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - helper.Attribute1NamedParameter1Pair - ) - .AssertAnyViolations(helper); - should - .NotHaveAttributeWithNamedArguments( - helper.Attribute1.FullName, - [helper.Attribute1NamedParameter1Pair] - ) - .AssertAnyViolations(helper); should .NotHaveAttributeWithNamedArguments( helper.Attribute1, @@ -2832,9 +2323,9 @@ public async Task NotHaveNameTest() helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.BaseClass).Should(); should.NotHaveName(helper.BaseClass.FullName).AssertNoViolations(helper); - should.NotHaveName("^.*\\.Base.*$", true).AssertNoViolations(helper); + should.NotHaveNameMatching("^.*\\.Base.*$").AssertNoViolations(helper); should.NotHaveFullName(helper.BaseClass.Name).AssertNoViolations(helper); - should.NotHaveFullName("^Base.*$", true).AssertNoViolations(helper); + should.NotHaveFullNameMatching("^Base.*$").AssertNoViolations(helper); should.NotHaveNameContaining(helper.BaseClass.Namespace.Name).AssertNoViolations(helper); should.NotHaveFullNameContaining(helper.NonExistentObjectName).AssertNoViolations(helper); should.NotHaveNameStartingWith(helper.BaseClass.Namespace.Name).AssertNoViolations(helper); @@ -2843,9 +2334,9 @@ public async Task NotHaveNameTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.BaseClass).Should(); should.NotHaveName(helper.BaseClass.Name).AssertOnlyViolations(helper); - should.NotHaveName("^Base.*$", true).AssertOnlyViolations(helper); + should.NotHaveNameMatching("^Base.*$").AssertOnlyViolations(helper); should.NotHaveFullName(helper.BaseClass.FullName).AssertOnlyViolations(helper); - should.NotHaveFullName("^.*\\.Base.*$", true).AssertOnlyViolations(helper); + should.NotHaveFullNameMatching("^.*\\.Base.*$").AssertOnlyViolations(helper); should.NotHaveNameContaining("Base").AssertOnlyViolations(helper); should .NotHaveFullNameContaining(helper.BaseClass.Namespace.Name) @@ -2861,10 +2352,6 @@ public async Task OnlyDependOnTest() var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ChildClass).Should(); - should.OnlyDependOn(helper.BaseClass.FullName).AssertNoViolations(helper); - should.OnlyDependOn("^.*\\.BaseClass$", true).AssertNoViolations(helper); - should.OnlyDependOn([helper.BaseClass.FullName]).AssertNoViolations(helper); - should.OnlyDependOn(["^.*\\.BaseClass$"], true).AssertNoViolations(helper); should.OnlyDependOn(helper.BaseClass).AssertNoViolations(helper); should.OnlyDependOn(helper.BaseClassSystemType).AssertNoViolations(helper); should.OnlyDependOn(Classes().That().Are(helper.BaseClass)).AssertNoViolations(helper); @@ -2873,19 +2360,12 @@ public async Task OnlyDependOnTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); - should.OnlyDependOn(helper.BaseClass.FullName).AssertOnlyViolations(helper); - should.OnlyDependOn([helper.BaseClass.FullName]).AssertOnlyViolations(helper); should.OnlyDependOn(helper.BaseClass).AssertOnlyViolations(helper); should.OnlyDependOn(helper.BaseClassSystemType).AssertOnlyViolations(helper); should.OnlyDependOn(Classes().That().Are(helper.BaseClass)).AssertOnlyViolations(helper); should.OnlyDependOn([helper.BaseClass]).AssertOnlyViolations(helper); should.OnlyDependOn([helper.BaseClassSystemType]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent type"); - should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); - should.OnlyDependOn(helper.NonExistentObjectName).AssertOnlyViolations(helper); - should.OnlyDependOn([helper.NonExistentObjectName]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Type outside of architecture"); should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); should @@ -2894,18 +2374,14 @@ public async Task OnlyDependOnTest() helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); - should.OnlyDependOn(new List()).AssertOnlyViolations(helper); should.OnlyDependOn(new List()).AssertOnlyViolations(helper); should.OnlyDependOn(new List()).AssertOnlyViolations(helper); should - .OnlyDependOn(Classes().That().Are(helper.NonExistentObjectName)) + .OnlyDependOn(Classes().That().HaveFullName(helper.NonExistentObjectName)) .AssertOnlyViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); - should - .OnlyDependOn([helper.BaseClass.FullName, helper.OtherBaseClass.FullName]) - .AssertOnlyViolations(helper); should.OnlyDependOn(helper.BaseClass, helper.OtherBaseClass).AssertOnlyViolations(helper); should.OnlyDependOn([helper.BaseClass, helper.OtherBaseClass]).AssertOnlyViolations(helper); should @@ -2926,11 +2402,11 @@ public async Task OnlyDependOnTypesThatTest() var helper = new DependencyAssemblyTestHelper(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ChildClass).Should(); - should.OnlyDependOnTypesThat().Are(helper.BaseClass.FullName).AssertNoViolations(helper); + should.OnlyDependOnTypesThat().Are(helper.BaseClass).AssertNoViolations(helper); helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ClassWithMultipleDependencies).Should(); - should.OnlyDependOnTypesThat().Are(helper.BaseClass.FullName).AssertOnlyViolations(helper); + should.OnlyDependOnTypesThat().Are(helper.BaseClass).AssertOnlyViolations(helper); await helper.AssertSnapshotMatches(); } @@ -2940,10 +2416,6 @@ public async Task OnlyHaveAttributesTest() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should.OnlyHaveAttributes(helper.Attribute1.FullName).AssertNoViolations(helper); - should.OnlyHaveAttributes("^.*\\.Attribute1$", true).AssertNoViolations(helper); - should.OnlyHaveAttributes([helper.Attribute1.FullName]).AssertNoViolations(helper); - should.OnlyHaveAttributes(["^.*\\.Attribute1$"], true).AssertNoViolations(helper); should.OnlyHaveAttributes(helper.Attribute1).AssertNoViolations(helper); should.OnlyHaveAttributes([helper.Attribute1]).AssertNoViolations(helper); should.OnlyHaveAttributes(helper.Attribute1SystemType).AssertNoViolations(helper); @@ -2954,8 +2426,6 @@ public async Task OnlyHaveAttributesTest() helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should.OnlyHaveAttributes(helper.UnusedAttribute.FullName).AssertOnlyViolations(helper); - should.OnlyHaveAttributes([helper.UnusedAttribute.FullName]).AssertOnlyViolations(helper); should.OnlyHaveAttributes(helper.UnusedAttribute).AssertOnlyViolations(helper); should.OnlyHaveAttributes([helper.UnusedAttribute]).AssertOnlyViolations(helper); should.OnlyHaveAttributes(helper.UnusedAttributeSystemType).AssertOnlyViolations(helper); @@ -2964,11 +2434,6 @@ public async Task OnlyHaveAttributesTest() .OnlyHaveAttributes(Attributes().That().Are(helper.UnusedAttribute)) .AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Non-existent attribute"); - should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should.OnlyHaveAttributes(helper.NonExistentObjectName).AssertOnlyViolations(helper); - should.OnlyHaveAttributes([helper.NonExistentObjectName]).AssertOnlyViolations(helper); - helper.AddSnapshotHeader("Attribute outside of architecture"); should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); should @@ -2977,25 +2442,17 @@ public async Task OnlyHaveAttributesTest() helper.AddSnapshotHeader("Empty arguments"); should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should.OnlyHaveAttributes(new List()).AssertOnlyViolations(helper); should.OnlyHaveAttributes(new List()).AssertOnlyViolations(helper); should.OnlyHaveAttributes(new List()).AssertOnlyViolations(helper); should - .OnlyHaveAttributes(Attributes().That().Are(helper.NonExistentObjectName)) + .OnlyHaveAttributes(Attributes().That().HaveFullName(helper.NonExistentObjectName)) .AssertOnlyViolations(helper); should = Types().That().Are(helper.ClassWithoutAttributes).Should(); - should.OnlyHaveAttributes(new List()).AssertNoViolations(helper); should.OnlyHaveAttributes(new List()).AssertNoViolations(helper); should.OnlyHaveAttributes(new List()).AssertNoViolations(helper); - should - .OnlyHaveAttributes(Attributes().That().Are(helper.NonExistentObjectName)) - .AssertNoViolations(helper); helper.AddSnapshotHeader("Multiple arguments"); should = Types().That().Are(helper.ClassWithAttributes).Should(); - should - .OnlyHaveAttributes([helper.Attribute1.FullName, helper.Attribute2.FullName]) - .AssertNoViolations(helper); should.OnlyHaveAttributes(helper.Attribute1, helper.Attribute2).AssertNoViolations(helper); should .OnlyHaveAttributes([helper.Attribute1, helper.Attribute2]) @@ -3015,8 +2472,6 @@ public async Task OnlyHaveAttributesTest() .That() .Are(helper.ClassWithAttributes, helper.OtherClassWithAttributes) .Should(); - should.OnlyHaveAttributes(helper.UnusedAttribute.FullName).AssertOnlyViolations(helper); - should.OnlyHaveAttributes([helper.UnusedAttribute.FullName]).AssertOnlyViolations(helper); should.OnlyHaveAttributes(helper.UnusedAttribute).AssertOnlyViolations(helper); should.OnlyHaveAttributes([helper.UnusedAttribute]).AssertOnlyViolations(helper); should.OnlyHaveAttributes(helper.UnusedAttributeSystemType).AssertOnlyViolations(helper); @@ -3033,14 +2488,11 @@ public async Task OnlyHaveAttributesThatTest() var helper = new AttributeAssemblyTestHelpers(); helper.AddSnapshotHeader("No violations"); var should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should.OnlyHaveAttributesThat().Are(helper.Attribute1.FullName).AssertNoViolations(helper); + should.OnlyHaveAttributesThat().Are(helper.Attribute1).AssertNoViolations(helper); helper.AddSnapshotHeader("Violations"); should = Types().That().Are(helper.ClassWithSingleAttribute).Should(); - should - .OnlyHaveAttributesThat() - .Are(helper.UnusedAttribute.FullName) - .AssertOnlyViolations(helper); + should.OnlyHaveAttributesThat().Are(helper.UnusedAttribute).AssertOnlyViolations(helper); await helper.AssertSnapshotMatches(); } diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.BeTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.BeTest.verified.txt index 3499fd96b..be5d74f70 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.BeTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.BeTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ChildClass" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name matching "^.*\.ChildClass$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ChildClass" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name matching "^.*\.ChildClass$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - Query: Types that are "TypeDependencyNamespace.ChildClass" should be "TypeDependencyNamespace.ChildClass" Result: True Description: TypeDependencyNamespace.ChildClass passed @@ -56,42 +32,6 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ClassWithoutDependencies" -Result: False -Description: TypeDependencyNamespace.ChildClass does not have full name "TypeDependencyNamespace.ClassWithoutDependencies" -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ClassWithoutDependencies"" failed: - TypeDependencyNamespace.ChildClass does not have full name "TypeDependencyNamespace.ClassWithoutDependencies" - - - -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name matching "^.*\.ClassWithoutDependencies$" -Result: False -Description: TypeDependencyNamespace.ChildClass does not have full name matching "^.*\.ClassWithoutDependencies$" -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should have full name matching "^.*\.ClassWithoutDependencies$"" failed: - TypeDependencyNamespace.ChildClass does not have full name matching "^.*\.ClassWithoutDependencies$" - - - -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ClassWithoutDependencies" -Result: False -Description: TypeDependencyNamespace.ChildClass does not have full name "TypeDependencyNamespace.ClassWithoutDependencies" -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ClassWithoutDependencies"" failed: - TypeDependencyNamespace.ChildClass does not have full name "TypeDependencyNamespace.ClassWithoutDependencies" - - - -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name matching "^.*\.ClassWithoutDependencies$" -Result: False -Description: TypeDependencyNamespace.ChildClass does not have full name matching "^.*\.ClassWithoutDependencies$" -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should have full name matching "^.*\.ClassWithoutDependencies$"" failed: - TypeDependencyNamespace.ChildClass does not have full name matching "^.*\.ClassWithoutDependencies$" - - - Query: Types that are "TypeDependencyNamespace.ChildClass" should be "TypeDependencyNamespace.ClassWithoutDependencies" Result: False Description: TypeDependencyNamespace.ChildClass is not "TypeDependencyNamespace.ClassWithoutDependencies" @@ -137,26 +77,6 @@ Message: -===== Non-existent type ===== - -Query: Types that are "TypeDependencyNamespace.BaseClass" should have full name "NotTheNameOfAnyObject" -Result: False -Description: TypeDependencyNamespace.BaseClass does not have full name "NotTheNameOfAnyObject" -Message: -"Types that are "TypeDependencyNamespace.BaseClass" should have full name "NotTheNameOfAnyObject"" failed: - TypeDependencyNamespace.BaseClass does not have full name "NotTheNameOfAnyObject" - - - -Query: Types that are "TypeDependencyNamespace.BaseClass" should have full name "NotTheNameOfAnyObject" -Result: False -Description: TypeDependencyNamespace.BaseClass does not have full name "NotTheNameOfAnyObject" -Message: -"Types that are "TypeDependencyNamespace.BaseClass" should have full name "NotTheNameOfAnyObject"" failed: - TypeDependencyNamespace.BaseClass does not have full name "NotTheNameOfAnyObject" - - - ===== Empty arguments ===== Query: Types that are "TypeDependencyNamespace.BaseClass" should not exist @@ -168,15 +88,6 @@ Message: -Query: Types that are "TypeDependencyNamespace.BaseClass" should not exist -Result: False -Description: TypeDependencyNamespace.BaseClass does exist -Message: -"Types that are "TypeDependencyNamespace.BaseClass" should not exist" failed: - TypeDependencyNamespace.BaseClass does exist - - - Query: Types that are "TypeDependencyNamespace.BaseClass" should not exist Result: False Description: TypeDependencyNamespace.BaseClass is TypeDependencyNamespace.BaseClass @@ -197,15 +108,6 @@ Message: ===== Multiple arguments ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" -Result: False -Description: TypeDependencyNamespace.ChildClass does not have full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should have full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: - TypeDependencyNamespace.ChildClass does not have full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" - - - Query: Types that are "TypeDependencyNamespace.ChildClass" should be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ChildClass is not "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.CallAnyTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.CallAnyTest.verified.txt index 3470ce9af..7befa3ffe 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.CallAnyTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.CallAnyTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name matching "^.*::CalledMethod\(\)$" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name matching "^.*::CalledMethod\(\)$" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" Result: True Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed @@ -44,24 +20,6 @@ All Evaluations passed ===== Violations ===== -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()"" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" - - - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()"" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" - - - Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should call "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod() @@ -89,37 +47,8 @@ Message: -===== Non-existent method member ===== - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "NotTheNameOfAnyObject" -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any method with full name "NotTheNameOfAnyObject" -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "NotTheNameOfAnyObject"" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any method with full name "NotTheNameOfAnyObject" - - - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "NotTheNameOfAnyObject" -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any methods with full name "NotTheNameOfAnyObject" -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should calls any method with full name "NotTheNameOfAnyObject"" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call any methods with full name "NotTheNameOfAnyObject" - - - ===== Empty arguments ===== -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should call one of no methods (impossible) -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call one of no methods (always true) -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should call one of no methods (impossible)" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does not call one of no methods (always true) - - - Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should call one of no methods (impossible) Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod() @@ -140,15 +69,6 @@ Message: ===== Multiple arguments ===== -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe... -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does not call any methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should calls any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe..." failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does not call any methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" - - - Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should call "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.MethodDep... Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1() and System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2() and System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod3() diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.DependOnAnyTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.DependOnAnyTest.verified.txt index 129c319bf..7b4463556 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.DependOnAnyTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.DependOnAnyTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should depend on any types with full name "TypeDependencyNamespace.BaseClass" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should depend on any types with full name matching "^.*\.BaseClass$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should depend on any types with full name "TypeDependencyNamespace.BaseClass" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should depend on any types with full name matching "^.*\.BaseClass$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - Query: Types that are "TypeDependencyNamespace.ChildClass" should depend on "TypeDependencyNamespace.BaseClass" Result: True Description: TypeDependencyNamespace.ChildClass passed @@ -56,24 +32,6 @@ All Evaluations passed ===== Violations ===== -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does not depend on any type with full name "TypeDependencyNamespace.ClassWithoutDependencies" -Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "TypeDependencyNamespace.ClassWithoutDependencies"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does not depend on any type with full name "TypeDependencyNamespace.ClassWithoutDependencies" - - - -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does not depend any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" -Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "TypeDependencyNamespace.ClassWithoutDependencies"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does not depend any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" - - - Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass @@ -119,130 +77,92 @@ Message: -===== Non-existent type ===== - -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "NotTheNameOfAnyObject" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does not depend on any type with full name "NotTheNameOfAnyObject" -Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "NotTheNameOfAnyObject"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does not depend on any type with full name "NotTheNameOfAnyObject" - - - -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "NotTheNameOfAnyObject" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does not depend any types with full name "NotTheNameOfAnyObject" -Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "NotTheNameOfAnyObject"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does not depend any types with full name "NotTheNameOfAnyObject" - - - ===== Type outside of architecture ===== -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "AttributeNamespace.ClassWithoutAttributes" +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "AttributeNamespace.ClassWithoutAttributes" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "AttributeNamespace.ClassWithoutAttributes"" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "AttributeNamespace.ClassWithoutAttributes"" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass ===== Empty arguments ===== -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible) -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does not depend on no types (always true) -Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible)" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does not depend on no types (always true) - - - -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible) +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible) Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible)" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible)" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible) +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible) Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible)" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on one of no types (impossible)" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any Classes that have full name "NotTheNameOfAnyObject" +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any Classes that have full name "NotTheNameOfAnyObject" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any Classes that have full name "NotTheNameOfAnyObject"" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any Classes that have full name "NotTheNameOfAnyObject"" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass ===== Multiple arguments ===== -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does not depend any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" -Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does not depend any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" - - - -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass -Query: Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that have full name "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass ===== Input without dependencies ===== -Query: Types that are "TypeDependencyNamespace.ClassWithoutDependencies" should depend on any types with full name "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.ChildClass" +Query: Types that are "TypeDependencyNamespace.ClassWithoutDependencies" should depend on "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.ChildClass" Result: False -Description: TypeDependencyNamespace.ClassWithoutDependencies does not depend any types with full name "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.ChildClass" +Description: TypeDependencyNamespace.ClassWithoutDependencies does depend on System.Object Message: -"Types that are "TypeDependencyNamespace.ClassWithoutDependencies" should depend on any types with full name "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.ChildClass"" failed: - TypeDependencyNamespace.ClassWithoutDependencies does not depend any types with full name "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.ChildClass" +"Types that are "TypeDependencyNamespace.ClassWithoutDependencies" should depend on "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.ChildClass"" failed: + TypeDependencyNamespace.ClassWithoutDependencies does depend on System.Object diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAnyAttributesTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAnyAttributesTest.verified.txt index a8a00b944..b41d686f8 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAnyAttributesTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAnyAttributesTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "AttributeNamespace.Attribute1" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name matching "^.*\.Attribute1$" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "AttributeNamespace.Attribute1" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name matching "^.*\.Attribute1$" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.Attribute1" Result: True Description: AttributeNamespace.ClassWithAttributes passed @@ -56,24 +32,6 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not have any attribute with full name "AttributeNamespace.UnusedAttribute" -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "AttributeNamespace.UnusedAttribute"" failed: - AttributeNamespace.ClassWithAttributes does not have any attribute with full name "AttributeNamespace.UnusedAttribute" - - - -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not have any attribute with full name "AttributeNamespace.UnusedAttribute" -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "AttributeNamespace.UnusedAttribute"" failed: - AttributeNamespace.ClassWithAttributes does not have any attribute with full name "AttributeNamespace.UnusedAttribute" - - - Query: Types that are "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.UnusedAttribute" Result: False Description: AttributeNamespace.ClassWithAttributes does not have attribute "AttributeNamespace.UnusedAttribute" @@ -119,26 +77,6 @@ Message: -===== Non-existent attribute ===== - -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "NotTheNameOfAnyObject" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not have any attribute with full name "NotTheNameOfAnyObject" -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "NotTheNameOfAnyObject"" failed: - AttributeNamespace.ClassWithAttributes does not have any attribute with full name "NotTheNameOfAnyObject" - - - -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "NotTheNameOfAnyObject" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not have any attribute with full name "NotTheNameOfAnyObject" -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "NotTheNameOfAnyObject"" failed: - AttributeNamespace.ClassWithAttributes does not have any attribute with full name "NotTheNameOfAnyObject" - - - ===== Empty arguments ===== Query: Types that are "AttributeNamespace.ClassWithAttributes" should have one of no attributes (impossible) @@ -159,15 +97,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have one of no attributes (impossible) -Result: False -Description: AttributeNamespace.ClassWithAttributes does not have one of no attributes (always true) -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" should have one of no attributes (impossible)" failed: - AttributeNamespace.ClassWithAttributes does not have one of no attributes (always true) - - - Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any Attributes that have full name "NotTheNameOfAnyObject" Result: False Description: AttributeNamespace.ClassWithAttributes does not have any Attributes that have full name "NotTheNameOfAnyObject" @@ -179,12 +108,6 @@ Message: ===== Multiple arguments ===== -Query: Types that are "AttributeNamespace.ClassWithAttributes" should have any attribute with full name "AttributeNamespace.Attribute1" or "AttributeNamespace.UnusedAttribute" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.Attribute1" or "AttributeNamespace.UnusedAttribute" Result: True Description: AttributeNamespace.ClassWithAttributes passed diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithArgumentsTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithArgumentsTest.verified.txt index fe6f034af..fc6d2b161 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithArgumentsTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithArgumentsTest.verified.txt @@ -24,18 +24,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== No violations with value arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "Argument" @@ -62,18 +50,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== Violations with type arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" @@ -112,24 +88,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" - - - ===== Violations with value arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument" @@ -168,35 +126,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "OtherArgument" - - - -===== Non-existent attribute ===== - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "NotTheNameOfAnyObject" with arguments "Argument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "NotTheNameOfAnyObject" with arguments "Argument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "NotTheNameOfAnyObject" with arguments "Argument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "NotTheNameOfAnyObject" with arguments "Argument" - - - ===== Type outside of architecture ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "TypeDependencyNamespace.BaseClass" with arguments "Argument" @@ -228,15 +157,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments """ failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with arguments "" - - - ===== Empty arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" @@ -251,12 +171,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== Multiple arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "Argument" and "0" @@ -283,12 +197,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "Argument" and "0" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== Multiple inputs ===== Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.OtherClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with arguments "Argument" diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithNamedArguments.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithNamedArguments.verified.txt index d3befb95c..4c6f0dbda 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithNamedArguments.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveAttributeWithNamedArguments.verified.txt @@ -24,18 +24,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== No violations with value arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" @@ -62,18 +50,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== Violations with type arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument" @@ -112,42 +88,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=AttributeNamespace.NamedTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" - - - Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" Result: False Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.OtherNamedTypeArgument" @@ -222,42 +162,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter2=NamedArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" - - - Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" Result: False Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=OtherNamedArgument" @@ -332,24 +236,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - ===== Type outside of architecture ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "TypeDependencyNamespace.BaseClass" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" @@ -375,12 +261,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== Multiple arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter... @@ -419,24 +299,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter... -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter2=3" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter..." failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter2=3" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter... -Result: False -Description: AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter2=3" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter..." failed: - AttributeNamespace.ClassWithArguments does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "OtherNamedParameter2=3" - - - ===== Multiple inputs ===== Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" @@ -483,25 +345,3 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -"Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithAttributes does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -"Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithAttributes does not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveNameTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveNameTest.verified.txt index 3bb7c59e6..06d62f034 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveNameTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.HaveNameTest.verified.txt @@ -1,12 +1,12 @@ ===== No violations ===== -Query: Types that are "TypeDependencyNamespace.BaseClass" should have full name "BaseClass" +Query: Types that are "TypeDependencyNamespace.BaseClass" should have name "BaseClass" Result: True Description: TypeDependencyNamespace.BaseClass passed Message: All Evaluations passed -Query: Types that are "TypeDependencyNamespace.BaseClass" should have full name matching "^Base.*$" +Query: Types that are "TypeDependencyNamespace.BaseClass" should have name matching "^Base.*$" Result: True Description: TypeDependencyNamespace.BaseClass passed Message: @@ -50,20 +50,20 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "TypeDependencyNamespace.BaseClass" should have full name "TypeDependencyNamespace.BaseClass" +Query: Types that are "TypeDependencyNamespace.BaseClass" should have name "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.BaseClass does have name BaseClass Message: -"Types that are "TypeDependencyNamespace.BaseClass" should have full name "TypeDependencyNamespace.BaseClass"" failed: +"Types that are "TypeDependencyNamespace.BaseClass" should have name "TypeDependencyNamespace.BaseClass"" failed: TypeDependencyNamespace.BaseClass does have name BaseClass -Query: Types that are "TypeDependencyNamespace.BaseClass" should have full name "^.*\.Base.*$" +Query: Types that are "TypeDependencyNamespace.BaseClass" should have name "^.*\.Base.*$" Result: False Description: TypeDependencyNamespace.BaseClass does have name BaseClass Message: -"Types that are "TypeDependencyNamespace.BaseClass" should have full name "^.*\.Base.*$"" failed: +"Types that are "TypeDependencyNamespace.BaseClass" should have name "^.*\.Base.*$"" failed: TypeDependencyNamespace.BaseClass does have name BaseClass diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotBeTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotBeTest.verified.txt index 50ece354b..ab6d20fdd 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotBeTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotBeTest.verified.txt @@ -1,6 +1,6 @@ ===== No violations ===== -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "TypeDependencyNamespace.ClassWithoutDependencies" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -8,7 +8,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name matching "^.*\.ClassWithoutDependencies$" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -16,7 +16,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "TypeDependencyNamespace.ClassWithoutDependencies" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be Classes that are "TypeDependencyNamespace.ClassWithoutDependencies" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -24,7 +24,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name matching "^.*\.ClassWithoutDependencies$" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -32,39 +32,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be Classes that are "TypeDependencyNamespace.ClassWithoutDependencies" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -74,112 +42,64 @@ All Evaluations passed ===== Violations ===== -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "TypeDependencyNamespace.ChildClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" Result: False Description: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass Result: True Description: TypeDependencyNamespace.OtherChildClass passed Message: -"Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "TypeDependencyNamespace.ChildClass"" failed: +"Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "TypeDependencyNamespace.ChildClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" Result: False Description: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass Result: True Description: TypeDependencyNamespace.OtherChildClass passed Message: -"Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "TypeDependencyNamespace.ChildClass"" failed: +"Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" -Result: False -Description: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -"Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: - TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass - - - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" -Result: False -Description: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -"Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: - TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass - - - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be Classes that are "TypeDependencyNamespace.ChildClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be Classes that are "TypeDependencyNamespace.ChildClass" Result: False Description: TypeDependencyNamespace.ChildClass is Classes that are "TypeDependencyNamespace.ChildClass" Result: True Description: TypeDependencyNamespace.OtherChildClass passed Message: -"Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be Classes that are "TypeDependencyNamespace.ChildClass"" failed: +"Types that depend on "TypeDependencyNamespace.BaseClass" should not be Classes that are "TypeDependencyNamespace.ChildClass"" failed: TypeDependencyNamespace.ChildClass is Classes that are "TypeDependencyNamespace.ChildClass" -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" Result: False Description: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass Result: True Description: TypeDependencyNamespace.OtherChildClass passed Message: -"Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: +"Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass" Result: False Description: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass Result: True Description: TypeDependencyNamespace.OtherChildClass passed Message: -"Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: +"Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ChildClass"" failed: TypeDependencyNamespace.ChildClass is TypeDependencyNamespace.ChildClass -===== Non-existent type ===== - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "NotTheNameOfAnyObject" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "NotTheNameOfAnyObject" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - ===== Empty arguments ===== -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should exist -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should exist +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should exist Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -187,7 +107,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be no type (always true) +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be no type (always true) Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -195,7 +115,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be Classes that have full name "NotTheNameOfAnyObject" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be Classes that have full name "NotTheNameOfAnyObject" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -205,15 +125,7 @@ All Evaluations passed ===== Multiple arguments ===== -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not have full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Result: True -Description: TypeDependencyNamespace.OtherChildClass passed -Message: -All Evaluations passed - -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -221,7 +133,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -229,7 +141,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True @@ -237,7 +149,7 @@ Description: TypeDependencyNamespace.OtherChildClass passed Message: All Evaluations passed -Query: Types that depend on any types with full name "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" +Query: Types that depend on "TypeDependencyNamespace.BaseClass" should not be "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: True Description: TypeDependencyNamespace.ChildClass passed Result: True diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotCallAnyTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotCallAnyTest.verified.txt index 61e80e420..c75d45b68 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotCallAnyTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotCallAnyTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call any method with full name matching "^.*\.MethodWithoutDependencies$" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call any method with full name matching "^.*\.MethodWithoutDependencies$" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" Result: True Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed @@ -44,24 +20,6 @@ All Evaluations passed ===== Violations ===== -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod() -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call any method with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()"" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod() - - - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod() -Message: -"Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()"" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod() - - - Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call "System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod()" Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod() @@ -89,20 +47,6 @@ Message: -===== Non-existent method member ===== - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call any method with full name "NotTheNameOfAnyObject" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call methods with full name "NotTheNameOfAnyObject" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - ===== Empty arguments ===== Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call no methods (always true) @@ -111,38 +55,8 @@ Description: System.Void MethodDependencyNamespace.MethodDependencyClass::Method Message: All Evaluations passed -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call no methods (always true) -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency()" should not call Method members that have full name "NotTheNameOfAnyObject" -Result: True -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithSingleDependency() passed -Message: -All Evaluations passed - ===== Multiple arguments ===== -Query: Method members that are "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies()" should not call any method with full name matching "^.*::(MethodWithoutDependencies|CalledMethod[0-9])\(\)$" -Result: False -Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call 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 not call any method with full name matching "^.*::(MethodWithoutDependencies|CalledMethod[0-9])\(\)$"" failed: - System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call 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 not call methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe... -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 methods with full name "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDe..." 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 "System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithoutDependencies()" or "System.Void MethodDependencyNamespace.Metho... Result: False Description: System.Void MethodDependencyNamespace.MethodDependencyClass::MethodWithMultipleDependencies() does call System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod1() and System.Void MethodDependencyNamespace.MethodDependencyClass::CalledMethod2() diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotDependOnAnyTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotDependOnAnyTest.verified.txt index 570c9d677..bac227e89 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotDependOnAnyTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotDependOnAnyTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on any types with full name "TypeDependencyNamespace.ClassWithoutDependencies" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on any types with full name matching "^.*\.ClassWithoutDependencies$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on types with full name "TypeDependencyNamespace.ClassWithoutDependencies" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on any types with full name matching "^.*\.ClassWithoutDependencies$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on "TypeDependencyNamespace.ClassWithoutDependencies" Result: True Description: TypeDependencyNamespace.ChildClass passed @@ -56,24 +32,6 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on any types with full name "TypeDependencyNamespace.BaseClass" -Result: False -Description: TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass and TypeDependencyNamespace.BaseClass -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should not depend on any types with full name "TypeDependencyNamespace.BaseClass"" failed: - TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass and TypeDependencyNamespace.BaseClass - - - -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on types with full name "TypeDependencyNamespace.BaseClass" -Result: False -Description: TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass and TypeDependencyNamespace.BaseClass -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should not depend on types with full name "TypeDependencyNamespace.BaseClass"" failed: - TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass and TypeDependencyNamespace.BaseClass - - - Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass @@ -119,20 +77,6 @@ Message: -===== Non-existent type ===== - -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on any types with full name "NotTheNameOfAnyObject" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on types with full name "NotTheNameOfAnyObject" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - ===== Type outside of architecture ===== Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on "AttributeNamespace.ClassWithoutAttributes" @@ -155,29 +99,8 @@ Description: TypeDependencyNamespace.ChildClass passed Message: All Evaluations passed -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on no types (always true) -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on Classes that have full name "NotTheNameOfAnyObject" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - ===== Multiple arguments ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on types with full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" -Result: False -Description: TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass and TypeDependencyNamespace.BaseClass -Message: -"Types that are "TypeDependencyNamespace.ChildClass" should not depend on types with full name "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass"" failed: - TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass and TypeDependencyNamespace.BaseClass - - - Query: Types that are "TypeDependencyNamespace.ChildClass" should not depend on "TypeDependencyNamespace.ClassWithoutDependencies" or "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ChildClass does depend on TypeDependencyNamespace.BaseClass @@ -216,24 +139,6 @@ Message: ===== Input with multiple dependencies ===== -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should not depend on any types with full name matching "^.*\.(BaseClassWithMember|OtherBaseClass)$" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should not depend on any types with full name matching "^.*\.(BaseClassWithMember|OtherBaseClass)$"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass - - - -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should not depend on types with full name "TypeDependencyNamespace.BaseClassWithMember" or "TypeDependencyNamespace.OtherBaseClass" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should not depend on types with full name "TypeDependencyNamespace.BaseClassWithMember" or "TypeDependencyNamespace.OtherBaseClass"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass - - - Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should not depend on "TypeDependencyNamespace.BaseClassWithMember" or "TypeDependencyNamespace.OtherBaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAnyAttributesTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAnyAttributesTest.verified.txt index 1129315d2..40aaee752 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAnyAttributesTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAnyAttributesTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name "AttributeNamespace.UnusedAttribute" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name matching "^.*\.UnusedAttribute$" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name "AttributeNamespace.UnusedAttribute" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name matching "^.*\.UnusedAttribute$" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have attribute "AttributeNamespace.UnusedAttribute" Result: True Description: AttributeNamespace.ClassWithSingleAttribute passed @@ -56,24 +32,6 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name "AttributeNamespace.Attribute1" -Result: False -Description: AttributeNamespace.ClassWithSingleAttribute does have any attribute with full name "AttributeNamespace.Attribute1" -Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name "AttributeNamespace.Attribute1"" failed: - AttributeNamespace.ClassWithSingleAttribute does have any attribute with full name "AttributeNamespace.Attribute1" - - - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name "AttributeNamespace.Attribute1" -Result: False -Description: AttributeNamespace.ClassWithSingleAttribute does have any attribute with full name "AttributeNamespace.Attribute1" -Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have any attribute with full name "AttributeNamespace.Attribute1"" failed: - AttributeNamespace.ClassWithSingleAttribute does have any attribute with full name "AttributeNamespace.Attribute1" - - - Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should not have attribute "AttributeNamespace.Attribute1" Result: False Description: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 @@ -119,20 +77,6 @@ Message: -===== Non-existent attribute ===== - -Query: Types that are "AttributeNamespace.ClassWithoutAttributes" should not have any attribute with full name "NotTheNameOfAnyObject" -Result: True -Description: AttributeNamespace.ClassWithoutAttributes passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithoutAttributes" should not have any attribute with full name "NotTheNameOfAnyObject" -Result: True -Description: AttributeNamespace.ClassWithoutAttributes passed -Message: -All Evaluations passed - ===== Type outside of architecture ===== Query: Types that are "AttributeNamespace.ClassWithAttributes" should not have attribute "TypeDependencyNamespace.BaseClass" @@ -155,12 +99,6 @@ Description: AttributeNamespace.ClassWithoutAttributes passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithoutAttributes" should not have one of no attributes (always true) -Result: True -Description: AttributeNamespace.ClassWithoutAttributes passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithoutAttributes" should not have any Attributes that have full name "NotTheNameOfAnyObject" Result: True Description: AttributeNamespace.ClassWithoutAttributes passed @@ -175,25 +113,12 @@ Query: Types that have full name "NotTheNameOfAnyObject" should not have one of Message: All Evaluations passed -Query: Types that have full name "NotTheNameOfAnyObject" should not have one of no attributes (always true) -Message: -All Evaluations passed - Query: Types that have full name "NotTheNameOfAnyObject" should not have any Attributes that have full name "NotTheNameOfAnyObject" Message: All Evaluations passed ===== Multiple arguments ===== -Query: Types that are "AttributeNamespace.ClassWithAttributes" should not have any attribute with full name "AttributeNamespace.Attribute1" or "AttributeNamespace.Attribute2" -Result: False -Description: AttributeNamespace.ClassWithAttributes does have any attribute with full name "AttributeNamespace.Attribute1" or "AttributeNamespace.Attribute2" -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" should not have any attribute with full name "AttributeNamespace.Attribute1" or "AttributeNamespace.Attribute2"" failed: - AttributeNamespace.ClassWithAttributes does have any attribute with full name "AttributeNamespace.Attribute1" or "AttributeNamespace.Attribute2" - - - Query: Types that are "AttributeNamespace.ClassWithAttributes" should not have attribute "AttributeNamespace.Attribute1" or "AttributeNamespace.Attribute2" Result: False Description: AttributeNamespace.ClassWithAttributes does have attribute AttributeNamespace.Attribute1 and AttributeNamespace.Attribute2 diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithArgumentsTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithArgumentsTest.verified.txt index 6abd90820..79a4cf958 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithArgumentsTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithArgumentsTest.verified.txt @@ -1,17 +1,5 @@ ===== No violations with type arguments ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" Result: True Description: AttributeNamespace.ClassWithArguments passed @@ -38,18 +26,6 @@ All Evaluations passed ===== No violations with value arguments ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.OtherTypeArgument" Result: True Description: AttributeNamespace.ClassWithArguments passed @@ -76,24 +52,6 @@ All Evaluations passed ===== Violations with type arguments ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" - - - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" Result: False Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with arguments "Argument" @@ -132,24 +90,6 @@ Message: ===== Violations with value arguments ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "0" -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "0" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "0"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "0" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "0" -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "0" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "0"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "0" - - - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with arguments "0" Result: False Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with arguments "0" @@ -188,18 +128,6 @@ Message: ===== Unused attribute ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.UnusedAttribute" with arguments "Argument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.UnusedAttribute" with arguments "Argument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.UnusedAttribute" with arguments "Argument" Result: True Description: AttributeNamespace.ClassWithArguments passed @@ -234,12 +162,6 @@ All Evaluations passed ===== Null argument ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.UnusedAttribute" with arguments "" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.UnusedAttribute" with arguments "" Result: True Description: AttributeNamespace.ClassWithArguments passed @@ -254,15 +176,6 @@ All Evaluations passed ===== Empty arguments ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" - - - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" Result: False Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" @@ -283,24 +196,6 @@ Message: ===== Multiple arguments ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" - - - Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" Result: False Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with arguments "AttributeNamespace.TypeArgument" and "0" @@ -339,28 +234,6 @@ Message: ===== Multiple inputs ===== -Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Result: False -Description: AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should not have attribute "AttributeNamespace.Attribute1" with arguments "Argument"" failed: - AttributeNamespace.ClassWithArguments does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" - - - Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should does have attribute "AttributeNamespace.Attribute1" with arguments "Argument" Result: True Description: AttributeNamespace.ClassWithAttributes passed diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt index 05c29aa54..fd8df0b63 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.NotHaveAttributeWithNamedArgumentsTest.verified.txt @@ -24,18 +24,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=OtherNamedArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=OtherNamedArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== No violations with value arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=OtherNamedArgument" @@ -62,18 +50,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=OtherNamedArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "OtherNamedParameter1=OtherNamedArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== Violations with type arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" @@ -112,24 +88,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - ===== Violations with value arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" @@ -168,24 +126,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument"" failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument"" failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter2=NamedArgument" - - - ===== Unused attribute ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" @@ -212,18 +152,6 @@ Description: AttributeNamespace.ClassWithArguments passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.UnusedAttribute" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithArguments passed -Message: -All Evaluations passed - ===== Type outside of architecture ===== Query: Types that are "AttributeNamespace.ClassWithAttributes" should does have attribute "TypeDependencyNamespace.BaseClass" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" @@ -252,15 +180,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1"" failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" - - - ===== Multiple arguments ===== Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter... @@ -299,24 +218,6 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter... -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter2=NamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter..." failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter2=NamedArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter... -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter2=NamedArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter..." failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" and "NamedParameter2=NamedArgument" - - - ===== Multiple inputs ===== Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" @@ -363,25 +264,3 @@ Message: -Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - -Query: Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Result: False -Description: AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" -Message: -"Types that are "AttributeNamespace.ClassWithArguments" or "AttributeNamespace.ClassWithAttributes" should does have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument"" failed: - AttributeNamespace.ClassWithArguments not have attribute "AttributeNamespace.Attribute1" with named arguments "NamedParameter1=AttributeNamespace.NamedTypeArgument" - - - diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTest.verified.txt index 7863ac402..da5f6370b 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should only depend on types with full name "TypeDependencyNamespace.BaseClass" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should only depend on types with full name matching "^.*\.BaseClass$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should only depend on types with full name "TypeDependencyNamespace.BaseClass" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - -Query: Types that are "TypeDependencyNamespace.ChildClass" should only depend on types with full name matching "^.*\.BaseClass$" -Result: True -Description: TypeDependencyNamespace.ChildClass passed -Message: -All Evaluations passed - Query: Types that are "TypeDependencyNamespace.ChildClass" should only depend on "TypeDependencyNamespace.BaseClass" Result: True Description: TypeDependencyNamespace.ChildClass passed @@ -56,24 +32,6 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "TypeDependencyNamespace.BaseClass" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "TypeDependencyNamespace.BaseClass"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object - - - -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "TypeDependencyNamespace.BaseClass" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "TypeDependencyNamespace.BaseClass"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object - - - Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass @@ -119,26 +77,6 @@ Message: -===== Non-existent type ===== - -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "NotTheNameOfAnyObject" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "NotTheNameOfAnyObject"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object - - - -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "NotTheNameOfAnyObject" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "NotTheNameOfAnyObject"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object - - - ===== Type outside of architecture ===== Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on "AttributeNamespace.ClassWithoutAttributes" @@ -152,15 +90,6 @@ Message: ===== Empty arguments ===== -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should have no dependencies -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should have no dependencies" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass and System.Object - - - Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should have no dependencies Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass @@ -190,15 +119,6 @@ Message: ===== Multiple arguments ===== -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.OtherBaseClass" -Result: False -Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and System.Object -Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types with full name "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.OtherBaseClass"" failed: - TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and System.Object - - - Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on "TypeDependencyNamespace.BaseClass" or "TypeDependencyNamespace.OtherBaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTypesThatTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTypesThatTest.verified.txt index 37fe19ee0..638bcd557 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTypesThatTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyDependOnTypesThatTest.verified.txt @@ -1,6 +1,6 @@ ===== No violations ===== -Query: Types that are "TypeDependencyNamespace.ChildClass" should only depend on types that have full name "TypeDependencyNamespace.BaseClass" +Query: Types that are "TypeDependencyNamespace.ChildClass" should only depend on types that are "TypeDependencyNamespace.BaseClass" Result: True Description: TypeDependencyNamespace.ChildClass passed Message: @@ -8,11 +8,11 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types that have full name "TypeDependencyNamespace.BaseClass" +Query: Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types that are "TypeDependencyNamespace.BaseClass" Result: False Description: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass Message: -"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types that have full name "TypeDependencyNamespace.BaseClass"" failed: +"Types that are "TypeDependencyNamespace.ClassWithMultipleDependencies" should only depend on types that are "TypeDependencyNamespace.BaseClass"" failed: TypeDependencyNamespace.ClassWithMultipleDependencies does depend on System.Object and TypeDependencyNamespace.BaseClassWithMember and TypeDependencyNamespace.OtherBaseClass diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesTest.verified.txt index 715a7f169..278ee85bd 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesTest.verified.txt @@ -1,29 +1,5 @@ ===== No violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "AttributeNamespace.Attribute1" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name matching "^.*\.Attribute1$" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "AttributeNamespace.Attribute1" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name matching "^.*\.Attribute1$" -Result: True -Description: AttributeNamespace.ClassWithSingleAttribute passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes "AttributeNamespace.Attribute1" Result: True Description: AttributeNamespace.ClassWithSingleAttribute passed @@ -56,24 +32,6 @@ All Evaluations passed ===== Violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "AttributeNamespace.UnusedAttribute" -Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "AttributeNamespace.UnusedAttribute"" failed: - AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "AttributeNamespace.UnusedAttribute" - - - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "AttributeNamespace.UnusedAttribute" -Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "AttributeNamespace.UnusedAttribute"" failed: - AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "AttributeNamespace.UnusedAttribute" - - - Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes "AttributeNamespace.UnusedAttribute" Result: False Description: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 @@ -119,26 +77,6 @@ Message: -===== Non-existent attribute ===== - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "NotTheNameOfAnyObject" -Result: False -Description: AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "NotTheNameOfAnyObject" -Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "NotTheNameOfAnyObject"" failed: - AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "NotTheNameOfAnyObject" - - - -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "NotTheNameOfAnyObject" -Result: False -Description: AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "NotTheNameOfAnyObject" -Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes with full name "NotTheNameOfAnyObject"" failed: - AttributeNamespace.ClassWithSingleAttribute does not only have attributes with full name "NotTheNameOfAnyObject" - - - ===== Attribute outside of architecture ===== Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes "TypeDependencyNamespace.BaseClass" @@ -152,15 +90,6 @@ Message: ===== Empty arguments ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should have no attributes -Result: False -Description: AttributeNamespace.ClassWithSingleAttribute does have attributes -Message: -"Types that are "AttributeNamespace.ClassWithSingleAttribute" should have no attributes" failed: - AttributeNamespace.ClassWithSingleAttribute does have attributes - - - Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should have no attributes Result: False Description: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 @@ -200,26 +129,8 @@ Description: AttributeNamespace.ClassWithoutAttributes passed Message: All Evaluations passed -Query: Types that are "AttributeNamespace.ClassWithoutAttributes" should have no attributes -Result: True -Description: AttributeNamespace.ClassWithoutAttributes passed -Message: -All Evaluations passed - -Query: Types that are "AttributeNamespace.ClassWithoutAttributes" should does only have Attributes that have full name "NotTheNameOfAnyObject" -Result: True -Description: AttributeNamespace.ClassWithoutAttributes passed -Message: -All Evaluations passed - ===== Multiple arguments ===== -Query: Types that are "AttributeNamespace.ClassWithAttributes" should only have attributes with full name "AttributeNamespace.Attribute1" and "AttributeNamespace.Attribute2" -Result: True -Description: AttributeNamespace.ClassWithAttributes passed -Message: -All Evaluations passed - Query: Types that are "AttributeNamespace.ClassWithAttributes" should only have attributes "AttributeNamespace.Attribute1" and "AttributeNamespace.Attribute2" Result: True Description: AttributeNamespace.ClassWithAttributes passed @@ -252,30 +163,6 @@ All Evaluations passed ===== Multiple inputs ===== -Query: Types that are "AttributeNamespace.ClassWithAttributes" or "AttributeNamespace.OtherClassWithAttributes" should only have attributes with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.OtherClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" or "AttributeNamespace.OtherClassWithAttributes" should only have attributes with full name "AttributeNamespace.UnusedAttribute"" failed: - AttributeNamespace.ClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" - AttributeNamespace.OtherClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" - - - -Query: Types that are "AttributeNamespace.ClassWithAttributes" or "AttributeNamespace.OtherClassWithAttributes" should only have attributes with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.ClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" -Result: False -Description: AttributeNamespace.OtherClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" -Message: -"Types that are "AttributeNamespace.ClassWithAttributes" or "AttributeNamespace.OtherClassWithAttributes" should only have attributes with full name "AttributeNamespace.UnusedAttribute"" failed: - AttributeNamespace.ClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" - AttributeNamespace.OtherClassWithAttributes does not only have attributes with full name "AttributeNamespace.UnusedAttribute" - - - Query: Types that are "AttributeNamespace.ClassWithAttributes" or "AttributeNamespace.OtherClassWithAttributes" should only have attributes "AttributeNamespace.UnusedAttribute" Result: False Description: AttributeNamespace.ClassWithAttributes does have attribute AttributeNamespace.Attribute1 and AttributeNamespace.Attribute2 diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesThatTest.verified.txt b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesThatTest.verified.txt index dc972841d..4643ef533 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesThatTest.verified.txt +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/Snapshots/ObjectsShouldTests.OnlyHaveAttributesThatTest.verified.txt @@ -1,6 +1,6 @@ ===== No violations ===== -Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes that have full name "AttributeNamespace.Attribute1" +Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have 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 have full name "AttributeNamespace.UnusedAttribute" +Query: Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have 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 have full name "AttributeNamespace.UnusedAttribute"" failed: +"Types that are "AttributeNamespace.ClassWithSingleAttribute" should only have attributes that are "AttributeNamespace.UnusedAttribute"" failed: AttributeNamespace.ClassWithSingleAttribute does have attribute AttributeNamespace.Attribute1 diff --git a/ArchUnitNETTests/Fluent/Syntax/Elements/TypeSyntaxElementsTests.cs b/ArchUnitNETTests/Fluent/Syntax/Elements/TypeSyntaxElementsTests.cs index 14b5e3009..613600328 100644 --- a/ArchUnitNETTests/Fluent/Syntax/Elements/TypeSyntaxElementsTests.cs +++ b/ArchUnitNETTests/Fluent/Syntax/Elements/TypeSyntaxElementsTests.cs @@ -159,21 +159,11 @@ public void AssignableToTest() .Are(type) .Should() .BeAssignableTo(type); - var typeIsAssignableToItselfPattern = Types() - .That() - .Are(type) - .Should() - .BeAssignableTo(type.FullName); var typeIsNotAssignableToItself = Types() .That() .Are(type) .Should() .NotBeAssignableTo(type); - var typeIsNotAssignableToItselfPattern = Types() - .That() - .Are(type) - .Should() - .NotBeAssignableTo(type.FullName); var typeIsNotAssignableToFalseType1 = Types() .That() .Are(type) @@ -188,13 +178,6 @@ public void AssignableToTest() .NotBeAssignableTo(StaticTestTypes.PublicTestClass) .OrShould() .Be(typeof(PublicTestClass)); - var typeIsNotAssignableToFalseTypePattern = Types() - .That() - .Are(type) - .Should() - .NotBeAssignableTo(StaticTestTypes.PublicTestClass.FullName) - .OrShould() - .Be(typeof(PublicTestClass)); var typeIsAssignableToFalseType1 = Types() .That() .Are(type) @@ -209,25 +192,13 @@ public void AssignableToTest() .BeAssignableTo(StaticTestTypes.PublicTestClass) .AndShould() .NotBe(typeof(PublicTestClass)); - var typeIsAssignableToFalseTypePattern = Types() - .That() - .Are(type) - .Should() - .BeAssignableTo(StaticTestTypes.PublicTestClass.FullName) - .AndShould() - .NotBe(typeof(PublicTestClass)); Assert.True(typeIsAssignableToItself.HasNoViolations(Architecture)); - Assert.True(typeIsAssignableToItselfPattern.HasNoViolations(Architecture)); Assert.False(typeIsNotAssignableToItself.HasNoViolations(Architecture)); - Assert.False(typeIsNotAssignableToItselfPattern.HasNoViolations(Architecture)); Assert.True(typeIsNotAssignableToFalseType1.HasNoViolations(Architecture)); Assert.True(typeIsNotAssignableToFalseType2.HasNoViolations(Architecture)); - Assert.True(typeIsNotAssignableToFalseTypePattern.HasNoViolations(Architecture)); Assert.False(typeIsAssignableToFalseType1.HasNoViolations(Architecture)); Assert.False(typeIsAssignableToFalseType2.HasNoViolations(Architecture)); - Assert.False(typeIsAssignableToFalseTypePattern.HasNoViolations(Architecture)); - //Multiple Arguments var typeIsAssignableToItselfFluent = Types() @@ -254,13 +225,6 @@ public void AssignableToTest() .NotBeAssignableTo(falseTypeList2) .OrShould() .Be(falseTypeList1); - var typeIsNotAssignableToFalseTypeMultiplePattern = Types() - .That() - .Are(type) - .Should() - .NotBeAssignableTo(falseTypeListPattern) - .OrShould() - .Be(falseTypeList1); var typeIsAssignableToFalseTypeMultiple1 = Types() .That() .Are(type) @@ -275,26 +239,13 @@ public void AssignableToTest() .BeAssignableTo(falseTypeList2) .AndShould() .NotBe(falseTypeList1); - var typeIsAssignableToFalseTypeMultiplePattern = Types() - .That() - .Are(type) - .Should() - .BeAssignableTo(falseTypeListPattern) - .AndShould() - .NotBe(falseTypeList1); Assert.True(typeIsAssignableToItselfFluent.HasNoViolations(Architecture)); Assert.False(typeIsNotAssignableToItselfFluent.HasNoViolations(Architecture)); Assert.True(typeIsNotAssignableToFalseTypeMultiple1.HasNoViolations(Architecture)); Assert.True(typeIsNotAssignableToFalseTypeMultiple2.HasNoViolations(Architecture)); - Assert.True( - typeIsNotAssignableToFalseTypeMultiplePattern.HasNoViolations(Architecture) - ); Assert.False(typeIsAssignableToFalseTypeMultiple1.HasNoViolations(Architecture)); Assert.False(typeIsAssignableToFalseTypeMultiple2.HasNoViolations(Architecture)); - Assert.False( - typeIsAssignableToFalseTypeMultiplePattern.HasNoViolations(Architecture) - ); } } @@ -600,42 +551,42 @@ public void ImplementInterfaceTest() { var typesThatImplementInterfaceImplementInterface = Types() .That() - .ImplementInterface(intf.FullName) + .ImplementInterface(intf) .Should() - .ImplementInterface(intf.FullName) + .ImplementInterface(intf) .WithoutRequiringPositiveResults(); var typesThatImplementInterfaceDoNotImplementInterface = Types() .That() - .ImplementInterface(intf.FullName) + .ImplementInterface(intf) .Should() - .NotImplementInterface(intf.FullName) + .NotImplementInterface(intf) .AndShould() .Exist(); var typesThatDoNotImplementInterfaceImplementInterface = Types() .That() - .DoNotImplementInterface(intf.FullName) + .DoNotImplementInterface(intf) .Should() - .ImplementInterface(intf.FullName) + .ImplementInterface(intf) .AndShould() .Exist(); var typesThatDoNotImplementInterfaceDoNotImplementInterface = Types() .That() - .DoNotImplementInterface(intf.FullName) + .DoNotImplementInterface(intf) .Should() - .NotImplementInterface(intf.FullName); + .NotImplementInterface(intf); var implementInterfaceIsEqualToAssignableTo = Types() .That() - .ImplementInterface(intf.FullName) + .ImplementInterface(intf) .Should() - .BeAssignableTo(intf.FullName) + .BeAssignableTo(intf) .And() .Types() .That() - .AreAssignableTo(intf.FullName) + .AreAssignableTo(intf) .Should() - .ImplementInterface(intf.FullName) + .ImplementInterface(intf) .OrShould() - .Be(intf.FullName); + .Be(intf); Assert.True( typesThatImplementInterfaceImplementInterface.HasNoViolations(Architecture) @@ -658,30 +609,30 @@ public void ImplementInterfaceTest() .That() .Are(StaticTestTypes.InheritedType) .Should() - .ImplementInterface(InheritedTestInterface.FullName); + .ImplementInterface(InheritedTestInterface); var testClassThatImplementsOtherInterfaceImplementsInterfaces = Types() .That() .Are(StaticTestTypes.InheritedType) .Should() - .ImplementInterface(InheritedTestInterface.FullName) + .ImplementInterface(InheritedTestInterface) .AndShould() - .ImplementInterface(InheritingInterface.FullName); + .ImplementInterface(InheritingInterface); var testInterfaceThatImplementsInterfaceImplementsInterface = Interfaces() .That() .Are(InheritingInterface) .Should() - .ImplementInterface(InheritedTestInterface.FullName); + .ImplementInterface(InheritedTestInterface); var testClassThatImplementsNoInterfaceDoesNotImplementInterface = Interfaces() .That() .Are(StaticTestTypes.PublicTestClass) .Should() - .NotImplementInterface(InheritedTestInterface.FullName) + .NotImplementInterface(InheritedTestInterface) .WithoutRequiringPositiveResults(); var testClassThatImplementsNoInterfaceImplementsInterface = Interfaces() .That() .Are(StaticTestTypes.PublicTestClass) .Should() - .ImplementInterface(InheritedTestInterface.FullName) + .ImplementInterface(InheritedTestInterface) .AndShould() .Exist(); diff --git a/ArchUnitNETTests/Loader/TypeTests.cs b/ArchUnitNETTests/Loader/TypeTests.cs index 19f233daf..a7d7f43b6 100644 --- a/ArchUnitNETTests/Loader/TypeTests.cs +++ b/ArchUnitNETTests/Loader/TypeTests.cs @@ -115,7 +115,8 @@ public void AccessAttributes() [Fact] public void NotAssignableToNull() { - Assert.False(_type.IsAssignableTo(null)); + Assert.False(_type.IsAssignableTo((IType)null)); + Assert.False(_type.IsAssignableTo((string)null)); } [Fact] diff --git a/ExampleTest/ExampleArchUnitTest.cs b/ExampleTest/ExampleArchUnitTest.cs index 9f5ff4673..6b8b2fa2e 100644 --- a/ExampleTest/ExampleArchUnitTest.cs +++ b/ExampleTest/ExampleArchUnitTest.cs @@ -29,7 +29,7 @@ public class ExampleArchUnitTest private readonly IObjectProvider ExampleClasses = Classes() .That() - .ImplementInterface("IExampleInterface") + .ImplementInterface(typeof(IExampleInterface)) .As("Example Classes"); private readonly IObjectProvider ForbiddenLayer = Types() @@ -155,3 +155,5 @@ public void ExampleClassesShouldNotCallForbiddenMethods() internal class ExampleClass { } internal class ForbiddenClass { } + +internal interface IExampleInterface { }