Skip to content

Commit

Permalink
Merge pull request #42 from brandhuf/framework_4.5_compatibility
Browse files Browse the repository at this point in the history
Framework 4.5 compatibility fix
  • Loading branch information
fgather authored Jan 20, 2021
2 parents 5d84cd9 + e789ae6 commit 9760005
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions ArchUnitNET/ArchUnitNET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PackageReference Include="CycleDetection" Version="2.0.0" />
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.3" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion ArchUnitNET/Domain/Class.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public bool? IsStruct

public IEnumerable<Class> InheritedClasses => BaseClass == null
? Enumerable.Empty<Class>()
: BaseClass.InheritedClasses.Append(BaseClass);
: BaseClass.InheritedClasses.Concat(new[] {BaseClass});

public Visibility Visibility => Type.Visibility;
public bool IsNested => Type.IsNested;
Expand Down
4 changes: 2 additions & 2 deletions ArchUnitNET/Domain/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public static IEnumerable<IType> GetAssignableTypes(this IType type)
switch (type)
{
case Interface intf:
return intf.ImplementedInterfaces.Append(intf);
return intf.ImplementedInterfaces.Concat(new[] {intf});
case Class cls:
return cls.InheritedClasses.Append(cls).Concat(cls.ImplementedInterfaces);
return cls.InheritedClasses.Concat(new[] {cls}).Concat(cls.ImplementedInterfaces);
default:
return Enumerable.Empty<IType>();
}
Expand Down
2 changes: 1 addition & 1 deletion ArchUnitNET/Domain/PropertyMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public List<IMemberTypeDependency> MemberDependencies
var setterDependencies = Setter?.MemberDependencies ?? Enumerable.Empty<IMemberTypeDependency>();
var getterDependencies = Getter?.MemberDependencies ?? Enumerable.Empty<IMemberTypeDependency>();
return setterDependencies.Concat(getterDependencies).Concat(AttributeDependencies)
.Append(PropertyTypeDependency).ToList();
.Concat(new[] {PropertyTypeDependency}).ToList();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static IPredicate<T> AreDeclaredIn(IType firstType, params IType[] moreTy
{
IEnumerable<T> Condition(IEnumerable<T> members)
{
var types = moreTypes.Append(firstType);
var types = moreTypes.Concat(new[] {firstType});
return members.Intersect(types.SelectMany(type => type.Members).OfType<T>());
}

Expand All @@ -64,7 +64,7 @@ public static IPredicate<T> AreDeclaredIn(Type firstType, params Type[] moreType
{
IEnumerable<T> Condition(IEnumerable<T> members, Architecture architecture)
{
var types = moreTypes.Append(firstType).Select(architecture.GetITypeOfType);
var types = moreTypes.Concat(new[] {firstType}).Select(architecture.GetITypeOfType);
return members.Intersect(types.SelectMany(type => type.Members).OfType<T>());
}

Expand Down Expand Up @@ -176,7 +176,7 @@ public static IPredicate<T> AreNotDeclaredIn(IType firstType, params IType[] mor
{
IEnumerable<T> Condition(IEnumerable<T> members)
{
var types = moreTypes.Append(firstType);
var types = moreTypes.Concat(new[] {firstType});
return members.Except(types.SelectMany(type => type.Members).OfType<T>());
}

Expand All @@ -189,7 +189,7 @@ public static IPredicate<T> AreNotDeclaredIn(Type firstType, params Type[] moreT
{
IEnumerable<T> Condition(IEnumerable<T> members, Architecture architecture)
{
var types = moreTypes.Append(firstType).Select(architecture.GetITypeOfType);
var types = moreTypes.Concat(new[] {firstType}).Select(architecture.GetITypeOfType);
return members.Except(types.SelectMany(type => type.Members).OfType<T>());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static IPredicate<T> Are(Type firstType, params Type[] moreTypes)
IEnumerable<T> Filter(IEnumerable<T> ruleTypes, Architecture architecture)
{
var typeList = moreTypes.Select(architecture.GetITypeOfType)
.Append(architecture.GetITypeOfType(firstType)).OfType<T>();
.Concat(new[] {architecture.GetITypeOfType(firstType)}).OfType<T>();
return ruleTypes.Intersect(typeList);
}

Expand Down Expand Up @@ -91,7 +91,7 @@ public static IPredicate<T> AreAssignableTo(IType firstType, params IType[] more
{
IEnumerable<T> Condition(IEnumerable<T> ruleTypes)
{
var types = moreTypes.Append(firstType);
var types = moreTypes.Concat(new[] {firstType});
return ruleTypes.Where(type => type.GetAssignableTypes().Intersect(types).Any());
}

Expand All @@ -104,7 +104,7 @@ public static IPredicate<T> AreAssignableTo(Type firstType, params Type[] moreTy
{
IEnumerable<T> Condition(IEnumerable<T> ruleTypes, Architecture architecture)
{
var types = moreTypes.Append(firstType).Select(architecture.GetITypeOfType);
var types = moreTypes.Concat(new[] {firstType}).Select(architecture.GetITypeOfType);
return ruleTypes.Where(type => type.GetAssignableTypes().Intersect(types).Any());
}

Expand Down Expand Up @@ -219,7 +219,7 @@ public static IPredicate<T> ResideInAssembly(Assembly assembly, params Assembly[
{
IEnumerable<T> Condition(IEnumerable<T> types, Architecture architecture)
{
var assemblyList = moreAssemblies.Append(assembly).Select(architecture.GetAssemblyOfAssembly);
var assemblyList = moreAssemblies.Concat(new[] {assembly}).Select(architecture.GetAssemblyOfAssembly);
return types.Where(type => assemblyList.Contains(type.Assembly));
}

Expand Down Expand Up @@ -267,7 +267,7 @@ public static IPredicate<T> AreNot(Type firstType, params Type[] moreTypes)
IEnumerable<T> Filter(IEnumerable<T> ruleTypes, Architecture architecture)
{
var typeList = moreTypes.Select(architecture.GetITypeOfType)
.Append(architecture.GetITypeOfType(firstType)).OfType<T>();
.Concat(new[] {architecture.GetITypeOfType(firstType)}).OfType<T>();
return ruleTypes.Except(typeList);
}

Expand Down Expand Up @@ -339,7 +339,7 @@ public static IPredicate<T> AreNotAssignableTo(IType firstType, params IType[] m
{
IEnumerable<T> Condition(IEnumerable<T> ruleTypes)
{
var types = moreTypes.Append(firstType);
var types = moreTypes.Concat(new[] {firstType});
return ruleTypes.Where(type => !type.GetAssignableTypes().Intersect(types).Any());
}

Expand All @@ -352,7 +352,7 @@ public static IPredicate<T> AreNotAssignableTo(Type firstType, params Type[] mor
{
IEnumerable<T> Condition(IEnumerable<T> ruleTypes, Architecture architecture)
{
var types = moreTypes.Append(firstType).Select(architecture.GetITypeOfType);
var types = moreTypes.Concat(new[] {firstType}).Select(architecture.GetITypeOfType);
return ruleTypes.Where(type => !type.GetAssignableTypes().Intersect(types).Any());
}

Expand Down Expand Up @@ -468,7 +468,7 @@ public static IPredicate<T> DoNotResideInAssembly(Assembly assembly, params Asse
{
IEnumerable<T> Condition(IEnumerable<T> types, Architecture architecture)
{
var assemblyList = moreAssemblies.Append(assembly).Select(architecture.GetAssemblyOfAssembly);
var assemblyList = moreAssemblies.Concat(new[] {assembly}).Select(architecture.GetAssemblyOfAssembly);
return types.Where(type => !assemblyList.Contains(type.Assembly));
}

Expand Down

0 comments on commit 9760005

Please sign in to comment.