-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring : extract Traits to separate files
- Loading branch information
Showing
6 changed files
with
679 additions
and
655 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,248 @@ | ||
using NetArchTest.Functions; | ||
|
||
namespace NetArchTest.Rules | ||
{ | ||
public sealed partial class Condition | ||
{ | ||
/// <summary> | ||
/// Selects types that are marked as abstract. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeAbstract() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeAbstract(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are not marked as abstract. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeAbstract() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeAbstract(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are classes. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeClasses() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeClass(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are not classes. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeClasses() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeClass(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that have generic parameters. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeGeneric() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeGeneric(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that do not have generic parameters. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeGeneric() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeGeneric(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Selects types that are interfaces. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeInterfaces() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeInterface(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are not interfaces. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeInterfaces() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeInterface(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are static. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeStatic() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeStatic(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are not static. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeStatic() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeStatic(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are nested. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeNested() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeNested(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are nested and public. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeNestedPublic() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeNestedPublic(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are nested and private. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeNestedPrivate() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeNestedPrivate(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are not nested. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeNested() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeNested(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are not nested and public. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeNestedPublic() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeNestedPublic(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are not nested and private. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeNestedPrivate() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeNestedPrivate(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are have public scope. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BePublic() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BePublic(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that do not have public scope. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBePublic() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BePublic(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types according that are marked as sealed. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeSealed() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeSealed(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types according that are not marked as sealed. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList NotBeSealed() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeSealed(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are immutable. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeImmutable() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeImmutable(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types that are mutable. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList BeMutable() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.BeImmutable(x, false)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types according to whether they have nullable members. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList OnlyHaveNullableMembers() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.HasNullableMembers(x, true)); | ||
return CreateConditionList(); | ||
} | ||
|
||
/// <summary> | ||
/// Selects types according to whether they have nullable members. | ||
/// </summary> | ||
/// <returns>An updated set of conditions that can be applied to a list of types.</returns> | ||
public ConditionList HaveSomeNonNullableMembers() | ||
{ | ||
AddFunctionCall(x => FunctionDelegates.HasNullableMembers(x, false)); | ||
return CreateConditionList(); | ||
} | ||
} | ||
} |
Oops, something went wrong.