Showing preview only (2,903K chars total). Download the full file or copy to clipboard to get everything.
Repository: bartoszlenar/Validot
Branch: main
Commit: 8497d506e6ce
Files: 389
Total size: 2.7 MB
Directory structure:
gitextract_6qgujrz3/
├── .editorconfig
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── config.yml
│ │ └── feature_request.md
│ ├── README.md
│ ├── pull_request_template.md
│ └── workflows/
│ ├── CI.yml
│ └── Init-WorkflowVariables.ps1
├── .gitignore
├── .nuke/
│ ├── build.schema.json
│ └── parameters.json
├── LICENSE
├── Validot.sln
├── build/
│ ├── .editorconfig
│ ├── Build.cs
│ ├── Configuration.cs
│ ├── _build.csproj
│ └── _build.csproj.DotSettings
├── build.cmd
├── build.ps1
├── build.sh
├── docs/
│ ├── CHANGELOG.md
│ ├── CONTRIBUTING.md
│ ├── DOCUMENTATION.md
│ └── articles/
│ ├── crafting-model-specifications-using-validot.md
│ └── validots-performance-explained.md
├── nuget.config
├── src/
│ └── Validot/
│ ├── CodeHelper.cs
│ ├── Errors/
│ │ ├── Args/
│ │ │ ├── ArgHelper.cs
│ │ │ ├── ArgPlaceholder.cs
│ │ │ ├── EnumArg.cs
│ │ │ ├── EnumArgFactory.cs
│ │ │ ├── GuidArg.cs
│ │ │ ├── GuidArgFactory.cs
│ │ │ ├── IArg.cs
│ │ │ ├── NameArg.cs
│ │ │ ├── NumberArg.cs
│ │ │ ├── NumberArgFactory.cs
│ │ │ ├── TextArg.cs
│ │ │ ├── TextArgFactory.cs
│ │ │ ├── TimeArg.cs
│ │ │ ├── TimeArgFactory.cs
│ │ │ ├── TranslationArg.cs
│ │ │ ├── TypeArg.cs
│ │ │ └── TypeArgFactory.cs
│ │ ├── CacheIntegrityException.cs
│ │ ├── Error.cs
│ │ ├── IError.cs
│ │ ├── IMessageService.cs
│ │ ├── MessageCache.cs
│ │ ├── MessageService.cs
│ │ ├── ReferenceLoopError.cs
│ │ └── Translator/
│ │ ├── MessageTranslator.cs
│ │ └── TranslationResult.cs
│ ├── Factory/
│ │ ├── HolderInfo.cs
│ │ ├── ISettingsHolder.cs
│ │ ├── ISpecificationHolder.cs
│ │ └── ValidatorFactory.cs
│ ├── IValidator.cs
│ ├── PathHelper.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── Results/
│ │ ├── IValidationResult.cs
│ │ └── ValidationResult.cs
│ ├── Rules/
│ │ ├── BoolRules.cs
│ │ ├── CharRules.cs
│ │ ├── Collections/
│ │ │ ├── ArrayRules.cs
│ │ │ ├── BaseCollectionRules.cs
│ │ │ ├── IEnumerableRules.cs
│ │ │ ├── IListRules.cs
│ │ │ ├── IReadOnlyCollectionRules.cs
│ │ │ ├── IReadOnlyListRules.cs
│ │ │ └── ListRules.cs
│ │ ├── GuidRules.cs
│ │ ├── Numbers/
│ │ │ ├── ByteRules.cs
│ │ │ ├── CharNumbersRules.cs
│ │ │ ├── DecimalRules.cs
│ │ │ ├── DoubleRules.cs
│ │ │ ├── FloatRules.cs
│ │ │ ├── IntRules.cs
│ │ │ ├── LongRules.cs
│ │ │ ├── SByteRules.cs
│ │ │ ├── ShortRules.cs
│ │ │ ├── UIntRules.cs
│ │ │ ├── ULongRules.cs
│ │ │ └── UShortRules.cs
│ │ ├── Text/
│ │ │ ├── EmailRules.cs
│ │ │ ├── EmailValidationMode.cs
│ │ │ └── StringRules.cs
│ │ ├── TimeSpanRules.cs
│ │ └── Times/
│ │ ├── DateTimeFormats.cs
│ │ ├── DateTimeOffsetRules.cs
│ │ ├── DateTimeRules.cs
│ │ ├── TimeComparer.cs
│ │ └── TimeComparison.cs
│ ├── Settings/
│ │ ├── IValidatorSettings.cs
│ │ ├── ValidatorSettings.cs
│ │ └── ValidatorSettingsExtensions.cs
│ ├── Specification/
│ │ ├── AndExtension.cs
│ │ ├── AsCollectionExtension.cs
│ │ ├── AsConvertedExtension.cs
│ │ ├── AsDictionaryExtension.cs
│ │ ├── AsDictionaryWithStringKeyExtension.cs
│ │ ├── AsModelExtension.cs
│ │ ├── AsNullableExtension.cs
│ │ ├── AsTypeExtension.cs
│ │ ├── Commands/
│ │ │ ├── AsCollectionCommand.cs
│ │ │ ├── AsConvertedCommand.cs
│ │ │ ├── AsDictionaryCommand.cs
│ │ │ ├── AsModelCommand.cs
│ │ │ ├── AsNullableCommand.cs
│ │ │ ├── AsTypeCommand.cs
│ │ │ ├── ForbiddenCommand.cs
│ │ │ ├── ICommand.cs
│ │ │ ├── IScopeCommand.cs
│ │ │ ├── MemberCommand.cs
│ │ │ ├── OptionalCommand.cs
│ │ │ ├── RequiredCommand.cs
│ │ │ ├── RuleCommand.cs
│ │ │ ├── WithCodeCommand.cs
│ │ │ ├── WithConditionCommand.cs
│ │ │ ├── WithExtraCodeCommand.cs
│ │ │ ├── WithExtraMessageCommand.cs
│ │ │ ├── WithMessageCommand.cs
│ │ │ └── WithPathCommand.cs
│ │ ├── ForbiddenExtension.cs
│ │ ├── MemberExtension.cs
│ │ ├── OptionalExtension.cs
│ │ ├── RequiredExtension.cs
│ │ ├── RuleExtension.cs
│ │ ├── Specification.cs
│ │ ├── SpecificationApi.cs
│ │ ├── WithCodeExtension.cs
│ │ ├── WithConditionExtension.cs
│ │ ├── WithExtraCodeExtension.cs
│ │ ├── WithExtraMessageExtension.cs
│ │ ├── WithMessageExtension.cs
│ │ └── WithPathExtension.cs
│ ├── Testing/
│ │ ├── TestFailedException.cs
│ │ ├── TestResult.cs
│ │ ├── Tester.cs
│ │ └── ToStringContentType.cs
│ ├── ThrowHelper.cs
│ ├── Translations/
│ │ ├── Chinese/
│ │ │ ├── ChineseTranslation.cs
│ │ │ └── ChineseTranslationsExtensions.cs
│ │ ├── English/
│ │ │ ├── EnglishTranslation.cs
│ │ │ └── EnglishTranslationsExtensions.cs
│ │ ├── German/
│ │ │ ├── GermanTranslation.cs
│ │ │ └── GermanTranslationsExtensions.cs
│ │ ├── ITranslationCompiler.cs
│ │ ├── MessageKey.cs
│ │ ├── Polish/
│ │ │ ├── PolishTranslation.cs
│ │ │ └── PolishTranslationsExtensions.cs
│ │ ├── Portuguese/
│ │ │ ├── PortugueseTranslation.cs
│ │ │ └── PortugueseTranslationsExtensions.cs
│ │ ├── Russian/
│ │ │ ├── RussianTranslation.cs
│ │ │ └── RussianTranslationsExtensions.cs
│ │ ├── Spanish/
│ │ │ ├── SpanishTranslation.cs
│ │ │ └── SpanishTranslationsExtensions.cs
│ │ ├── TranslationCompiler.cs
│ │ └── _Template/
│ │ ├── _TemplateTranslation.cs.txt
│ │ └── _TemplateTranslationsExtensions.cs.txt
│ ├── TypeStringifier.cs
│ ├── Validation/
│ │ ├── DiscoveryContext.cs
│ │ ├── ErrorFlag.cs
│ │ ├── IDiscoveryContext.cs
│ │ ├── IDiscoveryContextActions.cs
│ │ ├── IErrorsHolder.cs
│ │ ├── IValidationContext.cs
│ │ ├── IsValidValidationContext.cs
│ │ ├── Scheme/
│ │ │ ├── IModelScheme.cs
│ │ │ ├── ModelScheme.cs
│ │ │ └── ModelSchemeFactory.cs
│ │ ├── Scopes/
│ │ │ ├── Builders/
│ │ │ │ ├── CommandScopeBuilder.cs
│ │ │ │ ├── ErrorBuilder.cs
│ │ │ │ ├── ErrorMode.cs
│ │ │ │ ├── ICommandScopeBuilder.cs
│ │ │ │ ├── IScopeBuilderContext.cs
│ │ │ │ ├── RuleCommandScopeBuilder.cs
│ │ │ │ ├── ScopeBuilder.cs
│ │ │ │ └── ScopeBuilderContext.cs
│ │ │ ├── CollectionCommandScope.cs
│ │ │ ├── CommandScope.cs
│ │ │ ├── ConvertedCommandScope.cs
│ │ │ ├── DictionaryCommandScope.cs
│ │ │ ├── ICommandScope.cs
│ │ │ ├── IDiscoverable.cs
│ │ │ ├── IScope.cs
│ │ │ ├── ISpecificationScope.cs
│ │ │ ├── IValidatable.cs
│ │ │ ├── MemberCommandScope.cs
│ │ │ ├── ModelCommandScope.cs
│ │ │ ├── NullableCommandScope.cs
│ │ │ ├── Presence.cs
│ │ │ ├── RuleCommandScope.cs
│ │ │ ├── SpecificationScope.cs
│ │ │ └── TypeCommandScope.cs
│ │ ├── Stacks/
│ │ │ ├── PathStack.cs
│ │ │ ├── ReferenceLoopException.cs
│ │ │ ├── ReferenceLoopProtectionSettings.cs
│ │ │ └── ReferencesStack.cs
│ │ └── ValidationContext.cs
│ ├── Validator.cs
│ ├── Validot.csproj
│ └── ValidotException.cs
└── tests/
├── AssemblyWithHolders/
│ ├── AssemblyWithHolders.csproj
│ ├── AssemblyWithHoldersHook.cs
│ ├── HolderOfDecimalSpecification.cs
│ ├── HolderOfIntSpecificationAndSettings.cs
│ ├── HolderOfMultipleSpecifications.cs
│ ├── HolderOfMultipleSpecificationsAndSettings.cs
│ ├── HolderOfStringSpecification.cs
│ ├── HolderOfStringSpecificationAndSettings.cs
│ ├── NestedHolders.cs
│ ├── PrivateSpecificationAndSettingsHolder.cs
│ ├── PrivateSpecificationHolder.cs
│ └── Properties/
│ └── AssemblyInfo.cs
├── Validot.Benchmarks/
│ ├── .editorconfig
│ ├── Comparisons/
│ │ ├── ComparisonDataSet.cs
│ │ ├── EngineOnlyBenchmark.cs
│ │ ├── InitializationBenchmark.cs
│ │ ├── ReportingBenchmark.cs
│ │ ├── ToStringBenchmark.cs
│ │ └── ValidationBenchmark.cs
│ ├── EmailModesBenchmark.cs
│ ├── Program.cs
│ └── Validot.Benchmarks.csproj
├── Validot.MemoryLeak/
│ ├── .editorconfig
│ ├── Program.cs
│ ├── StreamDataSet.cs
│ ├── Validot.MemoryLeak.csproj
│ └── Validot.MemoryLeak.dockerfile
├── Validot.Tests.Functional/
│ ├── .editorconfig
│ ├── ConcurrencyFuncTests.cs
│ ├── Documentation/
│ │ ├── CustomRulesFuncTests.cs
│ │ ├── ErrorOutputFuncTests.cs
│ │ ├── FactoryFuncTests.cs
│ │ ├── FluentApiFuncTests.cs
│ │ ├── MessageArgumentsFuncTests.cs
│ │ ├── Models/
│ │ │ ├── A.cs
│ │ │ ├── AuthorModel.cs
│ │ │ ├── B.cs
│ │ │ ├── BookModel.cs
│ │ │ ├── Language.cs
│ │ │ └── PublisherModel.cs
│ │ ├── ParameterCommandsFuncTests.cs
│ │ ├── PresenceCommandsFuncTests.cs
│ │ ├── ReferenceLoopFuncTests.cs
│ │ ├── ResultFuncTests.cs
│ │ ├── ScopeCommandsFuncTests.cs
│ │ ├── SettingsFuncTests.cs
│ │ ├── SpecificationFuncTests.cs
│ │ ├── TranslationsFuncTests.cs
│ │ └── ValidatorFuncTests.cs
│ ├── Readme/
│ │ ├── FeaturesFuncTests.cs
│ │ └── QuickStartFuncTests.cs
│ └── Validot.Tests.Functional.csproj
└── Validot.Tests.Unit/
├── .editorconfig
├── CodeHelperTests.cs
├── ErrorContentApiHelper.cs
├── ErrorSetupApiHelper.cs
├── Errors/
│ ├── Args/
│ │ ├── ArgHelperTests.cs
│ │ ├── EnumArgTests.cs
│ │ ├── GuidArgTests.cs
│ │ ├── NameArgTests.cs
│ │ ├── NumberArgTests.cs
│ │ ├── TextArgTests.cs
│ │ ├── TimeArgTests.cs
│ │ ├── TranslationArgTests.cs
│ │ └── TypeArgTests.cs
│ ├── MessageCacheTests.cs
│ ├── MessageServiceTests.cs
│ ├── ReferenceLoopErrorTests.cs
│ └── Translator/
│ └── MessageTranslatorTests.cs
├── Factory/
│ ├── HolderInfoTests.cs
│ └── ValidatorFactoryTests.cs
├── GuardTests.cs
├── PathHelperTests.cs
├── PathTestData.cs
├── Results/
│ └── ValidationResultTests.cs
├── Rules/
│ ├── BoolRulesTests.cs
│ ├── CharRulesTests.cs
│ ├── Collections/
│ │ ├── ArrayRulesTests.cs
│ │ ├── BaseCollectionRulesTests.cs
│ │ ├── CollectionsTestData.cs
│ │ ├── IEnumerableRulesTests.cs
│ │ ├── IListRulesTests.cs
│ │ ├── IReadOnlyCollectionRulesTests.cs
│ │ ├── IReadOnlyListRulesTests.cs
│ │ └── ListRulesTests.cs
│ ├── GuidRulesTests.cs
│ ├── Numbers/
│ │ ├── ByteRulesTests.cs
│ │ ├── CharNumbersRulesTests.cs
│ │ ├── DecimalRulesTests.cs
│ │ ├── DoubleRulesTests.cs
│ │ ├── FloatRulesTests.cs
│ │ ├── IntRulesTests.cs
│ │ ├── LongRulesTests.cs
│ │ ├── NumbersTestData.cs
│ │ ├── SByteRulesTests.cs
│ │ ├── ShortRulesTests.cs
│ │ ├── UIntRulesTests.cs
│ │ ├── ULongRulesTests.cs
│ │ └── UShortRulesTests.cs
│ ├── RulesHelper.cs
│ ├── Text/
│ │ ├── CharRulesTests.cs
│ │ ├── EmailRulesTests.cs
│ │ └── StringRulesTests.cs
│ ├── TimeSpanRulesTests.cs
│ └── Times/
│ ├── DateTimeOffsetRulesTests.cs
│ ├── DateTimeRulesTests.cs
│ └── TimesTestData.cs
├── Settings/
│ ├── ValidatorSettingsExtensionsTests.cs
│ ├── ValidatorSettingsTestHelpers.cs
│ └── ValidatorSettingsTests.cs
├── Specification/
│ ├── AndExtensionTests.cs
│ ├── ApiTester.cs
│ ├── AsCollectionExtensionTests.cs
│ ├── AsConvertedExtensionTests.cs
│ ├── AsDictionaryExtensionTests.cs
│ ├── AsDictionaryWithKeyStringExtensionTests.cs
│ ├── AsModelExtensionTests.cs
│ ├── AsNullableExtensionTests.cs
│ ├── AsTypeExtensionTests.cs
│ ├── Commands/
│ │ ├── AsCollectionCommandTests.cs
│ │ ├── AsConvertedCommandTests.cs
│ │ ├── AsDictionaryCommandTests.cs
│ │ ├── AsModelCommandTests.cs
│ │ ├── AsNullableCommandTests.cs
│ │ ├── AsTypeCommandTests.cs
│ │ ├── MemberCommandTests.cs
│ │ └── RuleCommandTests.cs
│ ├── ForbiddenExtensionTests.cs
│ ├── MemberExtensionTests.cs
│ ├── OptionalExtensionTests.cs
│ ├── RequiredExtensionTests.cs
│ ├── RuleExtensionTests.cs
│ ├── WithCodeExtensionTests.cs
│ ├── WithConditionExtensionTests.cs
│ ├── WithExtraCodeExtensionTests.cs
│ ├── WithExtraMessageExtensionTests.cs
│ ├── WithMessageExtensionTests.cs
│ └── WithPathExtensionTests.cs
├── TempTests.cs
├── Testing/
│ └── TesterTests.cs
├── Translations/
│ ├── Chinese/
│ │ └── ChineseTranslationsExtensionsTests.cs
│ ├── English/
│ │ └── EnglishTranslationsExtensionsTests.cs
│ ├── German/
│ │ └── GermanTranslationsExtensionsTests.cs
│ ├── MessageKeyTests.cs
│ ├── Polish/
│ │ └── PolishTranslationsExtensionsTests.cs
│ ├── Portuguese/
│ │ └── PortugueseTranslationsExtensionsTests.cs
│ ├── Russian/
│ │ └── RussianTranslationsExtensionsTests.cs
│ ├── Spanish/
│ │ └── SpanishTranslationsExtensionsTests.cs
│ ├── TranslationCompilerTests.cs
│ ├── TranslationTestHelpers.cs
│ └── _Template/
│ └── _TemplateTranslationsExtensionsTests.cs.txt
├── TypeStringifierTests.cs
├── Validation/
│ ├── DiscoveryContextTests.cs
│ ├── ErrorFlagTests.cs
│ ├── IsValidValidationContextTests.cs
│ ├── Scheme/
│ │ ├── ModelSchemeFactoryTests.cs
│ │ └── ModelSchemeTests.cs
│ ├── Scopes/
│ │ ├── Builders/
│ │ │ ├── CommandScopeBuilderTests.cs
│ │ │ ├── ErrorBuilderTestData.cs
│ │ │ ├── ErrorBuilderTests.cs
│ │ │ ├── ErrorTestsHelpers.cs
│ │ │ ├── RuleCommandScopeBuilderTests.cs
│ │ │ ├── ScopeBuilderContextTests.cs
│ │ │ └── ScopeBuilderTests.cs
│ │ ├── CollectionCommandScopeTests.cs
│ │ ├── CommandScopeTestHelper.cs
│ │ ├── ConvertedCommandScopeTests.cs
│ │ ├── DictionaryCommandScopeTests.cs
│ │ ├── MemberCommandScopeTests.cs
│ │ ├── ModelCommandScopeTests.cs
│ │ ├── NullableCommandScopeTests.cs
│ │ ├── RuleCommandScopeTests.cs
│ │ └── SpecificationScopeTests.cs
│ ├── Stack/
│ │ ├── PathStackTests.cs
│ │ ├── ReferenceLoopExceptionTests.cs
│ │ ├── ReferenceLoopProtectionSettingsTests.cs
│ │ └── ReferencesStackTests.cs
│ ├── TraversingTestCases.cs
│ └── ValidationContextTests.cs
├── ValidationTestData.cs
├── ValidationTestHelpers.cs
├── ValidatorTests.cs
├── Validot.Tests.Unit.csproj
└── ValidotExceptionTests.cs
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4
# New line preferences
end_of_line = crlf
insert_final_newline = false
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset
# this. and Me. preferences
dotnet_style_qualification_for_event = false:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_property = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
# Expression-level preferences
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = false:silent
dotnet_style_prefer_conditional_expression_over_return = false:silent
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
# Field preferences
dotnet_style_readonly_field = true:suggestion
# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = false:silent
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = when_on_single_line:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_switch_expression = true:suggestion
# Null-checking preferences
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
# Code-block preferences
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = true:suggestion
# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
# 'using' directive preferences
csharp_using_directive_placement = inside_namespace:silent
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
# ReSharper/Rider style
resharper_place_simple_initializer_on_single_line=false
resharper_wrap_object_and_collection_initializer_style=wrap_if_long
resharper_blank_lines_between_using_groups=1
resharper_csharp_wrap_lines=false
resharper_qualified_using_at_nested_scope=true
resharper_blank_lines_after_control_transfer_statements=1
resharper_blank_lines_after_multiline_statements=1
resharper_blank_lines_around_block_case_section=1
resharper_blank_lines_around_multiline_case_section=1
resharper_blank_lines_around_single_line_auto_property=1
resharper_blank_lines_around_single_line_local_method=1
resharper_blank_lines_around_single_line_property=1
resharper_blank_lines_before_block_statements=1
resharper_blank_lines_before_case=1
resharper_blank_lines_before_control_transfer_statements=1
resharper_blank_lines_before_multiline_statements=1
resharper_blank_lines_inside_type=0
resharper_csharp_blank_lines_around_single_line_field=1
resharper_csharp_blank_lines_around_single_line_invocable=1
resharper_csharp_keep_blank_lines_in_code=1
resharper_csharp_keep_blank_lines_in_declarations=1
resharper_space_within_single_line_array_initializer_braces=true
# Resharper/Rider inspections
resharper_check_namespace_highlighting = suggestion
resharper_unused_type_parameter_highlighting = suggestion
resharper_unused_auto_property_accessor_local_highlighting = suggestion
resharper_redundant_extends_list_entry_highlighting = suggestion
# Severity settings
dotnet_analyzer_diagnostic.severity = error
dotnet_diagnostic.IDE0004.severity = none
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0046.severity = none
dotnet_diagnostic.IDE0057.severity = suggestion
dotnet_diagnostic.IDE0090.severity = none
dotnet_diagnostic.IDE0130.severity = none
dotnet_diagnostic.CA1040.severity = suggestion
dotnet_diagnostic.CA1032.severity = suggestion
dotnet_diagnostic.CA1034.severity = suggestion
dotnet_diagnostic.CA1303.severity = none
dotnet_diagnostic.CA1307.severity = suggestion
dotnet_diagnostic.CA1308.severity = suggestion
dotnet_diagnostic.CA1716.severity = suggestion
dotnet_diagnostic.CA1721.severity = suggestion
dotnet_diagnostic.CA1724.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.SA0001.severity = none
dotnet_diagnostic.SA1009.severity = none
dotnet_diagnostic.SA1101.severity = none
dotnet_diagnostic.SA1111.severity = none
dotnet_diagnostic.SA1201.severity = suggestion
dotnet_diagnostic.SA1309.severity = none
dotnet_diagnostic.SA1402.severity = suggestion
dotnet_diagnostic.SA1403.severity = suggestion
dotnet_diagnostic.SA1413.severity = none
dotnet_diagnostic.SA1600.severity = none
dotnet_diagnostic.SA1601.severity = none
dotnet_diagnostic.SA1602.severity = none
dotnet_diagnostic.SA1633.severity = none
dotnet_diagnostic.SYSLIB1046.severity = suggestion
================================================
FILE: .github/CODEOWNERS
================================================
* bartosz@lenar.dev
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help improve the the Validot project
title: ""
labels: bug
assignees: bartoszlenar
---
<!--
This is only a template.
Please replace the placeholders (like point lists or code snippets) with your own content.
-->
## Bug description
* Please provide the bug description in points.
* What is the current behavior?
* What is affected by the bug?
## Bug in action
``` csharp
// Most of the Validot demos can be wrapped within short snippets of code
```
``` csharp
// If the code is spread across multiple files, please contain each one in a separate block
```
Steps to reproduce:
1. Additionally...
1. or alternatively (then please remove this list)...
1. please include all steps to reproduce the bug
## Solution
* Please provide the suggested solution in points.
* What is the expected behavior?
* What could be a possible fix/solution?
## Environment
* Validot version: <!-- nuget package version and/or commit sha -->
* dotnet version: <!-- dotnet SDK version and framework id (TargetFramework tag in your csproj) -->
* OS: <!-- OS name and version -->
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Validot on StackOverflow
url: https://stackoverflow.com/questions/tagged/validot
about: 'Please ask and answer questions using the tag #validot'
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for the Validot project
title: ""
labels: enhancement
assignees: bartoszlenar
---
<!--
This is only a template.
Please replace the placeholders (like point lists or code snippets) with your own content.
-->
## Feature description
* Please provide the feature description in points.
* What is the problem you're trying to solve?
* What is in-scope and what is out-of-scope?
## Feature in action
``` csharp
// Most of the Validot demos can be wrapped within short snippets of code
```
``` csharp
// If the code is spread across multiple files, please contain each one in a separate block
```
## Feature details
* Please provide the feature details in points.
* Technical implementation details?
* Caveats and considerations for the future?
* Is this might be a breaking change?
## Discussion
* Questions to the maintainers or users?
* Pools?
================================================
FILE: .github/README.md
================================================
<h1 align="center">
<br />
<img src="../assets/logo/validot-logo.svg" height="256px" width="256px" />
<br />
Validot
<br />
</h1>
<p align="center">Validot is a performance-first, compact library for advanced model validation. Using a simple declarative fluent interface, it efficiently handles classes, structs, nested members, collections, nullables, plus any relation or combination of them. It also supports translations, custom logic extensions with tests, and DI containers.</p>
<br />
<p align="center">
<a href="https://www.nuget.org/packages/Validot">
<img src="https://img.shields.io/nuget/v/Validot?style=for-the-badge&logo=nuget&logoColor=white&logoWidth=20&label=CURRENT%20VERSION">
</a>
<a href="https://www.nuget.org/packages/Validot">
<img src="https://img.shields.io/github/release-date/bartoszlenar/Validot?include_prereleases&style=for-the-badge&label=RELEASED">
</a>
</p>
<!-- <p align="center">
<a href="https://github.com/bartoszlenar/Validot/commits/main">
<img src="https://img.shields.io/github/commits-since/bartoszlenar/Validot/v2.4.1/main?logo=git&logoColor=white&style=flat-square">
</a>
<a href="https://github.com/bartoszlenar/Validot/commits/main">
<img src="https://img.shields.io/github/last-commit/bartoszlenar/Validot/main?style=flat-square">
</a>
<a href="https://github.com/bartoszlenar/Validot/actions?query=branch%3Amain+workflow%3ACI">
<img src="https://img.shields.io/github/actions/workflow/status/bartoszlenar/Validot/CI.yml?branch=main&style=flat-square&label=build&logo=github&logoColor=white&logoWidth=20">
</a>
<a href="https://codecov.io/gh/bartoszlenar/Validot/branch/main">
<img src="https://img.shields.io/codecov/c/gh/bartoszlenar/Validot/main?style=flat-square&logo=codecov&logoColor=white&logoWidth=20">
</a>
</p> -->
<!--
<p align="center">
<a href="https://github.com/bartoszlenar/Validot/releases">
<img src="https://img.shields.io/github/v/release/bartoszlenar/Validot?include_prereleases&style=for-the-badge&label=latest%20pre-release%20version&logo=nuget&logoColor=white&logoWidth=20">
</a>
</p>
-->
<div align="center">
<h3>
<a href="#quickstart">
Quickstart
</a>
|
<a href="#features">
Features
</a>
|
<a href="#project-info">
Project info
</a>
|
<a href="../docs/DOCUMENTATION.md">
Documentation
</a>
|
<a href="../docs/CHANGELOG.md">
Changelog
</a>
</div>
<p align="center">
<a href="#validot-vs-fluentvalidation">
🔥⚔️ Validot vs FluentValidation ⚔️🔥
</a>
</br>
</br>
<a href="../docs/articles/validots-performance-explained.md">
📜 Article: Validot's performance explained
</a>
</br>
<a href="../docs/articles/crafting-model-specifications-using-validot.md">
📜 Article: Crafting model specifications using Validot
</a>
</p>
<p align="center">
Built with 🤘🏻by <a href="https://lenar.dev">Bartosz Lenar</a>
</p>
</br>
## Announcement! Validot is archived!
Validot has been my public pet project since 2020, a proof-of-concept turned into a standalone, fully-featured NuGet library. Its core focus is on performance and a low-allocation approach. On release day, Validot was 2.5 times faster while consuming 8 times less memory than the industry's gold standard: FluentValidation! I pushed dotnet memory performance and optimizations to their limits. And I'm proud of my work.
Given my daily responsibilities and other coding projects, I have to confess that it seems improbable I'll have time to keep working on Validot.
I appreciate all the contributors, and especially, I extend my gratitude to Jeremy Skinner for his work on FluentValidation. I genuinely believe I played a role in the open source community by motivating Jeremy to enhance FluentValidation's performance.
## Quickstart
Add the Validot nuget package to your project using dotnet CLI:
```
dotnet add package Validot
```
All the features are accessible after referencing single namespace:
``` csharp
using Validot;
```
And you're good to go! At first, create a specification for your model with the fluent api.
``` csharp
Specification<UserModel> specification = _ => _
.Member(m => m.Email, m => m
.Email()
.WithExtraCode("ERR_EMAIL")
.And()
.MaxLength(100)
)
.Member(m => m.Name, m => m
.Optional()
.And()
.LengthBetween(8, 100)
.And()
.Rule(name => name.All(char.IsLetterOrDigit))
.WithMessage("Must contain only letter or digits")
)
.And()
.Rule(m => m.Age >= 18 || m.Name != null)
.WithPath("Name")
.WithMessage("Required for underaged user")
.WithExtraCode("ERR_NAME");
```
The next step is to create a [validator](../docs/DOCUMENTATION.md#validator). As its name stands - it validates objects according to the [specification](../docs/DOCUMENTATION.md#specification). It's also thread-safe so you can seamlessly register it as a singleton in your DI container.
``` csharp
var validator = Validator.Factory.Create(specification);
```
Validate the object!
``` csharp
var model = new UserModel(email: "inv@lidv@lue", age: 14);
var result = validator.Validate(model);
```
The [result](../docs/DOCUMENTATION.md#result) object contains all information about the [errors](../docs/DOCUMENTATION.md#error-output). Without retriggering the validation process, you can extract the desired form of an output.
``` csharp
result.AnyErrors; // bool flag:
// true
result.MessageMap["Email"] // collection of messages for "Email":
// [ "Must be a valid email address" ]
result.Codes; // collection of all the codes from the model:
// [ "ERR_EMAIL", "ERR_NAME" ]
result.ToString(); // compact printing of codes and messages:
// ERR_EMAIL, ERR_NAME
//
// Email: Must be a valid email address
// Name: Required for underaged user
```
* [See this example's real code](../tests/Validot.Tests.Functional/Readme/QuickStartFuncTests.cs)
## Features
### Advanced fluent API, inline
No more obligatory if-ology around input models or separate classes wrapping just validation logic. Write [specifications](../docs/DOCUMENTATION.md#specification) inline with simple, human-readable [fluent API](../docs/DOCUMENTATION.md#fluent0api). Native support for properties and fields, structs and classes, [nullables](../docs/DOCUMENTATION.md#asnullable), [collections](../docs/DOCUMENTATION.md#ascollection), [nested members](../docs/DOCUMENTATION.md#member), and possible combinations.
``` csharp
Specification<string> nameSpecification = s => s
.LengthBetween(5, 50)
.SingleLine()
.Rule(name => name.All(char.IsLetterOrDigit));
Specification<string> emailSpecification = s => s
.Email()
.And()
.Rule(email => email.All(char.IsLower))
.WithMessage("Must contain only lower case characters");
Specification<UserModel> userSpecification = s => s
.Member(m => m.Name, nameSpecification)
.WithMessage("Must comply with name rules")
.And()
.Member(m => m.PrimaryEmail, emailSpecification)
.And()
.Member(m => m.AlternativeEmails, m => m
.Optional()
.And()
.MaxCollectionSize(3)
.WithMessage("Must not contain more than 3 addresses")
.And()
.AsCollection(emailSpecification)
)
.And()
.Rule(user => {
return user.PrimaryEmail is null || user.AlternativeEmails?.Contains(user.PrimaryEmail) == false;
})
.WithMessage("Alternative emails must not contain the primary email address");
```
* [Blog post about constructing specifications in Validot](https://lenar.dev/posts/crafting-model-specifications-using-validot)
* [Guide through Validot's fluent API](../docs/DOCUMENTATION.md#fluent-api)
* [If you prefer the approach of having a separate class for just validation logic, it's also fully supported](../docs/DOCUMENTATION.md#specification-holder)
### Validators
Compact, highly optimized, and thread-safe objects to handle the validation.
``` csharp
Specification<BookModel> bookSpecification = s => s
.Optional()
.Member(m => m.AuthorEmail, m => m.Optional().Email())
.Member(m => m.Title, m => m.NotEmpty().LengthBetween(1, 100))
.Member(m => m.Price, m => m.NonNegative());
var bookValidator = Validator.Factory.Create(bookSpecification);
services.AddSingleton<IValidator<BookModel>>(bookValidator);
```
``` csharp
var bookModel = new BookModel() { AuthorEmail = "inv@lid_em@il", Price = 10 };
bookValidator.IsValid(bookModel);
// false
bookValidator.Validate(bookModel).ToString();
// AuthorEmail: Must be a valid email address
// Title: Required
bookValidator.Validate(bookModel, failFast: true).ToString();
// AuthorEmail: Must be a valid email address
bookValidator.Template.ToString(); // Template contains all of the possible errors:
// AuthorEmail: Must be a valid email address
// Title: Required
// Title: Must not be empty
// Title: Must be between 1 and 100 characters in length
// Price: Must not be negative
```
* [What Validator is and how it works](../docs/DOCUMENTATION.md#validator)
* [More about template and how to use it](../docs/DOCUMENTATION.md#template)
### Results
Whatever you want. [Error flag](../docs/DOCUMENTATION.md#anyerrors), compact [list of codes](../docs/DOCUMENTATION.md#codes), or detailed maps of [messages](../docs/DOCUMENTATION.md#messagemap) and [codes](../docs/DOCUMENTATION.md#codemap). With sugar on top: friendly [ToString() printing](../docs/DOCUMENTATION.md#tostring) that contains everything, nicely formatted.
``` csharp
var validationResult = validator.Validate(signUpModel);
if (validationResult.AnyErrors)
{
// check if a specific code has been recorded for Email property:
if (validationResult.CodeMap["Email"].Contains("DOMAIN_BANNED"))
{
_actions.NotifyAboutDomainBanned(signUpModel.Email);
}
var errorsPrinting = validationResult.ToString();
// save all messages and codes printing into the logs
_logger.LogError("Errors in incoming SignUpModel: {errors}", errorsPrinting);
// return all error codes to the frontend
return new SignUpActionResult
{
Success = false,
ErrorCodes = validationResult.Codes,
};
}
```
* [Validation result types](../docs/DOCUMENTATION.md#result)
### Rules
Tons of [rules available out of the box](../docs/DOCUMENTATION.md#rules). Plus, an easy way to [define your own](../docs/DOCUMENTATION.md#custom-rules) with the full support of Validot internal features like [formattable message arguments](../docs/DOCUMENTATION.md#message-arguments).
``` csharp
public static IRuleOut<string> ExactLinesCount(this IRuleIn<string> @this, int count)
{
return @this.RuleTemplate(
value => value.Split(Environment.NewLine).Length == count,
"Must contain exactly {count} lines",
Arg.Number("count", count)
);
}
```
``` csharp
.ExactLinesCount(4)
// Must contain exactly 4 lines
.ExactLinesCount(4).WithMessage("Required lines count: {count}")
// Required lines count: 4
.ExactLinesCount(4).WithMessage("Required lines count: {count|format=000.00|culture=pl-PL}")
// Required lines count: 004,00
```
* [List of built-in rules](../docs/DOCUMENTATION.md#rules)
* [Writing custom rules](../docs/DOCUMENTATION.md#custom-rules)
* [Message arguments](../docs/DOCUMENTATION.md#message-arguments)
### Translations
Pass errors directly to the end-users in the language of your application.
``` csharp
Specification<UserModel> specification = s => s
.Member(m => m.PrimaryEmail, m => m.Email())
.Member(m => m.Name, m => m.LengthBetween(3, 50));
var validator = Validator.Factory.Create(specification, settings => settings.WithPolishTranslation());
var model = new UserModel() { PrimaryEmail = "in@lid_em@il", Name = "X" };
var result = validator.Validate(model);
result.ToString();
// Email: Must be a valid email address
// Name: Must be between 3 and 50 characters in length
result.ToString(translationName: "Polish");
// Email: Musi być poprawnym adresem email
// Name: Musi być długości pomiędzy 3 a 50 znaków
```
At the moment Validot delivers the following translations out of the box: [Polish](../docs/DOCUMENTATION.md#withpolishtranslation), [Spanish](../docs/DOCUMENTATION.md#withspanishtranslation), [Russian](../docs/DOCUMENTATION.md#withrussiantranslation), [Portuguese](../docs/DOCUMENTATION.md#withportuguesetranslation) and [German](../docs/DOCUMENTATION.md#withgermantranslation).
* [How translations work](../docs/DOCUMENTATION.md#translations)
* [Custom translation](../docs/DOCUMENTATION.md#custom-translation)
* [How to selectively override built-in error messages](../docs/DOCUMENTATION.md#overriding-messages)
### Dependency injection
Although Validot doesn't contain direct support for the dependency injection containers (because it aims to rely solely on the .NET Standard 2.0), it includes helpers that can be used with any DI/IoC system.
For example, if you're working with ASP.NET Core and looking for an easy way to register all of your validators with a single call (something like `services.AddValidators()`), wrap your specifications in the [specification holders](../docs/DOCUMENTATION.md#specification-holder), and use the following snippet:
``` csharp
public void ConfigureServices(IServiceCollection services)
{
// ... registering other dependencies ...
// Registering Validot's validators from the current domain's loaded assemblies
var holderAssemblies = AppDomain.CurrentDomain.GetAssemblies();
var holders = Validator.Factory.FetchHolders(holderAssemblies)
.GroupBy(h => h.SpecifiedType)
.Select(s => new
{
ValidatorType = s.First().ValidatorType,
ValidatorInstance = s.First().CreateValidator()
});
foreach (var holder in holders)
{
services.AddSingleton(holder.ValidatorType, holder.ValidatorInstance);
}
// ... registering other dependencies ...
}
```
* [What specification holders are and how to create them](../docs/DOCUMENTATION.md#specification-holder)
* [Fetching specification holders from assemblies](../docs/DOCUMENTATION.md#fetching-holders)
* [Writing the fully-featured `AddValidators` extension step-by-step](../docs/DOCUMENTATION.md#dependency-injection)
## Validot vs FluentValidation
A short statement to start with - [@JeremySkinner](https://twitter.com/JeremySkinner)'s [FluentValidation](https://fluentvalidation.net/) is an excellent piece of work and has been a huge inspiration for this project. True, you can call Validot a direct competitor, but it differs in some fundamental decisions, and lot of attention has been focused on entirely different aspects. If - after reading this section - you think you can bear another approach, api and [limitations](#fluentValidations-features-that-validot-is-missing), at least give Validot a try. You might be positively surprised. Otherwise, FluentValidation is a good, safe choice, as Validot is certainly less hackable, and achieving some particular goals might be either difficult or impossible.
### Validot is faster and consumes less memory
This document shows oversimplified results of [BenchmarkDotNet](https://benchmarkdotnet.org/) execution, but the intention is to present the general trend only. To have truly reliable numbers, I highly encourage you to [run the benchmarks yourself](../docs/DOCUMENTATION.md#benchmarks).
There are three data sets, 10k models each; `ManyErrors` (every model has many errors), `HalfErrors` (circa 60% have errors, the rest are valid), `NoErrors` (all are valid) and the rules reflect each other as much as technically possible. I did my best to make sure that the tests are just and adequate, but I'm a human being and I make mistakes. Really, if you spot errors [in the code](https://github.com/bartoszlenar/Validot/tree/cdca31a2588bf801288ef73e8ca50bfd33be8049/tests/Validot.Benchmarks), framework usage, applied methodology... or if you can provide any counterexample proving that Validot struggles with some particular scenarios - I'd be very very very happy to accept a PR and/or discuss it on [GitHub Issues](https://github.com/bartoszlenar/Validot/issues).
To the point; the statement in the header is true, but it doesn't come for free. Wherever possible and justified, Validot chooses performance and less allocations over [flexibility and extra features](#fluentvalidations-features-that-validot-is-missing). Fine with that kind of trade-off? Good, because the validation process in Validot might be **~1.6x faster while consuming ~4.7x less memory** (in the most representational, `Validate` tests using `HalfErrors` data set). Especially when it comes to memory consumption, Validot could be even 13.3x better than FluentValidation (`IsValid` tests with `HalfErrors` data set) . What's the secret? Read my blog post: [Validot's performance explained](https://lenar.dev/posts/validots-performance-explained).
| Test | Data set | Library | Mean [ms] | Allocated [MB] |
| - | - | - | -: | -: |
| Validate | `ManyErrors` | FluentValidation | `703.83` | `453` |
| Validate | `ManyErrors` | Validot | `307.04` | `173` |
| FailFast | `ManyErrors` | FluentValidation | `21.63` | `21` |
| FailFast | `ManyErrors` | Validot | `16.76` | `32` |
| Validate | `HalfErrors` | FluentValidation | `563.92` | `362` |
| Validate | `HalfErrors` | Validot | `271.62` | `81` |
| FailFast | `HalfErrors` | FluentValidation | `374.90` | `249` |
| FailFast | `HalfErrors` | Validot | `173.41` | `62` |
| Validate | `NoErrors` | FluentValidation | `559.77` | `354` |
| Validate | `NoErrors` | Validot | `260.99` | `75` |
* [Validate benchmark](../tests/Validot.Benchmarks/Comparisons/ValidationBenchmark.cs) - objects are validated.
* [FailFast benchmark](../tests/Validot.Benchmarks/Comparisons/ValidationBenchmark.cs) - objects are validated, the process stops on the first error.
FluentValidation's `IsValid` is a property that wraps a simple check whether the validation result contains errors or not. Validot has [AnyErrors](../docs/DOCUMENTATION.md#anyerrors) that acts the same way, and [IsValid](../docs/DOCUMENTATION.md#isvalid) is a special mode that doesn't care about anything else but the first rule predicate that fails. If the mission is only to verify the incoming model whether it complies with the rules (discarding all of the details), this approach proves to be better up to one order of magnitude:
| Test | Data set | Library | Mean [ms] | Allocated [MB] |
| - | - | - | -: | -: |
| IsValid | `ManyErrors` | FluentValidation | `20.91` | `21` |
| IsValid | `ManyErrors` | Validot | `8.21` | `6` |
| IsValid | `HalfErrors` | FluentValidation | `367.59` | `249` |
| IsValid | `HalfErrors` | Validot | `106.77` | `20` |
| IsValid | `NoErrors` | FluentValidation | `513.12` | `354` |
| IsValid | `NoErrors` | Validot | `136.22` | `24` |
* [IsValid benchmark](../tests/Validot.Benchmarks/Comparisons/ValidationBenchmark.cs) - objects are validated, but only to check if they are valid or not.
Combining these two methods in most cases could be quite beneficial. At first, [IsValid](../docs/DOCUMENTATION.md#isvalid) quickly verifies the object, and if it contains errors - only then [Validate](../docs/DOCUMENTATION.md#validate) is executed to report the details. Of course in some extreme cases (megabyte-size data? millions of items in the collection? dozens of nested levels with loops in reference graphs?) traversing through the object twice could neglect the profit. Still, for the regular web api input validation, it will undoubtedly serve its purpose:
``` csharp
if (!validator.IsValid(model))
{
errorMessages = validator.Validate(model).ToString();
}
```
| Test | Data set | Library | Mean [ms] | Allocated [MB] |
| - | - | - | -: | -: |
| Reporting | `ManyErrors` | FluentValidation | `768.00` | `464` |
| Reporting | `ManyErrors` | Validot | `379.50` | `294` |
| Reporting | `HalfErrors` | FluentValidation | `592.50` | `363` |
| Reporting | `HalfErrors` | Validot | `294.60` | `76` |
* [Reporting benchmark](../tests/Validot.Benchmarks/Comparisons/ReportingBenchmark.cs):
* FluentValidation validates model, and `ToString()` is called if errors are detected.
* Validot processes the model twice - at first, with its special mode, [IsValid](../docs/DOCUMENTATION.md#isvalid). Secondly - in case of errors detected - with the standard method, gathering all errors and printing them with `ToString()`.
Benchmarks environment: Validot 2.3.0, FluentValidation 11.2.0, .NET 6.0.7, i7-9750H (2.60GHz, 1 CPU, 12 logical and 6 physical cores), X64 RyuJIT, macOS Monterey.
### Validot handles nulls on its own
In Validot, null is a special case [handled by the core engine](../docs/DOCUMENTATION.md#null-policy). You don't need to secure the validation logic from null as your predicate will never receive it.
``` csharp
Member(m => m.LastName, m => m
.Rule(lastName => lastName.Length < 50) // 'lastName' is never null
.Rule(lastName => lastName.All(char.IsLetter)) // 'lastName' is never null
)
```
### Validot treats null as an error by default
All values are marked as required by default. In the above example, if `LastName` member were null, the validation process would exit `LastName` scope immediately only with this single error message:
```
LastName: Required
```
The content of the message is, of course, [customizable](../docs/DOCUMENTATION.md#withmessage).
If null should be allowed, place [Optional](../docs/DOCUMENTATION.md#optional) command at the beginning:
``` csharp
Member(m => m.LastName, m => m
.Optional()
.Rule(lastName => lastName.Length < 50) // 'lastName' is never null
.Rule(lastName => lastName.All(char.IsLetter)) // 'lastName' is never null
)
```
Again, no rule predicate is triggered. Also, null `LastName` member doesn't result with errors.
* [Read more about how Validot handles nulls](../docs/DOCUMENTATION.md#null-policy)
### Validot's Validator is immutable
Once [validator](../docs/DOCUMENTATION.md#validator) instance is created, you can't modify its internal state or [settings](../docs/DOCUMENTATION.md#settings). If you need the process to fail fast (FluentValidation's `CascadeMode.Stop`), use the flag:
``` csharp
validator.Validate(model, failFast: true);
```
### FluentValidation's features that Validot is missing
Features that might be in the scope and are technically possible to implement in the future:
* failing fast only in a single scope ([discuss it on GitHub Issues](https://github.com/bartoszlenar/Validot/issues/5))
* validated value in the error message ([discuss it on GitHub Issues](https://github.com/bartoszlenar/Validot/issues/6))
Features that are very unlikely to be in the scope as they contradict the project's principles, and/or would have a very negative impact on performance, and/or are impossible to implement:
* Full integration with ASP.NET or other frameworks:
* Validot tries to remain a single-purpose library, depending only on .NET Standard 2.0. Thus all integrations need to be done individually.
* However, Validot delivers [FetchHolders method](../docs/DOCUMENTATION.md#fetching-holders) that makes such integrations possible to wrap within a few lines of code. The quick example is in the [Dependency Injection section of this readme file](#dependency-injection), more advanced solution with explanation is contained [in the documentation](../docs/DOCUMENTATION.md#dependency-injection).
* Access to any stateful context in the rule condition predicate:
* It implicates a lack of support for dynamic message content and/or amount.
* Callbacks:
* Please react on [failure/success](../docs/DOCUMENTATION.md#anyerrors) after getting [validation result](../docs/DOCUMENTATION.md#result).
* Pre-validation:
* All cases can be handled by additional validation and a proper if-else.
* Also, the problem of the root being null doesn't exist in Validot (it's a regular case, [covered entirely with fluent api](../docs/DOCUMENTATION.md#presence-commands))
* Rule sets
* workaround; multiple [validators](../docs/DOCUMENTATION.md#validator) for different parts of the object.
* `await`/`async` support
* only support for large collections is planned ([more details on GitHub Issues](https://github.com/bartoszlenar/Validot/issues/2))
* severities ([more details on GitHub Issues](https://github.com/bartoszlenar/Validot/issues/4))
* workaround: multiple [validators](../docs/DOCUMENTATION.md#validator) for error groups with different severities.
## Project info
### Requirements
Validot is a dotnet class library targeting .NET Standard 2.0. There are no extra dependencies.
Please check the [official Microsoft document](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0) that lists all the platforms that can use it on.
### Versioning
[Semantic versioning](https://semver.org/) is being used very strictly. The major version is updated only when there is a breaking change, no matter how small it might be (e.g., adding extra method to the public interface). On the other hand, a huge pack of new features will bump the minor version only.
Before every major version update, at least one preview version is published.
### Reliability
Unit tests coverage hits 100% very close, and it can be detaily verified on [codecov.io](https://codecov.io/gh/bartoszlenar/Validot/branch/main).
Before publishing, each release is tested on the ["latest" version](https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources) of the following operating systems:
* macOS
* Ubuntu
* Windows Server
using the upcoming, the current and all also the supported [LTS versions](https://dotnet.microsoft.com/platform/support/policy/dotnet-core) of the underlying frameworks:
* .NET 8.0
* .NET 6.0
* .NET Framework 4.8 (Windows 2019 only)
### Performance
Benchmarks exist in the form of [the console app project](https://github.com/bartoszlenar/Validot/tree/5219a8da7cc20cd5b9c5c49dd5c0940e829f6fe9/tests/Validot.Benchmarks) based on [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet). Also, you can trigger performance tests [from the build script](../docs/DOCUMENTATION.md#benchmarks).
### Documentation
The documentation is hosted alongside the source code, in the git repository, as a single markdown file: [DOCUMENTATION.md](./../docs/DOCUMENTATION.md).
Code examples from the documentation live as [functional tests](https://github.com/bartoszlenar/Validot/tree/132842cff7c5097c1cad8e762df094e74bb6038c/tests/Validot.Tests.Functional).
### Development
The entire project ([source code](https://github.com/bartoszlenar/Validot), [issue tracker](https://github.com/bartoszlenar/Validot/issues), [documentation](../docs/DOCUMENTATION.md), and [CI workflows](https://github.com/bartoszlenar/Validot/actions)) is hosted here on github.com.
Any contribution is more than welcome. If you'd like to help, please don't forget to check out the [CONTRIBUTING](./../docs/CONTRIBUTING.md) file and [issues page](https://github.com/bartoszlenar/Validot/issues).
### Licencing
Validot uses the [MIT license](../LICENSE). Long story short; you are more than welcome to use it anywhere you like, completely free of charge and without oppressive obligations.
================================================
FILE: .github/pull_request_template.md
================================================
<!--
Please read the CONTRIBUTING document (url: https://github.com/bartoszlenar/Validot/blob/main/docs/CONTRIBUTING.md) before submitting this PR.
This is only a template.
Please replace the placeholders (like point lists or code snippets) with your own content.
-->
## Issue
Related issue: # (required - if the issue doesn't exist, please create it first)
## Type of changes
- [ ] Documentation update or other changes not related to the code.
- [ ] Bug fix (non-breaking change which fixes an issue).
- [ ] New feature (non-breaking change which adds functionality).
- [ ] Breaking change (fix or feature that would cause existing functionality to change).
## Description
* Please provide the PR description in points.
* Include as many details as you can
* What code areas are affected?
* Any impact on performance?
* Any problems with passing unit tests?
``` csharp
// If applicable, please provide any code that demonstrates the changes (a new functionality in action, or a proof that the bug is fixed)
```
## Tests
* Please list in points all the details about testing the content of this PR
* Any new/altered unit/functional tests?
* Any new benchmarks?
* Any new unit/functional tests? Any altered tests?
================================================
FILE: .github/workflows/CI.yml
================================================
name: CI
on:
push:
branches-ignore:
- "wip/**"
pull_request:
branches-ignore:
- "wip/**"
release:
types: [published]
jobs:
tests:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
dotnet: ["8.0.x"]
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} using dotnet ${{ matrix.dotnet }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
${{ matrix.dotnet }}
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Compile
run: pwsh build.ps1 --target compile --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Tests
run: pwsh build.ps1 --target tests --skip --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; details of failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: Validot.${{ env.VALIDOT_VERSION }}.${{ matrix.dotnet }}.${{ matrix.os }}.testresults
path: artifacts/tests/Validot.${{ env.VALIDOT_VERSION }}.testresults
tests_netframework:
strategy:
matrix:
os: [windows-2019]
dotnet: [net48]
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} using dotnet ${{ matrix.dotnet }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup base dotnet sdk
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Compile
run: pwsh build.ps1 --target compile --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Tests
run: pwsh build.ps1 --target tests --skip --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; details of failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: Validot.${{ env.VALIDOT_VERSION }}.${{ matrix.dotnet }}.${{ matrix.os }}.testresults
path: artifacts/tests/Validot.${{ env.VALIDOT_VERSION }}.testresults
code_coverage:
needs: [tests, tests_netframework]
if: github.event_name == 'release' || github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
name: Code coverage
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup base dotnet sdk
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
6.0.x
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Analyze code coverage
run: pwsh build.ps1 --target codecoveragereport --dotnet 6.0.x --configuration debug --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; code coverage data
uses: actions/upload-artifact@v4
with:
name: Validot.${{ env.VALIDOT_VERSION }}.opencover.xml
path: artifacts/coverage/Validot.${{ env.VALIDOT_VERSION }}.opencover.xml
- name: Upload artifact; code coverage summary
uses: actions/upload-artifact@v4
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json
path: artifacts/coverage_reports/Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json
- name: Upload artifact; code coverage report
if: github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_report
path: artifacts/coverage_reports/Validot.${{ env.VALIDOT_VERSION }}.coverage_report
nuget_package:
needs: [tests, tests_netframework]
if: github.event_name == 'release'
runs-on: ubuntu-latest
name: NuGet package
steps:
- name: Checking out code
uses: actions/checkout@v2
- name: Setup base dotnet sdk
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Create package
run: pwsh build.ps1 --target nugetpackage --dotnet 8.0.x --configuration release --commitsha ${{ github.sha }} --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; nuget package
uses: actions/upload-artifact@v4
with:
name: Validot.${{ env.VALIDOT_VERSION }}.nupkg
path: artifacts/nuget/${{ env.VALIDOT_VERSION }}/Validot.${{ env.VALIDOT_VERSION }}.nupkg
- name: Upload artifact; nuget package symbols
uses: actions/upload-artifact@v4
with:
name: Validot.${{ env.VALIDOT_VERSION }}.snupkg
path: artifacts/nuget/${{ env.VALIDOT_VERSION }}/Validot.${{ env.VALIDOT_VERSION }}.snupkg
- name: Publish nuget package
run: pwsh build.ps1 --target publishnugetpackage --skip --dotnet 8.0.x --configuration release --version ${{ env.VALIDOT_VERSION }} --commitsha ${{ github.sha }} --nugetapikey ${{ secrets.NUGET_API_KEY }}
release_assets:
needs: [code_coverage, nuget_package]
if: github.event_name == 'release'
runs-on: ubuntu-latest
name: Upload release assets
steps:
- name: Checking out code
uses: actions/checkout@v2
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Download artifact; nuget package
uses: actions/download-artifact@v4.1.7
with:
name: Validot.${{ env.VALIDOT_VERSION }}.nupkg
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget
- name: Download artifact; nuget package symbols
uses: actions/download-artifact@v4.1.7
with:
name: Validot.${{ env.VALIDOT_VERSION }}.snupkg
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget
- name: Download artifact; code coverage data
uses: actions/download-artifact@v4.1.7
with:
name: Validot.${{ env.VALIDOT_VERSION }}.opencover.xml
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage/data
- name: Download artifact; code coverage summary
uses: actions/download-artifact@v4.1.7
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage
- name: Download artifact; code coverage report
uses: actions/download-artifact@v4.1.7
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_report
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage/report
- name: Zip artifacts
run: |
cd artifacts
zip -rX Validot.${{ env.VALIDOT_VERSION }}.nuget.zip Validot.${{ env.VALIDOT_VERSION }}.nuget
zip -rX Validot.${{ env.VALIDOT_VERSION }}.coverage.zip Validot.${{ env.VALIDOT_VERSION }}.coverage
- name: Upload release asset; nuget package with symbols
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget.zip
asset_name: Validot.${{ env.VALIDOT_VERSION }}.nuget.zip
asset_content_type: application/zip
- name: Upload release asset; code coverage data and reports
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage.zip
asset_name: Validot.${{ env.VALIDOT_VERSION }}.coverage.zip
asset_content_type: application/zip
================================================
FILE: .github/workflows/Init-WorkflowVariables.ps1
================================================
$commitShortSha = $env:GITHUB_SHA.Substring(0, 7)
if ($env:GITHUB_EVENT_NAME.Equals("release")) {
$tag = $env:GITHUB_REF.Substring("refs/tags/".Length).TrimStart('v');
if ($tag -match "^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$")
{
$version = $tag
}
else
{
Write-Error "Tag contains invalid semver: $tag" -ErrorAction Stop
}
}
else {
$version = $commitShortSha
}
"VALIDOT_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"VALIDOT_COMMIT=$commitShortSha" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"VALIDOT_CI=true" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
================================================
FILE: .gitignore
================================================
# Created by https://www.gitignore.io/api/csharp
# Edit at https://www.gitignore.io/?templates=csharp
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# End of https://www.gitignore.io/api/csharp
# Visual Studio Code
.vscode/
# Tools
tools/
# jetBrains Rider
.idea/
# MacOS
.DS_Store
================================================
FILE: .nuke/build.schema.json
================================================
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
"properties": {
"AllowWarnings": {
"type": "boolean",
"description": "Allow warnings"
},
"BenchmarksFilter": {
"type": "string",
"description": "Benchmark filter. If empty, all benchmarks will be run"
},
"CodeCovApiKey": {
"type": "string",
"description": "CodeCov API key, allows to publish code coverage"
},
"CommitSha": {
"type": "string",
"description": "Commit SHA"
},
"Configuration": {
"type": "string",
"description": "Configuration to build. 'Debug' (default) or 'Release'",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"DotNet": {
"type": "string",
"description": "dotnet framework id or SDK version (if SDK version is provided, the highest framework available is selected). Default value is 'netcoreapp3.1'"
},
"FullBenchmark": {
"type": "boolean",
"description": "If true, BenchmarkDotNet will run full (time consuming, but more accurate) jobs"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"NuGetApi": {
"type": "string",
"description": "NuGet API. Where to publish NuGet package. Default value is 'https://api.nuget.org/v3/index.json'"
},
"NuGetApiKey": {
"type": "string",
"description": "NuGet API key, allows to publish NuGet package"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"AddTranslation",
"Benchmarks",
"Clean",
"CodeCoverage",
"CodeCoverageReport",
"Compile",
"CompileProject",
"CompileTests",
"NugetPackage",
"PublishCodeCoverage",
"PublishNugetPackage",
"Reset",
"Restore",
"Tests"
]
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"AddTranslation",
"Benchmarks",
"Clean",
"CodeCoverage",
"CodeCoverageReport",
"Compile",
"CompileProject",
"CompileTests",
"NugetPackage",
"PublishCodeCoverage",
"PublishNugetPackage",
"Reset",
"Restore",
"Tests"
]
}
},
"TranslationName": {
"type": "string",
"description": "(only for target AddTranslation) Translation name"
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
},
"Version": {
"type": "string",
"description": "Version. Default value is '0.0.0-timestamp'"
}
}
}
}
}
================================================
FILE: .nuke/parameters.json
================================================
{
"$schema": "./build.schema.json",
"Solution": "Validot.sln"
}
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2020-2021 Bartosz Lenar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: Validot.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{013FC1C3-9AFF-43CE-915C-6BF4FA32FE80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validot", "src\Validot\Validot.csproj", "{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A57BE44-6C94-4A7C-A2B5-EE6CDB6E9176}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validot.Tests.Unit", "tests\Validot.Tests.Unit\Validot.Tests.Unit.csproj", "{6F71A1C1-319A-492F-B930-0FF4FB599918}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validot.Tests.Functional", "tests\Validot.Tests.Functional\Validot.Tests.Functional.csproj", "{E5AC95A3-1613-433C-A318-9A19B24BF73F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validot.Benchmarks", "tests\Validot.Benchmarks\Validot.Benchmarks.csproj", "{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validot.MemoryLeak", "tests\Validot.MemoryLeak\Validot.MemoryLeak.csproj", "{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{4BDB92C9-0BA6-4740-A177-18E80611976A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyWithHolders", "tests\AssemblyWithHolders\AssemblyWithHolders.csproj", "{971FACBC-AF7F-4897-A081-947C6F2A864A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4BDB92C9-0BA6-4740-A177-18E80611976A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BDB92C9-0BA6-4740-A177-18E80611976A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Debug|x64.ActiveCfg = Debug|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Debug|x64.Build.0 = Debug|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Debug|x86.ActiveCfg = Debug|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Debug|x86.Build.0 = Debug|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Release|Any CPU.Build.0 = Release|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Release|x64.ActiveCfg = Release|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Release|x64.Build.0 = Release|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Release|x86.ActiveCfg = Release|Any CPU
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22}.Release|x86.Build.0 = Release|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Debug|x64.ActiveCfg = Debug|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Debug|x64.Build.0 = Debug|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Debug|x86.ActiveCfg = Debug|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Debug|x86.Build.0 = Debug|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Release|Any CPU.Build.0 = Release|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Release|x64.ActiveCfg = Release|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Release|x64.Build.0 = Release|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Release|x86.ActiveCfg = Release|Any CPU
{6F71A1C1-319A-492F-B930-0FF4FB599918}.Release|x86.Build.0 = Release|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Debug|x64.ActiveCfg = Debug|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Debug|x64.Build.0 = Debug|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Debug|x86.ActiveCfg = Debug|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Debug|x86.Build.0 = Debug|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Release|Any CPU.Build.0 = Release|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Release|x64.ActiveCfg = Release|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Release|x64.Build.0 = Release|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Release|x86.ActiveCfg = Release|Any CPU
{E5AC95A3-1613-433C-A318-9A19B24BF73F}.Release|x86.Build.0 = Release|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Debug|x64.ActiveCfg = Debug|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Debug|x64.Build.0 = Debug|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Debug|x86.ActiveCfg = Debug|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Debug|x86.Build.0 = Debug|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Release|Any CPU.Build.0 = Release|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Release|x64.ActiveCfg = Release|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Release|x64.Build.0 = Release|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Release|x86.ActiveCfg = Release|Any CPU
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08}.Release|x86.Build.0 = Release|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Debug|x64.ActiveCfg = Debug|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Debug|x64.Build.0 = Debug|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Debug|x86.ActiveCfg = Debug|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Debug|x86.Build.0 = Debug|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Release|Any CPU.Build.0 = Release|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Release|x64.ActiveCfg = Release|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Release|x64.Build.0 = Release|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Release|x86.ActiveCfg = Release|Any CPU
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE}.Release|x86.Build.0 = Release|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Debug|x64.ActiveCfg = Debug|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Debug|x64.Build.0 = Debug|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Debug|x86.ActiveCfg = Debug|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Debug|x86.Build.0 = Debug|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Release|Any CPU.Build.0 = Release|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Release|x64.ActiveCfg = Release|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Release|x64.Build.0 = Release|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Release|x86.ActiveCfg = Release|Any CPU
{971FACBC-AF7F-4897-A081-947C6F2A864A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BFD540CD-1648-4E7B-B5C5-B6EC0C6D4D22} = {013FC1C3-9AFF-43CE-915C-6BF4FA32FE80}
{6F71A1C1-319A-492F-B930-0FF4FB599918} = {1A57BE44-6C94-4A7C-A2B5-EE6CDB6E9176}
{E5AC95A3-1613-433C-A318-9A19B24BF73F} = {1A57BE44-6C94-4A7C-A2B5-EE6CDB6E9176}
{D9D2BCCB-1D86-42A3-87F8-9FBA4057BD08} = {1A57BE44-6C94-4A7C-A2B5-EE6CDB6E9176}
{1030576B-DAC1-46C1-A6E3-6E809B5ED0EE} = {1A57BE44-6C94-4A7C-A2B5-EE6CDB6E9176}
{971FACBC-AF7F-4897-A081-947C6F2A864A} = {1A57BE44-6C94-4A7C-A2B5-EE6CDB6E9176}
EndGlobalSection
EndGlobal
================================================
FILE: build/.editorconfig
================================================
[*.cs]
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_require_accessibility_modifiers = never:warning
csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA2211.severity = none
dotnet_diagnostic.CA1050.severity = none
dotnet_diagnostic.CA1847.severity = none
dotnet_diagnostic.CA1845.severity = none
dotnet_diagnostic.IDE0022.severity = none
dotnet_diagnostic.IDE0051.severity = none
dotnet_diagnostic.IDE0058.severity = none
================================================
FILE: build/Build.cs
================================================
#pragma warning disable SYSLIB1045 // Convert to 'GeneratedRegexAttribute'.
#pragma warning disable IDE0057 // Use range operator
#pragma warning disable CA1852 // sealed class
#pragma warning disable CA1865 // Use char overload
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
[ShutdownDotNetAfterServerBuild]
class Build : NukeBuild
{
static readonly Regex SemVerRegex = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled);
static readonly Regex TargetFrameworkRegex = new Regex(@"<TargetFramework>.+<\/TargetFramework>", RegexOptions.Compiled);
static readonly DateTimeOffset BuildTime = DateTimeOffset.UtcNow;
static readonly string DefaultFrameworkId = "net8.0";
public static int Main() => Execute<Build>(x => x.Compile);
[Parameter("Configuration to build. 'Debug' (default) or 'Release'.")]
readonly Configuration Configuration = Configuration.Debug;
[Parameter("dotnet framework id or SDK version (if SDK version is provided, the highest framework available is selected). Default value is 'netcoreapp3.1'")]
string DotNet;
[Parameter("Version. Default value is '0.0.0-timestamp'")]
string Version;
[Parameter("NuGet API. Where to publish NuGet package. Default value is 'https://api.nuget.org/v3/index.json'")]
readonly string NuGetApi = "https://api.nuget.org/v3/index.json";
[Parameter("NuGet API key, allows to publish NuGet package.")]
readonly string NuGetApiKey;
[Parameter("CodeCov API key, allows to publish code coverage.")]
readonly string CodeCovApiKey;
[Parameter("Commit SHA")]
readonly string CommitSha;
[Parameter("If true, BenchmarkDotNet will run full (time consuming, but more accurate) jobs.")]
readonly bool FullBenchmark;
[Parameter("Benchmark filter. If empty, all benchmarks will be run.")]
readonly string BenchmarksFilter;
[Parameter("Allow warnings")]
readonly bool AllowWarnings;
[Parameter("(only for target AddTranslation) Translation name")]
readonly string TranslationName;
[Solution]
readonly Solution Solution;
AbsolutePath SourceDirectory => RootDirectory / "src";
AbsolutePath TestsDirectory => RootDirectory / "tests";
AbsolutePath ToolsPath => RootDirectory / "tools";
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
AbsolutePath TestsResultsDirectory => ArtifactsDirectory / "tests";
AbsolutePath CodeCoverageDirectory => ArtifactsDirectory / "coverage";
AbsolutePath CodeCoverageReportsDirectory => ArtifactsDirectory / "coverage_reports";
AbsolutePath BenchmarksDirectory => ArtifactsDirectory / "benchmarks";
AbsolutePath NuGetDirectory => ArtifactsDirectory / "nuget";
protected override void OnBuildInitialized()
{
base.OnBuildCreated();
DotNet = GetFramework(DotNet);
Logger.Info($"DotNet: {DotNet}");
Version = GetVersion(Version);
Logger.Info($"Version: {Version}");
Logger.Info($"NuGetApi: {NuGetApi ?? "MISSING"}");
Logger.Info($"Configuration: {Configuration}");
Logger.Info($"CommitSha: {CommitSha ?? "MISSING"}");
Logger.Info($"AllowWarnings: {AllowWarnings}");
Logger.Info($"FullBenchmark: {FullBenchmark}");
Logger.Info($"BenchmarkFilter: {FullBenchmark}");
var nuGetApiKeyPresence = (NuGetApiKey is null) ? "MISSING" : "present";
Logger.Info($"NuGetApiKey: {nuGetApiKeyPresence}");
var codeCovApiKeyPresence = (CodeCovApiKey is null) ? "MISSING" : "present";
Logger.Info($"CodeCovApiKey: {codeCovApiKeyPresence}");
SetFrameworkInTests(DotNet);
SetVersionInAssemblyInfo(Version, CommitSha);
}
protected override void OnBuildFinished()
{
ResetFrameworkInTests();
ResetVersionInAssemblyInfo();
base.OnBuildFinished();
}
Target AddTranslation => _ => _
.Requires(() => TranslationName)
.Executes(() =>
{
CreateFromTemplate(SourceDirectory / "Validot" / "Translations" / "_Template");
CreateFromTemplate(TestsDirectory / "Validot.Tests.Unit" / "Translations" / "_Template");
void CreateFromTemplate(AbsolutePath templatePath)
{
CopyDirectoryRecursively(templatePath, templatePath.Parent / TranslationName);
var files = new DirectoryInfo(templatePath.Parent / TranslationName).GetFiles();
foreach (var file in files)
{
var finalFilePath = file.FullName.Replace("_Template", TranslationName).Replace(".txt", string.Empty);
RenameFile(file.FullName, finalFilePath);
File.WriteAllText(finalFilePath, File.ReadAllText(finalFilePath).Replace("_Template", TranslationName));
}
}
});
Target Reset => _ => _
.Executes(() =>
{
EnsureCleanDirectory(TemporaryDirectory);
EnsureCleanDirectory(ArtifactsDirectory);
EnsureCleanDirectory(ToolsPath);
ResetFrameworkInTests();
})
.Triggers(Clean);
Target Clean => _ => _
.Before(Restore)
.Executes(() =>
{
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
});
Target Restore => _ => _
.Executes(() =>
{
DotNetRestore(_ => _
.SetProjectFile(Solution));
});
Target CompileProject => _ => _
.DependsOn(Clean, Restore)
.Executes(() =>
{
DotNetBuild(c => c
.EnableNoRestore()
.SetTreatWarningsAsErrors(!AllowWarnings)
.SetProjectFile(SourceDirectory / "Validot/Validot.csproj")
.SetConfiguration(Configuration)
.SetFramework("netstandard2.0")
);
});
Target CompileTests => _ => _
.DependsOn(Clean, Restore)
.After(CompileProject)
.Executes(() =>
{
var testsProjects = new[]
{
TestsDirectory / "Validot.Tests.Unit/Validot.Tests.Unit.csproj",
TestsDirectory / "Validot.Tests.Functional/Validot.Tests.Functional.csproj"
};
foreach (var testProject in testsProjects)
{
DotNetBuild(c => c
.EnableNoRestore()
.SetTreatWarningsAsErrors(!AllowWarnings)
.SetProjectFile(testProject)
.SetConfiguration(Configuration)
.SetFramework(DotNet)
.AddProperty("DisableSourceLink", "1")
);
}
});
Target Compile => _ => _
.DependsOn(CompileProject, CompileTests);
Target Tests => _ => _
.DependsOn(CompileTests)
.Executes(() =>
{
DotNetTest(p => p
.EnableNoBuild()
.SetConfiguration(Configuration)
.SetProjectFile(TestsDirectory / "Validot.Tests.Unit/Validot.Tests.Unit.csproj")
.SetFramework(DotNet)
.SetLoggers($"junit;LogFilePath={TestsResultsDirectory / $"Validot.{Version}.testresults" / $"Validot.{Version}.unit.junit"}")
);
DotNetTest(p => p
.EnableNoBuild()
.SetConfiguration(Configuration)
.SetProjectFile(TestsDirectory / "Validot.Tests.Functional/Validot.Tests.Functional.csproj")
.SetFramework(DotNet)
.SetLoggers($"junit;LogFilePath={TestsResultsDirectory / $"Validot.{Version}.testresults" / $"Validot.{Version}.functional.junit"}")
);
});
Target CodeCoverage => _ => _
.DependsOn(CompileTests)
.Requires(() => Configuration == Configuration.Debug)
.Executes(() =>
{
var reportFile = CodeCoverageDirectory / $"Validot.{Version}.opencover.xml";
DotNetTest(p => p
.EnableNoBuild()
.SetProjectFile(TestsDirectory / "Validot.Tests.Unit/Validot.Tests.Unit.csproj")
.SetConfiguration(Configuration.Debug)
.SetFramework(DotNet)
.AddProperty("CollectCoverage", "true")
.AddProperty("CoverletOutput", reportFile)
.AddProperty("CoverletOutputFormat", "opencover")
.AddProperty("DisableSourceLink", "1")
);
Logger.Info($"CodeCoverage opencover format file location: {reportFile} ({new FileInfo(reportFile).Length} bytes)");
});
Target CodeCoverageReport => _ => _
.DependsOn(CodeCoverage)
.Requires(() => Configuration == Configuration.Debug)
.Executes(() =>
{
var toolPath = InstallAndGetToolPath("dotnet-reportgenerator-globaltool", "4.8.1", "ReportGenerator.dll", "net5.0");
var toolParameters = new[]
{
$"-reports:{CodeCoverageDirectory / $"Validot.{Version}.opencover.xml"}",
$"-reporttypes:HtmlInline_AzurePipelines;JsonSummary",
$"-targetdir:{CodeCoverageReportsDirectory / $"Validot.{Version}.coverage_report"}",
$"-historydir:{CodeCoverageReportsDirectory / "_history"}",
$"-title:Validot unit tests code coverage report",
$"-tag:v{Version}" + (CommitSha is null ? "" : $"+{CommitSha}"),
};
ExecuteTool(toolPath, string.Join(" ", toolParameters.Select(p => $"\"{p}\"")));
File.Move(CodeCoverageReportsDirectory / $"Validot.{Version}.coverage_report/Summary.json", CodeCoverageReportsDirectory / $"Validot.{Version}.coverage_summary.json");
});
Target Benchmarks => _ => _
.DependsOn(Clean)
.Executes(() =>
{
var benchmarksPath = BenchmarksDirectory / $"Validot.{Version}.benchmarks";
var jobShort = FullBenchmark ? string.Empty : "--job short";
var filter = BenchmarksFilter is null ? "*" : BenchmarksFilter;
DotNetRun(p => p
.SetProjectFile(TestsDirectory / "Validot.Benchmarks/Validot.Benchmarks.csproj")
.SetConfiguration(Configuration.Release)
.SetProcessArgumentConfigurator(a => a
.Add("--")
.Add($"--artifacts {benchmarksPath} {jobShort}")
.Add("--exporters GitHub StackOverflow JSON HTML")
.Add($"--filter {filter}")
)
);
});
Target NugetPackage => _ => _
.DependsOn(Compile)
.Requires(() => Configuration == Configuration.Release)
.Executes(() =>
{
DotNetPack(p => p
.EnableNoBuild()
.SetConfiguration(Configuration.Release)
.SetProject(SourceDirectory / "Validot/Validot.csproj")
.SetVersion(Version)
.SetOutputDirectory(NuGetDirectory / Version)
);
});
Target PublishNugetPackage => _ => _
.DependsOn(NugetPackage)
.Requires(() => NuGetApiKey != null)
.Requires(() => Configuration == Configuration.Release)
.Executes(() =>
{
DotNetNuGetPush(p => p
.SetSource(NuGetApi)
.SetApiKey(NuGetApiKey)
.SetTargetPath(NuGetDirectory / Version / $"Validot.{Version}.nupkg")
);
});
Target PublishCodeCoverage => _ => _
.DependsOn(CodeCoverage)
.Requires(() => CodeCovApiKey != null)
.Requires(() => Configuration == Configuration.Debug)
.Executes(() =>
{
var reportFile = CodeCoverageDirectory / $"Validot.{Version}.opencover.xml";
var toolPath = InstallAndGetToolPath("codecov.tool", "1.13.0", "codecov.dll", "net5.0");
var toolParameters = new[]
{
$"--sha {CommitSha}",
$"--file {reportFile}",
$"--token {CodeCovApiKey}",
$"--required"
};
ExecuteTool(toolPath, string.Join(" ", toolParameters));
});
void SetFrameworkInTests(string framework)
{
var testsCsprojs = new[]
{
TestsDirectory / "Validot.Tests.Unit/Validot.Tests.Unit.csproj",
TestsDirectory / "Validot.Tests.Functional/Validot.Tests.Functional.csproj",
TestsDirectory / "Validot.Benchmarks/Validot.Benchmarks.csproj",
};
foreach (var csproj in testsCsprojs)
{
SetFrameworkInCsProj(framework, csproj);
}
}
void SetFrameworkInCsProj(string framework, string csProjPath)
{
Logger.Info($"Setting framework {framework} in {csProjPath}");
var content = TargetFrameworkRegex.Replace(File.ReadAllText(csProjPath), $"<TargetFramework>{framework}</TargetFramework>");
File.WriteAllText(csProjPath, content);
}
void SetVersionInAssemblyInfo(string version, string commitSha)
{
var assemblyVersion = "0.0.0.0";
var assemblyFileVersion = "0.0.0.0";
if (SemVerRegex.IsMatch(version))
{
assemblyVersion = version.Substring(0, version.IndexOf(".", StringComparison.InvariantCulture)) + ".0.0.0";
assemblyFileVersion = version.Contains("-", StringComparison.InvariantCulture)
? version.Substring(0, version.IndexOf("-", StringComparison.InvariantCulture)) + ".0"
: version + ".0";
}
Logger.Info("Setting AssemblyVersion: " + assemblyVersion);
Logger.Info("Setting AssemblyFileVersion: " + assemblyFileVersion);
var assemblyInfoPath = SourceDirectory / "Validot/Properties/AssemblyInfo.cs";
var assemblyInfoLines = File.ReadAllLines(assemblyInfoPath);
var autogeneratedPostfix = "// this line is autogenerated by the build script";
for (var i = 0; i < assemblyInfoLines.Length; ++i)
{
if (assemblyInfoLines[i].Contains("AssemblyVersion", StringComparison.InvariantCulture))
{
assemblyInfoLines[i] = $"[assembly: System.Reflection.AssemblyVersion(\"{assemblyVersion}\")] {autogeneratedPostfix}";
}
else if (assemblyInfoLines[i].Contains("AssemblyFileVersion", StringComparison.InvariantCulture))
{
assemblyInfoLines[i] = $"[assembly: System.Reflection.AssemblyFileVersion(\"{assemblyFileVersion}\")] {autogeneratedPostfix}";
}
}
File.WriteAllLines(assemblyInfoPath, assemblyInfoLines);
}
void ResetVersionInAssemblyInfo() => SetVersionInAssemblyInfo("0.0.0", null);
void ResetFrameworkInTests() => SetFrameworkInTests(DefaultFrameworkId);
string GetFramework(string dotnet)
{
if (string.IsNullOrWhiteSpace(dotnet))
{
Logger.Warn("DotNet: parameter not provided");
return DefaultFrameworkId;
}
if (char.IsDigit(dotnet.First()))
{
Logger.Info($"DotNet parameter recognized as SDK version: " + dotnet);
if (dotnet.StartsWith("2.1.", StringComparison.Ordinal))
{
return "netcoreapp2.1";
}
if (dotnet.StartsWith("3.1.", StringComparison.Ordinal))
{
return "netcoreapp3.1";
}
if (dotnet.StartsWith("5.0.", StringComparison.Ordinal))
{
return "net5.0";
}
if (dotnet.StartsWith("6.0.", StringComparison.Ordinal))
{
return "net6.0";
}
if (dotnet.StartsWith("7.0.", StringComparison.Ordinal))
{
return "net7.0";
}
if (dotnet.StartsWith("8.0.", StringComparison.Ordinal))
{
return "net8.0";
}
Logger.Warn("Unrecognized dotnet SDK version: " + dotnet);
return dotnet;
}
if (dotnet.StartsWith("netcoreapp", StringComparison.Ordinal) && dotnet["netcoreapp".Length..].All(c => char.IsDigit(c) || c == '.'))
{
Logger.Info("DotNet parameter recognized as .NET Core target: " + DotNet);
return dotnet;
}
if (dotnet.StartsWith("net", StringComparison.Ordinal) && DotNet["net".Length..].All(char.IsDigit))
{
Logger.Info("DotNet parameter recognized as .NET Framework target: " + dotnet);
return dotnet;
}
Logger.Warn("Unrecognized dotnet framework id: " + dotnet);
return dotnet;
}
string GetVersion(string version)
{
if (version is null)
{
Logger.Warn("Version: not provided.");
return $"0.0.0-{BuildTime.DayOfYear}{BuildTime.ToString("HHmmss", CultureInfo.InvariantCulture)}";
}
return version;
}
void ExecuteTool(string toolPath, string parameters)
{
ProcessTasks.StartProcess(ToolPathResolver.GetPathExecutable("dotnet"), toolPath + " -- " + parameters).AssertZeroExitCode();
}
string InstallAndGetToolPath(string name, string version, string executableFileName, string framework = null)
{
var frameworkPart = framework is null ? $" (framework {framework})" : string.Empty;
var toolStamp = $"{name} {version}{frameworkPart}, executable file: {executableFileName}";
Logger.Info($"Looking for tool: {toolStamp}");
var toolPath = ResolveToolPath();
if (toolPath is null)
{
DotNetToolInstall(c => c
.SetPackageName(name)
.SetVersion(version)
.SetToolInstallationPath(ToolsPath)
.SetGlobal(false));
}
toolPath = ResolveToolPath();
if (toolPath is null)
{
Logger.Error($"Unable to find tool path: {name} {version} {executableFileName} {framework}");
}
return toolPath;
AbsolutePath ResolveToolPath()
{
var frameworkPart = framework != null ? (framework + "/**/") : string.Empty;
Serilog.Log.Debug($"Looking for tool in {ToolsPath} using glob pattern: **/{name}/{version}/**/{frameworkPart}{executableFileName}");
var files = ToolsPath.GlobFiles($"**/{name}/{version}/**/{frameworkPart}{executableFileName}");
if (files.Count > 1)
{
foreach (var file in files)
{
Serilog.Log.Warning($"Found tool candidate: {file}");
}
var toolPath = files.First();
Serilog.Log.Warning($"Found many tool candidates, so proceeding with the first one: {toolPath}");
return toolPath;
}
return files.FirstOrDefault();
}
}
}
================================================
FILE: build/Configuration.cs
================================================
using System;
using System.ComponentModel;
using System.Linq;
using Nuke.Common.Tooling;
[TypeConverter(typeof(TypeConverter<Configuration>))]
public class Configuration : Enumeration
{
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
public static Configuration Release = new Configuration { Value = nameof(Release) };
public static implicit operator string(Configuration configuration)
{
return configuration.Value;
}
}
================================================
FILE: build/_build.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" Version="8.0.0" />
</ItemGroup>
</Project>
================================================
FILE: build/_build.csproj.DotSettings
================================================
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=HeapView_002EDelegateAllocation/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VariableHidesOuterVariable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
================================================
FILE: build.cmd
================================================
:; set -eo pipefail
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
:; ${SCRIPT_DIR}/build.sh "$@"
:; exit $?
@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*
================================================
FILE: build.ps1
================================================
[CmdletBinding()]
Param(
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################
# CONFIGURATION
###########################################################################
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "STS"
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_NOLOGO = 1
###########################################################################
# EXECUTION
###########################################################################
function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}
# Install by channel or version
$DotNetDirectory = "$TempDirectory\dotnet-win"
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
$env:PATH = "$DotNetDirectory;$env:PATH"
}
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
}
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
================================================
FILE: build.sh
================================================
#!/usr/bin/env bash
bash --version 2>&1 | head -n 1
set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################
# CONFIGURATION
###########################################################################
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="STS"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
###########################################################################
# EXECUTION
###########################################################################
function FirstJsonValue {
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
export DOTNET_EXE="$(command -v dotnet)"
else
# Download install script
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
mkdir -p "$TEMP_DIRECTORY"
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
chmod +x "$DOTNET_INSTALL_FILE"
# If global.json exists, load expected version
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
if [[ "$DOTNET_VERSION" == "" ]]; then
unset DOTNET_VERSION
fi
fi
# Install by channel or version
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
if [[ -z ${DOTNET_VERSION+x} ]]; then
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
export PATH="$DOTNET_DIRECTORY:$PATH"
fi
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
fi
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
================================================
FILE: docs/CHANGELOG.md
================================================
# Changelog
All notable changes to the [Validot project](https://github.com/bartoszlenar/Validot) will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.5.0] - 2025-02-01
### Added
- Chinese translation. [#15](https://github.com/bartoszlenar/Validot/issues/15) [#37](https://github.com/bartoszlenar/Validot/pull/37)
## [2.5.0] - 2024-05-24
### Added
- Added `AsDictionary` command. [#26](https://github.com/bartoszlenar/Validot/issues/26)
## [2.4.1] - 2023-03-16
### Fixed
- Fixed invalid placeholders in messages. [#32](https://github.com/bartoszlenar/Validot/issues/32)
## [2.4.0] - 2022-10-01
### Added
- Added `AsType` command. [#4](https://github.com/bartoszlenar/Validot/issues/24)
### Fixed
- Inline XML documentation for `AsConverted`.
## [2.3.0] - 2022-08-13
### Added
- Added `AsConverted` command. [#3](https://github.com/bartoszlenar/Validot/issues/3)
### Removed
- Official support for not supported dotnet versions (.NET Core 2.1, .NET 5.0).
## [2.2.0] - 2021-11-05
### Added
- German translation (along with `WithGermanTranslation` extension to the settings builder). [#12](https://github.com/bartoszlenar/Validot/issues/12)
- Portuguese translation (along with `WithPortugueseTranslation` extension to the settings builder). [#13](https://github.com/bartoszlenar/Validot/issues/13)
### Fixed
- Fix to Spanish translation in `Times.BeforeOrEqualTo` message key. [#20](https://github.com/bartoszlenar/Validot/pull/20/commits/6a68dcdc17589f3c9bd524bc2266238b5245ff50)
- Minor performance fixes and code improvements. [#21](https://github.com/bartoszlenar/Validot/pulls/21) [#22](https://github.com/bartoszlenar/Validot/pulls/22)
## [2.1.0] - 2021-06-07
### Added
- Spanish translation (along with `WithSpanishTranslation` extension to the settings builder). [#11](https://github.com/bartoszlenar/Validot/issues/11)
- Russian translation (along with `WithRussianTranslation` extension to the settings builder). [#14](https://github.com/bartoszlenar/Validot/issues/14)
- Translation template with script. To add a new translation all you need to do is call the build script, e.g. to add Korean, execute `pwsh build.ps1 --target AddTranslation --translationName Korean` (you can use `bash build.sh` instead of `pwsh build.ps1`) and the template with phrases will be created at `src/Validot/Translations/Korean` (plus unit tests in their own location). The only thing that is left to do is to enter translated phrases into the dictionary and make a PR!
- A preview version of .NET 6 in the CI pipeline for all unit and functional tests.
## [2.0.0] - 2021-02-01
### Added
- `FetchHolders` method in the factory that helps [fetching specification holders](DOCUMENTATION.md#fetching-holders) from the assemblies and delivers a handy way to create the validators and [register them in the dependency injection containers](DOCUMENTATION.md#dependency-injection). [#10](https://github.com/bartoszlenar/Validot/issues/10)
- Method in the factory that accepts the settings (in form of `IValidatorSettings`) directly, so the settings (e.g. from another validator) could be reused. This method compensates the lack of validator's public constructor.
- [Settings holders](DOCUMENTATION.md#settings-holder) (`ISettingsHolder` interface), a mechanism similar to specification holders. This feature compensates the lack of `ITranslationHolder`.
### Fixed
- Fixed inline XML code documentation, so it's visible from IDEs when referencing a nuget package.
### Changed
- Introduced `IValidatorSettings` as a public interface for read-only access to the `ValidatorSettings` instance. `ValidatorSettings` class isn't public anymore, and validator's `Settings` property is now of type `IValidatorSettings`. This is a breaking change.
- Renamed `ReferenceLoopProtection` flag to `ReferenceLoopProtectionEnabled`. This is a breaking change.
- `IsValid` method uses a dedicated validation context that effectively doubles the speed of the operation
- Ported all test projects to .NET 5.
- Replaced ruleset-based code style rules with editorconfig and `Microsoft.CodeAnalysis.CSharp.CodeStyle` roslyn analyzers.
- Renamed `master` git branch to `main`.
### Removed
- Validator's public constructor. Please use the factory to create validators. If you want to reuse the settings, factory has new method that accepts `IValidatorSettings` instance. This is a breaking change.
- Translation holders (`ITranslationHolder` interface). You can easily replace them with the newly introduced settings holders (`ISettingsHolder` interface). This is a breaking change.
- CapacityInfo feature. It wasn't publicly available anyway and ultimately didn't prove to boost up the performance.
## [1.2.0] - 2020-11-04
### Added
- `And` - a fluent API method that [helps to visually separate the rules](DOCUMENTATION.md#And) within the specification. [#9](https://github.com/bartoszlenar/Validot/issues/9)
- Inline documentation (XML comments)
## [1.1.0] - 2020-09-01
### Added
- Email rule now operates in two modes: ComplexRegex (which covers the previous, regex-based behavior, and is still set as default) and DataAnnotationsCompatible (compatible with the dotnet's [EmailAddressAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.emailaddressattribute?view=netcore-3.1)).
- Title case support for the name argument, so name `SuperImportantValue123` when inserted with `{_name|format=titleCase}` is converted into `Super Important Value 123`. [#1](https://github.com/bartoszlenar/Validot/issues/1)
## [1.0.0] - 2020-06-23
First stable and public release. The reference point for all further changes.
================================================
FILE: docs/CONTRIBUTING.md
================================================
# Contributing
If you're reading this file, it means that you are - more or less - interested in contributing to the project. Before anything else, I'd like to say - thank you! It really means a lot to me that you consider this project to be worth your time.
## Flow
1. Let's have a discussion first!
- It's really important that you visit the project's [Issues page](https://github.com/bartoszlenar/Validot/issues) and check if there is already an ongoing discussion around the same (or similar) idea.
- Let's have a short chat about a feature that you have in mind (or a bug that you found), _before_ any actual code work. Validot is tweaked performance-wise and has a very sensitive codebase and for this reason I prefer to assign new features to myself by default. Of course, it's not a rule, but double please, let's have a chat about new features and breaking changes before you dedicate your time to Validot.
2. Fork and code!
- How to build, run unit and functional tests? How to analyse code coverage a execute benchmarks? It's all covered in the [documentation](./DOCUMENTATION.md#Development).
- Please get familiar with Validot's [project principles](#project-principles), [git](#git) and [code standards](#code-standards)
- Provide changes in the documentation if needed.
3. Raise the PR!
## Project principles
- Validot is not the ultimate solution to all validation scenarios and cases in the world. Let's keep it compact and simple, focused on a single problem.
- Validot should not have any other dependencies than .NET Standard 2.0.
- Validot - unless absolutely necessary - should not sacrifice performance for extra features.
- Validot follows [semantic versioning](https://semver.org/) very strictly, no matter how annoying it could be.
## Code standards
- Be aware that the code needs to compile and pass the tests on all of the LTS versions of .NET, under all supported OSes.
- The CI system will let you know if your PR fails.
- Please ensure that your code is covered with unit and functional tests.
- Don't hesitate to ask - I'm more than happy to help you with everything!
- CI system verifies the code style as well.
- If your change is related with some core validation mechanism, please run the benchmarks to ensure it isn't affecting the performance.
## Git
- The commits should follow the pattern of short notes in the past tense:
- `Added Hungarian translation`
- `Fixed IsValid bug #XXX`
- Ideally, PR has a single commit with all changes, but that's not a requirement. As long as the each commit has logical sense and complies with all the rules - it compiles, passes tests, contains the related documentation changes - then it's fine.
## Translations
- If you can help with expanding the list of built-it translations, that would be great! There is a build script helper there for you:
- Type `pwsh build.ps1 --target AddTranslation --translationName Gibberlish` (of course, plese replace `Gibberlish` with your language name).
- Navigate into `src/Validot/Translations/Gibberlish/GibberlishTranslation.cs` and replace the English phrases with their proper translations.
- The script prepares everything, including `AddGibberlishTranslation()` settings extension and automatic unit tests. All you need to do next is to raise a PR.
- You can replace `pwsh build.ps1` with `sh build.sh` or even execute windows command `bash.cmd`. It's all the same.
================================================
FILE: docs/DOCUMENTATION.md
================================================
# Documentation
## Table of contents
- [Documentation](#documentation)
- [Table of contents](#table-of-contents)
- [Introduction](#introduction)
- [Specification](#specification)
- [Scope commands](#scope-commands)
- [Parameter commands](#parameter-commands)
- [Presence commands](#presence-commands)
- [Error output](#error-output)
- [Message](#message)
- [Code](#code)
- [Path](#path)
- [Fluent api](#fluent-api)
- [Rule](#rule)
- [RuleTemplate](#ruletemplate)
- [Member](#member)
- [AsModel](#asmodel)
- [AsCollection](#ascollection)
- [AsNullable](#asnullable)
- [AsConverted](#asconverted)
- [AsType](#astype)
- [AsDictionary](#asdictionary)
- [WithCondition](#withcondition)
- [WithPath](#withpath)
- [WithMessage](#withmessage)
- [WithExtraMessage](#withextramessage)
- [WithCode](#withcode)
- [WithExtraCode](#withextracode)
- [Optional](#optional)
- [Required](#required)
- [Forbidden](#forbidden)
- [And](#and)
- [Null policy](#null-policy)
- [Reference loop](#reference-loop)
- [Validator](#validator)
- [Validate](#validate)
- [IsValid](#isvalid)
- [Factory](#factory)
- [Specification holder](#specification-holder)
- [Settings holder](#settings-holder)
- [Reusing settings](#reusing-settings)
- [Fetching holders](#fetching-holders)
- [Dependency injection](#dependency-injection)
- [Settings](#settings)
- [WithReferenceLoopProtection](#withreferenceloopprotection)
- [WithTranslation](#withtranslation)
- [Template](#template)
- [Result](#result)
- [AnyErrors](#anyerrors)
- [Paths](#paths)
- [Codes](#codes)
- [CodeMap](#codemap)
- [MessageMap](#messagemap)
- [GetTranslatedMessageMap](#gettranslatedmessagemap)
- [TranslationNames](#translationnames)
- [ToString](#tostring)
- [Rules](#rules)
- [Global rules](#global-rules)
- [Bool rules](#bool-rules)
- [Char rules](#char-rules)
- [Collections rules](#collections-rules)
- [Numbers rules](#numbers-rules)
- [Texts rules](#texts-rules)
- [Times rules](#times-rules)
- [Guid rules](#guid-rules)
- [TimeSpan rules](#timespan-rules)
- [Custom rules](#custom-rules)
- [Message arguments](#message-arguments)
- [Enum argument](#enum-argument)
- [Guid argument](#guid-argument)
- [Number argument](#number-argument)
- [Text argument](#text-argument)
- [Time argument](#time-argument)
- [Translation argument](#translation-argument)
- [Type argument](#type-argument)
- [Path argument](#path-argument)
- [Name argument](#name-argument)
- [Translations](#translations)
- [Built-in translations](#built-in-translations)
- [WithPolishTranslation](#withpolishtranslation)
- [WithSpanishTranslation](#withspanishtranslation)
- [WithRussianTranslation](#withrussiantranslation)
- [WithPortugueseTranslation](#withportuguesetranslation)
- [WithGermanTranslation](#withgermantranslation)
- [Overriding messages](#overriding-messages)
- [Custom translation](#custom-translation)
- [Development](#development)
- [Build](#build)
- [Tests](#tests)
- [Benchmarks](#benchmarks)
## Introduction
- This documentation is written in short points.
- Sometimes a point contains a subpoint.
- Occasionally, a point could have a source code following it.
- It's for demonstration, and the code is also commented in italic font.
- Most code examples in this documentation are using the following set of models:
``` csharp
public class BookModel
{
public string Title { get; set; }
public IEnumerable<AuthorModel> Authors { get; set; }
public IEnumerable<Language> Languages { get; set; }
public int YearOfFirstAnnouncement { get; set; }
public int? YearOfPublication { get; set; }
public PublisherModel Publisher { get; set; }
public bool IsSelfPublished { get; set; }
}
public class AuthorModel
{
public string Name { get; set; }
public string Email { get; set; }
}
public class PublisherModel
{
public string CompanyId { get; set; }
public string Name { get; set; }
}
public enum Language
{
English,
Polish
}
```
_Comments are usually placed below the code sample, but that's not the rock-solid principle. The important thing is that they are related to the preceding point, while the next point starts the new thing._
- Vast majority of the code snippets live as functional tests in the [separate project](../tests/Validot.Tests.Functional/).
---
## Specification
- Specification is an expression that uses [fluent api](#fluent-api) to describe all conditions of a valid object.
- Technically, [specification is a generic delegate](../src/Validot/Specification/Specification.cs), and in most cases, you'll see it in the form of a lambda function.
- If you prefer the approach of wrapping validation logic into a separate class, use the [specification holder](#specification-holder).
- Specification - considered purely as a C# function - is executed by the [validator](#validator) during its construction (directly or through the [factory](#factory)).
- However the validation logic (that specification contains in the form of predicates) is triggered only when [validator](#validator) calls [Validate](#validate) method.
- Fluent api consist of commands called in so-called method chain:
``` csharp
Specification<int> yearSpecification = m => m
.GreaterThan(-10000)
.NotEqualTo(0).WithMessage("There is no such year as 0")
.LessThan(3000);
```
_Above; four chained commands: `GreaterThan`, `NotEqualTo`, `WithMessage`, `LessThan`. All of them - the entire specification - is the single scope that validates value of type `int`._
- Logically, specification consist of scopes. And the scope could be explained as:
- Set of commands that describe validation rules for the same value.
- This value is often referred to in this documentation as "scope value".
- If the value is null, scope acts according to the [null policy](#null-policy).
``` csharp
Specification<int> yearSpecification = s => s
.GreaterThan(-10000)
.NotEqualTo(0).WithMessage("There is no such year as 0")
.LessThan(3000);
Specification<BookModel> bookSpecification = s => s
.Member(m => m.YearOfFirstAnnouncement, yearSpecification)
.Member(m => m.YearOfPublication, m => m
.Positive()
)
.Rule(m => m.YearOfPublication == m.YearOfFirstAnnouncement).WithMessage("Same year in both places is invalid");
```
_Above; `yearSpecification` contains four commands in its scope, all validating the value of type `int`._
_Next one, `bookSpecification`, is more complex. Let's analyse it:_
_First [Member](#member) command steps into the `BookModel`'s member of type `int` named `YearOfFirstAnnouncement` and in its scope validates the value using the `yearSpecification` defined earlier._
_Second [Member](#member) command opens scope that validates `YearOfPublication`; this scope contains single rule, `Positive`. Also, according to the [null policy](#null-policy), it requires the nullable member `YearOfPublication` to have a value._
_The last [scope command](#scope-commands), [Rule](#rule) contains a piece of logic for `BookModel` and [parameter command](#parameter-commands) [WithMessage](#withmessage) defines the error message if the predicate fails._
- You can also say that specification is a scope. A "root level" scope.
- All commands and their logic are related to a single value (of type `T` in `Specification<T>`).
- The [null policy](#null-policy) is followed here as well.
- Commands that validate parts of the model are using... specification to describe the scope rules.
- Even the root scope behaves as it was placed in [AsModel](#asmodel) command.
- There are three types of commands:
- [Scope commands](#scope-commands) - contain validation logic and produce [error output](#error-output).
- [Parameter commands](#paramter-commands) - changes the behavior of the preceding [scope command](#scope-commands).
- [Presence commands](#presence-commands) - sets the scope behavior in case of null value.
---
### Scope commands
- Scope command is a command that validates the model by:
- executing the validation logic directly:
- [Rule](#rule) - executes a custom predicate.
- [RuleTemplate](#ruletemplate) and all of the [built-in rules](#rules) - executes a predefined piece of logic.
- executing the validation logic wrapped in another [specification](#specification), in the way dependent on the scope value type:
- [Member](#member) - executes specification on the model's member.
- [AsModel](#asmodel) - executes specification on the model.
- [AsCollection](#ascollection) - executes specification on each item of the collection type model.
- [AsNullable](#asnullable) - executes specification on the value of the nullable type model.
``` csharp
Specification<AuthorModel> authorSpecification = m => m
.Member(m => m.Name, m => m.NotWhiteSpace().MaxLength(100))
.Member(m => m.Email, m => m.Email())
.Rule(m => m.Email != m.Name);
```
_In the above code you can see the specification containing only scope commands._
- Scope command produces [error output](#error-output) if - by any bit of a validation logic - the scope value is considered as invalid.
- How is "scope" term related with scope command?
- Good to read; [Specification](#specification) - also tries to describe what is a scope.
- All scope commands (except for [Rule](#rule) and [RuleTemplate](#ruletemplate)) validate the value by executing a specification (which is a scope).
- [Rule](#rule) and [RuleTemplate](#ruletemplate) are slightly different. They contain the most atomic part of validation logic - a predicate. They are still [scope commands](#scope-commands), because:
- They determine if the value is valid or not. The only difference is that they execute the logic directly instead of wrapped within another scope.
- They produce [error output](#error-output) in case of validation error.
---
### Parameter commands
- Parameter command is a command that affects (parametrizes) the closest [scope command](#scope-commands) placed before it.
- [WithCondition](#withcondition) - sets execution condition.
- [WithPath](#withpath) - sets the path for the [error output](#error-output).
- [WithMessage](#withmessage) - overwrites the entire [error output](#error-output) with a single message.
- [WithExtraMessage](#withextramessage) - appends a single message to the [error output](#error-output).
- [WithCode](#withcode) - overwrites the entire [error output](#error-output) with a single code.
- [WithExtraCode](#withextracode) - appends a single code to the [error output](#error-output).
- Parameter commands have their order strictly defined and enforced by the language constructs.
- So you might notice that some commands are not available from certain places.
- Example: [AsNullable](#asnullable) can't be called in the scope that validates `int`.
- Example: [WithCode](#withcode) can't be called after [WithMessage](#withmessage), because that doesn't make much sense (double overwrite...).
- To know what other commands are allowed to be placed before/after, read the section about the particular command.
- It doesn't matter how many parameter commands are defined in the row - they are all related to the closest preceding [scope command](#scope-command) (or [presence command](#presence-commands)).
- All the parameter commands start with `With...`, so it's easy to group them visually:
``` csharp
Specification<AuthorModel> authorSpecification = s => s
.Member(m => m.Name, m => m.NotWhiteSpace().MaxLength(100))
.WithCondition(m => !string.IsNullOrEmpty(m.Name))
.WithPath("AuthorName")
.WithCode("AUTHOR_NAME_ERROR")
.Member(m => m.Email, m => m.Email())
.WithMessage("Invalid email!")
.WithExtraCode("EMAIL_ERROR")
.Rule(m => m.Email != m.Name)
.WithCondition(m => m.Email != null && m.Name != null)
.WithPath("Email")
.WithMessage("Name can't be same as Email");
```
_Above, you can see that the first [Member](#member) command is configured with the following parameters commands: [WithCondition](#withcondition), [WithPath](#withpath) and [WithCode](#withcode)._
_The second [Member](#member) command is configured with [WithMessage](#withmessage), and [WithExtraCode](#withextracode) commands._
_The third scope command - [Rule](#rule) - is configured with [WithCondition](#withcondition), [WithPath](#withpath), and [WithMessage](#withmessage) commands_
---
### Presence commands
- Presence command is the command that defines the behavior of the entire scope in case of null scope value:
- [Required](#required) - scope value must not be null.
- if no presence command exists in the scope, this behavior is set implicitly, by default.
- [Forbidden](#forbidden) - scope value must be null.
- [Optional](#optional) - scope value can be null.
- Value gets validated normally if it isn't null, but nothing happens if it is.
- Only one presence command is allowed within the scope.
- Presence command needs to be the first command in the scope.
- Presence commands produce [error output](#error-output) that can be modified with some of the [parameter commands](#parameter-commands).
- Not all of them, because e.g. you can't change their [path](#path) or set an [execution condition](#withcondition).
- Good to read: [Handling nulls](#null-policy) - details about the null value validation strategy.
``` csharp
Specification<AuthorModel> authorSpecification = m => m
.Optional()
.Member(m => m.Name, m => m
.Optional()
.NotWhiteSpace()
.MaxLength(100)
)
.Member(m => m.Email, m => m
.Required().WithMessage("Email is obligatory.")
.Email()
)
.Rule(m => m.Email != m.Name);
```
_In the example above the entire model is allowed to be null. Similarly - `Name` member. `Email` is required, but the error output will contain a custom message (`Email is obligatory.`) in case of null._
---
### Error output
- Error output is everything that is returned from the scope if - according to the internal logic - the scope value is invalid.
- Therefore, the absence of error output means that the value is valid.
- Error output can contain:
- [Error messages](#message) - human-readable messages explaining what went wrong.
- [Error codes](#code) - flags that help to organize the logic around specific errors.
- Both. There are no limitations around that. The error output can contain only messages, only codes, or a mix.
- The validation process assigns every error output to the [path](#path) where it was produced.
- The [path](#path) shows the location where the error occurred.
- Sometimes this documentation refers to this action as "saving error output _under the path_"
- Good to read:
- [Result](#result) - how to get the error output from the validation process.
- [Path](#path) - how the paths are constructed.
---
#### Message
- Messages are primarily targeted to humans.
- Use case; logs and the details about invalid models incoming from the frontend.
- Use case; rest api returning messages that frontend shows in the pop up.
- [Error output](#error-output) can contain one or more error messages.
- Good to read:
- [Translations](#translations) - how to translate a message or [overwrite](#overriding-messages) the default one.
- [Message arguments](#message-arguments) - how to use message arguments.
- [MessageMap](#messagemap) - how to read messages from the [validation result](#result).
- Message can be set using [WithMessage](#withmessage), [WithExtraMessage](#withmessage), and [RuleTemplate](#ruletemplate) commands.
``` csharp
Specification<int> yearSpecification = s => s
.Rule(year => year > -300)
.WithMessage("Minimum year is 300 B.C.")
.WithExtraMessage("Ancient history date is invalid.")
.Rule(year => year != 0)
.WithMessage("The year 0 is invalid.")
.WithExtraMessage("There is no such year as 0.")
.Rule(year => year < 10000)
.WithMessage("Maximum year is 10000 A.D.");
var validator = Validator.Factory.Create(yearSpecification);
var result = validator.Validate(-500);
result.MessageMap[""][0] // Minimum year is 300 B.C.
result.MessageMap[""][1] // Ancient history date is invalid.
validator.ToString();
// Minimum year is 300 B.C.
// Ancient history date is invalid.
```
_In the above code, [MessageMap](#messagemap) holds the messages assigned to their paths. Empty string as a path means that the error is recorded for the root model._
- Printing returned by [ToString](#tostring) method includes the path before each message.
``` csharp
Specification<int> yearSpecification = s => s
.Rule(year => year > -300)
.WithMessage("Minimum year is 300 B.C.")
.WithExtraMessage("Ancient history date is invalid.")
.Rule(year => year != 0)
.WithMessage("The year 0 is invalid.")
.WithExtraMessage("There is no such year as 0.")
.Rule(year => year < 10000)
.WithMessage("Maximum year is 10000 A.D.");
Specification<BookModel> bookSpecification = s => s
.Member(m => m.YearOfFirstAnnouncement, yearSpecification)
.Member(m => m.YearOfPublication, m => m.AsNullable(yearSpecification))
.Rule(m => m.YearOfFirstAnnouncement <= m.YearOfPublication)
.WithCondition(m => m.YearOfPublication.HasValue)
.WithMessage("Year of publication must be after the year of first announcement");
var validator = Validator.Factory.Create(bookSpecification);
var book = new BookModel() { YearOfFirstAnnouncement = 0, YearOfPublication = -100 };
var result = validator.Validate(book);
result.MessageMap[""][0]; // Year of publication must be after the year of first announcement
result.MessageMap["YearOfFirstAnnouncement"][0]; // "The year 0 is invalid.
result.MessageMap["YearOfFirstAnnouncement"][1]; // There is no such year as 0.
result.ToString();
// Year of publication must be after the year of first announcement
// YearOfFirstAnnouncement: The year 0 is invalid.
// YearOfFirstAnnouncement: There is no such year as 0.
```
---
#### Code
- Codes are primarily for the parsers and interpreters - they should be short flags, easy to process.
- Code cannot contain white space characters.
- Good to read:
- [CodeMap](#codemap) - how to read codes from the validation result.
- [Codes](#codes) - a quick list of all codes from the result.
``` csharp
Specification<int> yearSpecification = s => s
.Rule(year => year > -300)
.WithCode("MAX_YEAR")
.Rule(year => year != 0)
.WithCode("ZERO_YEAR")
.WithExtraCode("INVALID_VALUE")
.Rule(year => year < 10000)
.WithCode("MIN_YEAR");
var validator = Validator.Factory.Create(yearSpecification);
var result = validator.Validate(0);
result.Codes; // [ "ZERO_YEAR", "INVALID_VALUE" ]
result.CodeMap[""][0]; // [ "ZERO_YEAR" ]
result.CodeMap[""][1]; // [ "INVALID_VALUE" ]
result.ToString();
// ZERO_YEAR, INVALID_VALUE
```
_In the above example, [CodeMap](#codemap) acts similarly to [MessageMap](#messagemap). Also, for your convenience, [Codes](#codes) holds all the error codes in one place. [ToString()](#tostring) called on the result prints error codes, coma separated, in the first line._
---
### Path
- Path is a string that shows the way of reaching the value that is invalid.
- "The way" means which members need to be traversed through in order to reach the particular value.
- Example; `Author.Email` path describes the value of `Email` that is inside `Author`.
- Path contains segments, and each one stands for one member that the validation context needs to enter in order to reach the value.
- Path segments are separated with `.` (dot character).
- [Member](#member), which is the way of stepping into the nested level uses the member's name as a segment.
``` csharp
model.Member.NestedMember.MoreNestedMember.Email = "invalid_email_value";
var result = validator.Validate(model);
result.MessageMap["Member.NestedMember.MoreNestedMember.Email"][0]; // Must be a valid email address
result.ToString();
// Member.NestedMember.MoreNestedMember.Email: Must be a valid email address
```
- When it comes to collections (validated with [AsCollection](#ascollection), n-th (counting from zero) item is considered as the member named `#n`.
``` csharp
model.MemberCollection[0].NestedMember.MoreNestedMemberCollection[23].Email = "invalid_email_value";
var result = validator.Validate(model);
result.MessageMap["MemberCollection[0].NestedMember.MoreNestedMemberCollection[23].Email"][0]; // Must be a valid email address
result.ToString();
// MemberCollection[0].NestedMember.MoreNestedMemberCollection[23]: Must be a valid email address
```
_Above, `MemberCollection.#0.NestedMember.MoreNestedMemberCollection.#23.Email:` is the path that leads through 1st item of `MemberCollection` and 24th item of `MoreNestedMemberCollection`._
- You are free to modify the path of every error output using [WithPath](#withpath).
---
### Fluent api
- The order the commands in the specification is strictly enforced by the language constructs. Invalid order means compilation error.
---
#### Rule
- `Rule` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `Rule` defines a single, atomic bit of validation logic with a predicate that accepts the scope value and returns:
- `true`, if the scope value is valid.
- `false`, if the scope value in invalid.
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification = m => m.Rule(isAgeValid);
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.IsValid(12); // true
ageValidator.IsValid(20); // false
ageValidator.Validate(32).ToString();
// Error
```
- If the predicate returns `false`, the `Rule` scope returns [error output](#error-output).
- The default error output of `Rule` command is a single [message](#message) key `Global.Error`
- Default English translation for it is just `Error`.
- It can be altered with [WithMessage](#withmessage) command.
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification = m => m.Rule(isAgeValid).WithMessage("The age is invalid");
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.Validate(32).ToString();
// The age is invalid
```
_This is just a regular usage of [WithMessage](#withmessage) command that overwrites the entire [error output](#error-output) of the preceding [scope command](#scope-commands) (in this case - `Rule`)._
- `Rule` can be used to validate dependencies between the scope object's members.
- If the [error output](#error-output) of such validation should be placed in the member scope rather than its parent, use [WithPath](#withpath) command.
``` csharp
Specification<BookModel> bookSpecification = m => m
.Rule(book => book.IsSelfPublished == (book.Publisher is null)).WithMessage("Book must have a publisher or be self-published.");
var bookValidator = Validator.Factory.Create(bookSpecification);
bookValidator.Validate(new BookModel() { IsSelfPublished = true, Publisher = new PublisherModel() }).ToString();
// Book must have a publisher or be self-published.
bookValidator.Validate(new BookModel() { IsSelfPublished = true, Publisher = null }).AnyErrors; // false
```
- The value received in the predicate as an argument is never null.
- All null-checks on it are redundant, no matter what code analysis has to say about it.
- Although the received value is never null, its members could be!
``` csharp
Specification<PublisherModel> publisherSpecification = m => m
.Rule(publisher =>
{
if (publisher.Title.Contains(publisher.CompanyId))
{
return false;
}
return true;
});
var validator = Validator.Factory.Create(publisherSpecification);
validator.Validate(new PublisherModel()); // throws NullReferenceException
```
_In the above example, `publisher` argument is never null, but `Title` and `CompanyId` could be, thus it's high a risk of `NullReferenceException`._
- All unhandled exceptions are bubbled up to the surface and can be caught from `Validate` method.
- Exceptions are unmodified and are not wrapped.
``` csharp
var verySpecialException = new VerySpecialException();
Specification<BookModel> bookSpecification = m => m.Rule(book => throw verySpecialException);
var bookValidator = Validator.Factory.Create(bookSpecification);
try
{
bookValidator.Validate(new BookModel());
}
catch(VerySpecialException exception)
{
object.ReferenceEquals(exception, verySpecialException); // true
}
```
- After processing the [Specification](#specification), the [validator](#validator) stores the predicate in its internals.
- This is the very reason to be double-cautious when "capturing" variables in the predicate function as you're risking memory leak. Especially when the [validator](#validator) is registered as a singleton in a DI container.
---
#### RuleTemplate
- `RuleTemplate` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `RuleTemplate` is a special version of [Rule](#rule).
- All of the details described in the [Rule](#rule) section also apply to `RuleTemplate`.
- The purpose of `RuleTemplate` is to deliver a convenient foundation for predefined, reusable rules.
- All [built-in rules](#rules) use `RuleTemplate` under the hood. There are no exceptions, hacks, or special cases.
- So if you decide to write your own [custom rules](#custom-rules), you're using the exact same api that the Validot uses.
- Technically, there is nothing wrong in placing `RuleTemplate` in the specification directly, but it's not considered as a good practice.
- You should rather limit the usage of `RuleTemplate` to its purpose; [custom rules](#custom-rules).
- `RuleTemplate` accepts three parameters:
- `Predicate<T>` - predicate that tells if the value is valid or not (exactly the same meaning as in [Rule](#rule)).
- `message` - error message content. Required.
- `args` - a collection of [arguments](#message-arguments) that can be used in the message content. Optional.
- `message` sets the single [error message](#message) that will be in the [error output](#error-output) if the predicate returns `false`.
- So the result is the same as when using `Rule` followed by `WithMessage`. Below example presents that:
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification1 = m => m.Rule(isAgeValid).WithMessage("The age is invalid");
Specification<int> ageSpecification2 = m => m.RuleTemplate(isAgeValid, "The age is invalid");
var ageValidator1 = Validator.Factory.Create(ageSpecification1);
var ageValidator2 = Validator.Factory.Create(ageSpecification2);
ageValidator1.Validate(32).ToString();
// The age is invalid
ageValidator2.Validate(32).ToString();
// The age is invalid
```
_The above code presents that there is no difference between the basic usage of [Rule](#rule) and [RuleTemplate](#ruletemplate)._
- `args` parameter is optional, and it's a collection of [arguments](#message-arguments) that can be used in placeholders within the error message.
- Each argument needs to be created with `Arg` static factory
- Ok, technically it doesn't _need_ to be created by the factory, but it's highly recommended as implementing `IArg` yourself could be difficult and more support for it is planned, but not in the very nearly future.
- Factory contains helper methods to create arguments related with enums, types, texts, numbers, and guids.
- When creating an argument, factory needs:
- `name` - needs to be unique across the collection of arguments.
- it's the base part of the placeholder: `{name}`
- value - value that the message can use
- `Arg.Number("minimum", 123)` - creates a number argument named `minimum` with `int` value of `123`
- `Arg.Text("title", "Star Wars")` - creates text argument named `title` with `string` value of `"Star Wars"`
- Good to read: [Message arguments](#message-arguments) - how to use arguments in messages
- Placeholders in the [error message](#message) will be replaced with the value of the related argument.
- Name must be the same
- Placeholder needs follow the pattern: `{argumentName}`
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification = m => m
.RuleTemplate(isAgeValid, "Age must be between {minAge} and {maxAge}", Arg.Number("minAge", 0), Arg.Number("maxAge", 18));
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.Validate(32).ToString();
// Age must be between 0 and 18
```
- Optionally, placeholders can contain additional parameters:
- Good to read: [Message arguments](#message-arguments)
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification = m => m
.RuleTemplate(
isAgeValid,
"Age must be between {minAge|format=0.00} and {maxAge|format=0.00|culture=pl-PL}",
Arg.Number("minAge", 0),
Arg.Number("maxAge", 18)
);
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.Validate(32).ToString();
// Age must be between 0.00 and 18,00
```
_Notice that the format follows dotnet [custom numeric format strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings). The `maxAge` argument also has a different culture set (`pl-PL`, so `,` as a divider instead of `.`)._
- Not all arguments need to be used.
- One argument can be used more than once in the same message.
- If there is any error (like invalid name of the argument or parameter), no exception is thrown in the code, but the string, unformatted, goes directly to the error output.
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification = m => m
.RuleTemplate(
isAgeValid,
"Age must be between {minAge|format=0.00} and {maximumAge|format=0.00|culture=pl-PL}",
Arg.Number("minAge", 0),
Arg.Number("maxAge", 18)
);
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.Validate(32).ToString();
// "Age must be between 0.00 and {maximumAge|format=0.00|culture=pl-PL}"
```
_In the above example, `maximumAge` is invalid argument name (`maxAge` would be OK in this case) and therefore - the placeholder stays as it is._
- `RuleTemplate` exposes its arguments to all [messages](#message) in its [error output](#error-output).
- Each message can contain only a subset of arguments.
- Each message is free to use any formatting it wants.
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification = m => m
.RuleTemplate(
isAgeValid,
"Age must be between {minAge|format=0.00} and {maxAge|format=0.00|culture=pl-PL}",
Arg.Number("minAge", 0),
Arg.Number("maxAge", 18)
)
.WithExtraMessage("Must be more than {minAge}")
.WithExtraMessage("Must be below {maxAge|format=0.00}! {maxAge}!");
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.Validate(32).ToString();
// Age must be between 0.00 and 18,00
// Must be more than 0
// Must be below 18.00! 18!
```
- Arguments passed to `RuleTemplate` are also available in [WithMessage](#withmessage) and [WithExtraMessage](#withextramessage).
``` csharp
Predicate<int> isAgeValid = age => (age >= 0) && (age < 18);
Specification<int> ageSpecification = m => m
.RuleTemplate(
isAgeValid,
"Age must be between {minAge|format=0.00} and {maxAge|format=0.00|culture=pl-PL}",
Arg.Number("minAge", 0),
Arg.Number("maxAge", 18)
)
.WithMessage("Only {minAge}-{maxAge}!");
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.Validate(32).ToString();
// Only 0-18!
```
- Because all the [built-in rules](#rules) are based on `RuleTemplate`, this is the magic behind altering their error message and still having access to the arguments.
``` csharp
Specification<int> ageSpecification = m => m.Between(min: 0, max: 18).WithMessage("Only {min}-{max|format=0.00}!");
var ageValidator = Validator.Factory.Create(ageSpecification);
ageValidator.Validate(32).ToString();
// Only 0-18!
```
_In the above example, `Between` is a built-in rule for `int` type values that exposes `min` and `max` parameters to be used in the error messages._
- Good to read:
- [Message arguments](#message-arguments) - everything about the available arguments, their types, and parameters.
- [Custom rules](#custom-rules) - how to create a custom rule, step by step.
- [Rules](#rules) - the detailed list of all arguments available in each of the built-in rule.
---
#### Member
- `Member` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `Member` executes a specification upon a scope object's member.
- `Member` command accepts:
- member selector - a lambda expression pointing at a scope object's member.
- specification - [specification](#specification) to be executed upon the selected member.
- Member selector serves two purposes:
- It points at the member that will be validated with the passed [specification](#specification).
- So technically it determines type `T` in `Specification<T>` that `Member` accepts as a second parameter.
- It defines the nested path under which the entire [error output](#error-output) from the passed [specification](#specification) will be saved.
- By default, if the member selector is `m => m.Author`, the [error output](#error-output) will be saved under the path `Author` (as a next segment).
``` csharp
Specification<string> nameSpecification = s => s
.Rule(name => name.All(char.IsLetter)).WithMessage("Must consist of letters only!")
.Rule(name => !name.Any(char.IsWhiteSpace)).WithMessage("Must not contain whitespace!");
var nameValidator = Validator.Factory.Create(nameSpecification);
nameValidator.Validate("Adam !!!").ToString();
// Must consist of letters only!
// Must not contain whitespace!
```
_In the above example, you can see specification and validation of a string value. Let's use this exact specification inside `Member` command and observe how the entire output is saved under a nested path:_
``` csharp
Specification<PublisherModel> publisherSpecification = s => s
.Member(m => m.Name, nameSpecification);
var publisherValidator = Validator.Factory.Create(publisherSpecification);
var publisher = new PublisherModel()
{
Name = "Adam !!!"
};
publisherValidator.Validate(publisher).ToString();
// Name: Must consist of letters only!
// Name: Must not contain whitespace!
```
_Let's add one more level:_
``` csharp
Specification<BookModel> bookSpecification = s => s
.Member(m => m.Publisher, publisherSpecification);
var bookValidator = Validator.Factory.Create(bookSpecification);
var book = new BookModel()
{
Publisher = new PublisherModel()
{
Name = "Adam !!!"
}
};
authorValidator.Validate(book).ToString();
// Publisher.Name: Must consist of letters only!
// Publisher.Name: Must not contain whitespace!
```
- Whether to define a [specification](#specification) upfront and pass it to the `Member` command or define everything inline - it's totally up to you. It doesn't make any difference.
- The only thing that is affected is the source code readability.
- However, in some particular situations, reusing predefined specifications could lead to having an infinite reference loop in the object. This topic is covered in [Reference loop](#reference-loop) section.
``` csharp
Specification<BookModel> bookSpecification = s => s
.Member(m => m.Publisher, m => m
.Member(m1 => m1.Name, m1 => m1
.Rule(name => name.All(char.IsLetter)).WithMessage("Must consist of letters only!")
.Rule(name => !name.Any(char.IsWhiteSpace)).WithMessage("Must not contain whitespace!")
)
);
var bookValidator = Validator.Factory.Create(bookSpecification);
var book = new BookModel()
{
Publisher = new PublisherModel()
{
Name = "Adam !!!"
};
};
authorValidator.Validate(book).ToString();
// Publisher.Name: Must consist of letters only!
// Publisher.Name: Must not contain whitespace!
```
- Selected member can be only one level from the scope object!
- No language construct prevents you from stepping into more nested levels (so no compilation errors), but then, during runtime, [validator](#validator) throws the exception from its constructor (or [factory](#factory)).
- This behavior is very likely to be updated in the future versions, so such selectors might be allowed someday... but not now.
``` csharp
Specification<BookModel> bookSpecification = s => s
.Member(m => m.Publisher.Name, nameSpecification);
Validator.Factory.Create(bookSpecification); // throws exception
```
_In the above example, the exception is thrown because member selector goes two levels down (`Publisher.Name`). Please remember that one level down is allowed (just `Publisher` would be totally OK)._
- Selected member can be either property or variable.
- It can't be a function.
- Type of selected member doesn't matter (can be a reference type, value type, string, enum, or whatever...).
- The default path for the [error output](#error-output) (determined by the member selector) can be altered using [WithPath](#withpath) command.
- If the selected member contains null, the member scope is still executed and the [error output](#error-output) entirely depends on the [specification](#specification).
- It means that null member is not anything special. It's a normal situation, and the behavior relies on the passed [specification](#specification), its [presence commands](#presence-commands), and the [null handling strategy](#null-policy).
``` csharp
Specification<PublisherModel> publisherSpecification = s => s
.Member(m => m.Name, m => m
.Rule(name => name.All(char.IsLetter)).WithMessage("Must consist of letters only!")
.Rule(name => !name.Any(char.IsWhiteSpace)).WithMessage("Must not contain whitespace!")
);
Specification<PublisherModel> publisherSpecificationRequired = s => s
.Member(m => m.Name, m => m
.Required().WithMessage("Must be filled in!")
.Rule(name => name.All(char.IsLetter)).WithMessage("Must consist of letters only!")
.Rule(name => !name.Any(char.IsWhiteSpace)).WithMessage("Must not contain whitespace!")
);
Specification<PublisherModel> publisherSpecificationOptional = s => s
.Member(m => m.Name, m => m
.Optional()
.Rule(name => name.All(char.IsLetter)).WithMessage("Must consist of letters only!")
.Rule(name => !name.Any(char.IsWhiteSpace)).WithMessage("Must not contain whitespace!")
);
var publisherValidator = Validator.Factory.Create(publisherSpecification);
var publisherValidatorRequired = Validator.Factory.Create(publisherSpecificationRequired);
var publisherValidatorOptional = Validator.Factory.Create(publisherSpecificationOptional);
var publisher = new PublisherModel()
{
Name = null
};
publisherValidator.Validate(publisher).ToString();
// Name: Required
publisherValidatorRequired.Validate(publisher).ToString();
// Name: Must be filled in!
publisherValidatorOptional.Validate(publisher).AnyErrors; // false
```
_Without any [presence command](#presence-commands) in `publisherSpecification`, the default behavior is to require the scope value to be non-null. The [error message](#message) can be customized (`publisherSpecificationRequired`) with [Required](#required) command followed by [WithMessage](#withmessage)._
_If the specification starts with `Optional`, no error is returned from the member scope._
---
#### AsModel
- `AsModel` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `AsModel` executes a specification upon the scope value.
- `AsModel` command accepts only one argument; a specification `Specification<T>`, where `T` is the current scope type.
- Technically `AsModel` executes specification in the same scope that it lives itself.
- So you can say it's like [Member](#member) command, but it doesn't step into any member.
``` csharp
Specification<string> emailSpecification = s => s
.Rule(email => email.Contains('@')).WithMessage("Must contain @ character!");
Specification<string> emailAsModelSpecification = s => s
.AsModel(emailSpecification);
var emailValidator = Validator.Factory.Create(emailSpecification);
var emailAsModelValidator = Validator.Factory.Create(emailAsModelSpecification);
emailValidator.Validate("invalid email").ToString();
// Must contain @ character!
emailAsModelValidator.Validate("invalid email").ToString();
// Must contain @ character!
```
_In the above code you can see that it doesn't matter whether specification is used directly or through `AsModel` - the validation logic is the same and the [error output](#error-output) is saved under the same [path](#path)._
``` csharp
Specification<string> emailSpecification = s => s
.Rule(email => email.Contains('@')).WithMessage("Must contain @ character!");
Specification<string> emailNestedAsModelSpecification = s => s
.AsModel(s1 => s1
.AsModel(s2 => s2
.AsModel(emailSpecification)
)
);
var emailValidator = Validator.Factory.Create(emailSpecification);
var emailNestedAsModelValidator = Validator.Factory.Create(emailNestedAsModelSpecification);
emailValidator.Validate("invalid email").ToString();
// Must contain @ character!
emailAsModelValidator.Validate("invalid email").ToString();
// Must contain @ character!
```
_The above example presents that even several levels of nested `AsModel` commands don't make any difference._
- `AsModel` can be used to execute many independent [specifications](#specification) on the same value.
- Effectively, it's like merging [specifications](#specification) into one.
``` csharp
Specification<string> atRequiredSpecification = s => s
.Rule(text => text.Contains('@')).WithMessage("Must contain @ character!");
Specification<string> allLettersLowerCaseSpecification = s => s
.Rule(text => !text.Any(c => !char.IsLetter(c) || char.IsLower(c))).WithMessage("All letters need to be lower case!");
Specification<string> lengthSpecification = s => s
.Rule(text => text.Length > 5).WithMessage("Must be longer than 5 characters")
.Rule(text => text.Length < 20).WithMessage("Must be shorter than 20 characters");
Specification<string> emailSpecification = s => s
.AsModel(atRequiredSpecification)
.AsModel(allLettersLowerCaseSpecification)
.AsModel(lengthSpecification);
var emailValidator = Validator.Factory.Create(emailSpecification);
emailValidator.Validate("Email").ToString();
// Must contain @ character!
// All letters need to be lower case!
// Must be longer than 5 characters
```
_In the above example, you can see how three separate [specifications](#specification) are - practically - combined into one._
- `AsModel` can be used to mix predefined specifications with inline rules.
- Thanks to this, you might "modify" the presence rule in the predefined specification.
``` csharp
Specification<string> atRequiredSpecification = s => s
.Rule(text => text.Contains('@')).WithMessage("Must contain @ character!");
Specification<string> allLettersLowerCaseSpecification = s => s
.Rule(text => !text.Any(c => !char.IsLetter(c) || char.IsLower(c))).WithMessage("All letters need to be lower case!");
Specification<string> emailSpecification = s => s
.Optional()
.AsModel(atRequiredSpecification)
.AsModel(allLettersLowerCaseSpecification)
.Rule(text => text.Length > 5).WithMessage("Must be longer than 5 characters")
.Rule(text => text.Length < 20).WithMessage("Must be shorter than 20 characters");
var emailValidator = Validator.Factory.Create(emailSpecification);
emailValidator.Validate("Email").ToString();
// Must contain @ character!
// All letters need to be lower case!
// Must be longer than 5 characters
emailValidator.Validate(null).AnyErrors; // false
```
_The example above shows that predefined [specification](#specification) can be expanded with more rules (`AsModel` and subsequent [Rule](#rule) commands)._
_Also, you can observe the interesting behavior that can be described as [presence rule](#presence-commands) alteration. Please notice that `emailSpecification` starts with [Optional](#optional) command that makes the entire model optional (null is allowed) and no error is returned even though both `atRequiredSpecification` and `allLettersLowerCaseSpecification` require model to be not null. Of course, technically it is NOT a modification of their presence settings, but the specification execution would never reach them. Why? The scope value is null, and the scope presence rule `Optional` allows this. And in case of null, as always, no further validation is performed in the scope. Not a big deal, but the example gives an overview of how to play with fluent-api bits to "modify" presence rule._
_Naturally, this works the other way around. Below a short demo of how to make a model required while only using specification that allows the model to be null:_
``` csharp
Specification<string> emailOptionalSpecification = s => s
.Optional()
.Rule(text => text.Contains('@')).WithMessage("Must contain @ character!");
Specification<string> emailSpecification = s => s
.AsModel(emailOptionalSpecification);
var emailOptionalValidator = Validator.Factory.Create(emailOptionalSpecification);
var emailValidator = Validator.Factory.Create(emailSpecification);
emailOptionalValidator.Validate(null).AnyErrors; // false
emailOptionalValidator.Validate("Email").ToString();
// Must contain @ character!
emailValidator.Validate(null).ToString();
// Required
emailValidator.Validate("Email").ToString();
// Must contain @ character!
```
_As you can notice, null passed to `emailOptionalValidator` doesn't produce any validation errors (and it's okay, because the specification allows that with `Optional` command). Having the same specification in `AsModel` effectively changes this behavior. True, null passed to `AsModel` would not return any error output, but null never gets there. The root scope (`emailSpecification`) doesn't allow nulls and it terminates the validation before reaching `AsModel`._
- `AsModel` can be very helpful if you want to bundle many commands and want a single [error message](#message) if any of them indicates validation error.
- Saying that, `AsModel` can wrap the entire [specification](#specification) and return single [error message](#message) out of it.
- This is just a regular usage of [WithMessage](#withmessage) command and applies to all [scope commands](#scope-commands), not only `AsModel`. It's mentioned here only to present this very specific use case. For more details, please read the [WithMessage](#withmessage) section.
``` csharp
Specification<string> emailSpecification = s => s
.Rule(text => text.Contains('@')).WithMessage("Must contain @ character!")
.Rule(text => !text.Any(c => !char.IsLetter(c) || char.IsLower(c))).WithMessage("All letters need to be lower case!")
.Rule(text => text.Length > 5).WithMessage("Must be longer than 5 characters")
.Rule(text => text.Length < 20).WithMessage("Must be shorter than 20 characters");
Specification<string> emailWrapperSpecification = s => s
.AsModel(emailSpecification).WithMessage("This value is invalid as email address");
var emailValidator = Validator.Factory.Create(emailSpecification);
var emailWrapperValidator = Validator.Factory.Create(emailWrapperSpecification);
emailValidator.Validate("Email").ToString();
// Must contain @ character!
// All letters need to be lower case!
// Must be longer than 5 characters
emailWrapperValidator.Validate("Email").ToString();
// This value is invalid as email address
```
_Above, `emailSpecification` contains multiple rules and - similarly - can have several [messages](#message) in its [error output](#error-output). When wrapped within `AsModel` followed by `WithMessage` command, any validation failure results with just a single error message._
_The advantage of this combination is even more visible when you define [specification](#specification) inline and skip all of the error messages attached to the rules - they won't ever be in the output anyway._
``` csharp
Specification<string> emailSpecification = s => s
.AsModel(s1 => s1
.Rule(text => text.Contains('@'))
.Rule(text => !text.Any(c => !char.IsLetter(c) || char.IsLower(c)))
.Rule(text => text.Length > 5)
.Rule(text => text.Length < 20)
).WithMessage("This value is invalid as email address");
var emailValidator = Validator.Factory.Create(emailSpecification);
emailValidator.Validate("Email").ToString();
// This value is invalid as email address
```
---
#### AsCollection
- `AsCollection` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `AsCollection` command has two generic type parameters: `AsCollection<T, TItem>`, where:
- `TItem` - is a type of the single item in the collection.
- `T` - is derived from `IEnumerable<TItem>`.
- `AsCollection` has dedicated versions for some dotnet native collections, so you don't need to specify a pair of `IEnumerable<TItem>` and `TItem` while dealing with:
- `T[]`
- `IEnumerable<T>`
- `ICollection<T>`
- `IReadOnlyCollection<T>`
- `IList<T>`
- `IReadOnlyList<T>`
- `List<T>`
- `AsCollection` accepts one parameter; item [specification](#specification) `Specification<TItem>`.
- `AsCollection` executes the passed [specification](#specification) upon each item in the collection.
- Internally, getting the items out of the collection is done using `foreach` loop.
- Validation doesn't materialize the collection. Elements are picked up using enumerator (as in standard `foreach` loop).
- So it might get very tricky when you implement IEnumerable yourself; there is no protection against an infinite stream of objects coming from the enumerator, etc.
- Items are validated one after another, sequentially.
- Support for async collection validation is coming in the future releases.
- [Error output](#error-output) from the n-th item in the collection is saved under the path `#n`.
- The counting starts from zero (the first item in the collection is `0` and its [error output](#error-output) will be saved under `#0`).
- Validation uses the standard `foreach` loop over the collection, so "n-th item" really means "n-th item received from enumerator".
- For some types, the results won't be deterministic, simple because the collection itself doesn't guarantee to keep the order. It might happen that the error output saved under path `#1` next time will be saved under `#13`. This could be a problem for custom collections or some particular use cases, like instance of `HashSet<TItem>` that gets modified between the two validations. But it will never happen for e.g. array or `List<T>`.
``` csharp
Specification<int> evenNumberSpecification = s => s
.Rule(number => (number % 2) == 0).WithMessage("Number must be even");
Specification<int[]> specification = s => s
.AsCollection(evenNumberSpecification);
var validator = Validator.Factory.Create(specification);
var numbers = new[] { 1, 2, 3, 4, 5 };
validator.Validate(numbers).ToString();
// #0: Number must be even
// #2: Number must be even
// #4: Number must be even
```
_`AsCollection` is able to automatically resolve the type parameters for array. In this case, `AsCollection` is `AsCollection<int[], int>` under the hood._
- `AsCollection` makes sense only if the type validated in the scope is a collection
- Well... technically, that's not entirely true, because the only requirement is that it implements `IEnumerable<TItem>` interface.
- Code completion tools (IntelliSense, Omnisharp, etc.) will show `AsCollection` as always available, but once inserted you'll need to define `T` and `TItem`, so effectively - `AsCollection` works only for collections.
_Let's consider a custom class holding two collections:_
``` csharp
class NumberCollection : IEnumerable<int>, IEnumerable<double>
{
public IEnumerable<int> Ints { get; set; }
public IEnumerable<double> Doubles { get; set; }
IEnumerator<double> IEnumerable<double>.GetEnumerator() => Doubles.GetEnumerator();
IEnumerator<int> IEnumerable<int>.GetEnumerator() => Ints.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable<int>)this).GetEnumerator();
}
```
_You can use `AsCollection` to validate an object as a collection of any type; as long as you are able to specify both generic type parameters:_
``` csharp
Specification<int> evenNumberSpecification = s => s
.Rule(number => (number % 2) == 0).WithMessage("Number must be even");
Specification<double> smallDecimalSpecification = s => s
.Rule(number => Math.Floor(number) < 0.5).WithMessage("Decimal part must be below 0.5");
Specification<NumberCollection> specification = s => s
.AsCollection<NumberCollection, int>(evenNumberSpecification)
.AsCollection<NumberCollection, double>(smallDecimalSpecification);
var validator = Validator.Factory.Create(specification);
var numberCollection = new NumberCollection()
{
Ints = new [] { 1, 2, 3, 4, 5 },
Doubles = new [] { 1.1, 2.8, 3.3, 4.6, 5.9 }
}
validator.Validate(numberCollection).ToString();
// #0: Number must be even
// #1: Decimal part must be below 0.5
// #2: Number must be even
// #3: Decimal part must be below 0.5
// #4: Number must be even
// #4: Decimal part must be below 0.5
```
_Above, `AsCollection` command triggers validation of `NumberCollection` as a collection of `int` and `double` items, each with their own [specification](#specification)._
- `AsCollection` doesn't treat the null item as anything special. The behavior is described by the passed [specification](#specification).
- `AsCollection` is like [Member](#member) command, but the member selector is pointing at the collection items and the path is dynamic.
``` csharp
Specification<AuthorModel> authorSpecification = s => s
.Member(m => m.Email, m => m
.Rule(email => email.Contains('@')).WithMessage("Must contain @ character!")
);
Specification<BookModel> bookSpecification = s => s
.Member(m => m.Authors, m => m.AsCollection(authorSpecification));
var bookValidator = Validator.Factory.Create(bookSpecification);
var book = new BookModel()
{
Authors = new[]
{
null,
new AuthorModel() { Email = "foo@bar" },
new AuthorModel() { Email = null },
null,
new AuthorModel() { Email = "InvalidEmail" },
null,
}
};
bookValidator.Validate(book).ToString();
// Authors.#0: Required
// Authors.#2.Email: Required
// Authors.#3: Required
// Authors.#4.Email: Must contain @ character!
// Authors.#5: Required
```
_In the code above you can see that null items in the collection result with the default [error message](#message). This is because `authorSpecification` doesn't allow nulls._
_Let's change this and see what happens:_
``` csharp
Specification<AuthorModel> authorSpecification = s => s
.Optional()
.Member(m => m.Email, m => m
.Rule(email => email.Contains('@')).WithMessage("Must contain @ character!")
);
Specification<BookModel> bookSpecification = s => s
.Member(m => m.Authors, m => m.AsCollection(authorSpecification));
var bookValidator = Validator.Factory.Create(bookSpecification);
var book = new BookModel()
{
Authors = new[]
{
null,
new AuthorModel() { Email = "foo@bar" },
new AuthorModel() { Email = null },
null,
new AuthorModel() { Email = "InvalidEmail" },
null,
}
};
validator.Validate(book).ToString();
// Authors.#2.Email: Required
// Authors.#4.Email: Must contain @ character!
```
_Above, `authorSpecification` starts with [Optional](#optional) command, and therefore null items in the collection are allowed._
- `AsCollection` validates the collection items, but the collection itself (as an object) can be normally validated in its own scope normally, as any other value.
- One of the widespread use cases is to verify the collection size:
``` csharp
Specification<AuthorModel> authorSpecification = s => s
.Optional()
.Member(m => m.Email, m => m
.Rule(email => email.Contains('@')).WithMessage("Must contain @ character!")
);
Specification<BookModel> bookSpecification = s => s
.Member(m => m.Authors, m => m
.AsCollection(authorSpecification)
.Rule(authors => authors.Count() <= 5).WithMessage("Book can have max 5 authors.")
);
var bookValidator = Validator.Factory.Create(bookSpecification);
var book = new BookModel()
{
Authors = new[]
{
null,
new AuthorModel() { Email = "foo@bar" },
new AuthorModel() { Email = null },
null,
new AuthorModel() { Email = "InvalidEmail" },
null,
}
};
bookValidator.Validate(book).ToString();
// Authors.#2.Email: Required
// Authors.#4: Must contain @ character!
// Authors: Book can have max 5 authors.
```
---
#### AsNullable
- `AsNullable` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `AsNullable` "unwraps" the nullable value and provides the way to validate it with a [specification](#specification).
- `AsNullable` accepts a single parameter; `Specification<T>`, where `T` is a value type wrapped in `Nullable<T>` (`T?`).
- Null value never reaches `AsNullable`, exactly as [handling nulls policy](#null-policy) states.
- The passed [specification](#specification) describes `T` that is a value type, so [Optional](#optional) command is not even available.
- Null must be handled one level higher (in the [specification](#specification) that contains `AsNullable`).
``` csharp
Specification<int> numberSpecification = s => s
.Rule(number => number < 10).WithMessage("Number must be less than 10");
Specification<int?> nullableSpecification = s => s
.AsNullable(numberSpecification);
var validator = Validator.Factory.Create(nullableSpecification);
validator.Validate(5).AnyErrors; // false
validator.Validate(15).ToString();
// Number must be less than 10
validator.Validate(null).ToString();
// Required
```
_In the above code, `Validate` method accepts `int?`. You can observe that the value is unwrapped by `AsNullable` and validated with `numberSpecification` (that describes just `int`)._
_If the nullable value is null, it is stopped at the level of `nullableSpecification`, which doesn't allow nulls. Of course, you can change this behavior:_
``` csharp
Specification<int> numberSpecification = s => s
.Rule(number => number < 10).WithMessage("Number must be less than 10");
Specification<int?> nullableSpecification = s => s
.Optional()
.AsNullable(numberSpecification);
var validator = Validator.Factory.Create(nullableSpecification);
validator.Validate(5).AnyErrors; // false
validator.Validate(null).AnyErrors; // false
validator.Validate(15).ToString();
// Number must be less than 10
```
_Now, `nullableSpecification` starts with [Optional](#optional) command, and therefore - null doesn't result with an error. On the other hand - if nullable has a value, it is passed and validated with `numberSpecification`._
- [Every built-in rule](#rules) for a value type has an extra variant for the nullable of this type.
- So you don't need to provide `AsNullable` in the most popular and simple cases.
``` csharp
Specification<int> numberSpecification = s => s.GreaterThan(0).LessThan(10);
Specification<int?> nullableSpecification = s => s.GreaterThan(0).LessThan(10);
var numberValidator = Validator.Factory.Create(numberSpecification);
var nullableValidator = Validator.Factory.Create(nullableSpecification);
numberValidator.Validate(5).AnyErrors; // false
nullableValidator.Validate(5).AnyErrors; // false
numberValidator.Validate(15).ToString();
// Must be less than 10
nullableValidator.Validate(15).ToString();
// Must be less than 10
```
_In the above code, `GreaterThan` and `LessThan` can be applied to both `Specification<int?>` and `Specification<int>`. Technically, they are two separate rules with same names. The consistency of their inner logic is verified by the unit tests._
- `AsNullable` can be handy when you have two versions of the same type (nullable and non-nullable) that can be validated with the same specification.
``` csharp
Specification<int> yearSpecification = s => s
.Rule(year => year >= -3000).WithMessage("Minimum year is 3000 B.C.")
.Rule(year => year <= 3000).WithMessage("Maximum year is 3000 A.D.");
Specification<BookModel> bookSpecification = s => s
.Member(m => m.YearOfFirstAnnouncement, yearSpecification)
.Member(m => m.YearOfPublication, m => m
.Optional()
.AsNullable(yearSpecification)
);
var bookValidator = Validator.Factory.Create(bookSpecification);
var book = new BookModel()
{
YearOfFirstAnnouncement = -4000,
YearOfPublication = 4000
};
bookValidator.Validate(book).ToString()
// YearOfFirstAnnouncement: Minimum year is 3000 B.C.
// YearOfPublication: Maximum year is 3000 A.D.
```
_Above the example how two members - nullable `YearOfPublication` and non-nullable `YearOfFirstAnnouncement` - can be validated with the same specification `yearSpecification`._
---
#### AsConverted
- `AsConverted` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `AsConverted` validates the value as a different value.
- It could be a value of the same, or of a different type.
- The type of the specification is determined by the converter's output.
- `AsConverted` accepts:
- A conversion function (of type `System.Converter<in TInput,out TOutput>`) that takes the current scope value and outputs the new value.
- A specification for type `TOutput` used to validate the converted value.
- `AsConverted` executes the delivered specification within the same scope (so all errors are saved on the same level)
- So technically, it could be considered as [AsModel](#asmodel), but with a conversion method that's executed upon the scope value before the futher validation.
_Below; a snippet presenting how to sanitize the value (for whatever reason that could be an actual case) before validating it with the predefined specification._
``` csharp
Specification<string> nameSpecification = s => s
.Rule(name => char.IsUpper(name.First())).WithMessage("Must start with a capital letter!")
.Rule(name => !name.Any(char.IsWhiteSpace)).WithMessage("Must not contain whitespace!");
Converter<string, string> sanitizeName = firstName => firstName.Trim();
Specification<string> nameValueSpecification = s => s
.AsConverted(sanitizeName, nameSpecification);
var nameValidator = Validator.Factory.Create(nameValueSpecification);
nameValidator.Validate("Bartosz").AnyErrors; // false
nameValidator.Validate(" Bartosz ").AnyErrors; // false
nameValidator.Validate(" bartosz ").ToString();
// Must start with a capital letter!
nameValidator.Validate(" Bart osz ").ToString();
// Must not contain whitespace!
```
_Of course, type can be different. It's the converter's output that determines the specification. Also, both arguments could be delivered inline:_
``` csharp
Specification<AuthorModel> authorSpecification = s => s
.Member(m => m.Name, m => m.AsConverted(
name => name.Length,
nameLength => nameLength.Rule(l => l % 2 == 0).WithMessage("Characters amount must be even"))
);
var nameValidator = Validator.Factory.Create(authorSpecification);
var author = new AuthorModel()
{
Name = "Bartosz"
};
nameValidator.Validate(author).ToString();
// Name: Characters amount must be even
```
- The [template](#template) will contain all errors from the delivered specification, which could lead to misleading case in which the "Required" error is listed as a possible outcome for a value type.
- This happens when a value type is converted to a reference type.
- If you want to "fix" te template, add [Optional](#optional) at the beginning in the converted value's specification.
``` csharp
Specification<int> specification1 = s => s
.AsConverted(
v => v.ToString(CultureInfo.InvariantCulture),
c => c.MaxLength(10).WithMessage("Number must be max 5 digits length")
);
Validator.Factory.Create(specification1).Template.ToString();
// Required
// Number must be max 5 digits length
Specification<int> specification2 = s => s
.AsConverted(
v => v.ToString(CultureInfo.InvariantCulture),
c => c.Optional().MaxLength(10).WithMessage("Number must be max 5 digits length")
);
Validator.Factory.Create(specification2).Template.ToString();
// Number must be max 5 digits length
```
---
#### AsType
- `AsType` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `AsType` validates the value as if it was of a different type.
- If the value can be cast into the target type (using `is`/`as` operators), the validation proceeds with the given specifiction.
- If the value can't be cast (`is` check returns false), nothing happens. No error output is recorded and the validation continues with the subsequent commands.
- `AsType` accepts:
- A specification for type `TTarget` used to validate the cast value.
- `AsType` executes the delivered specification within the same scope (so all errors are saved on the same level)
- So technically `.AsType(targetTypeSpecification)`, it could be considered as a shortcut for [AsConverted](#asmodel) command combined with [WithCondition](#withcondition): `.AsConverted(v => v as TargetType, targetTypeSpecification).WithCondition(v => v is TargetType)`.
_Let's use the classic inheritance example, like: `Animal -> Mammal -> Elephant`_:
``` csharp
class Animal
{
public int AnimalId { get; set; }
}
class Mammal : Animal
{
public int MammalId { get; set; }
}
class Elephant : Mammal
{
public int ElephantId { get; set; }
}
```
_Contructing validator for the class at the bottom of the inheritance graph (`Elephant` in this case), you can use `AsType` and apply specifiction of any of its ancestors_:
``` csharp
Specification<int> idSpecification = s => s.NonZero();
Specification<Animal> animalSpecification = s => s
.Member(m => m.AnimalId, idSpecification);
Specification<Elephant> elephantSpecification = s => s
.Member(m => m.ElephantId, idSpecification)
.AsType(animalSpecification);
var elephantValidator = Validator.Factory.Create(elephantSpecification);
elephantValidator.Validate(new Elephant() { ElephantId = 10, AnimalId = 10 }).AnyErrors; // false
elephantValidator.Validate(new Elephant() { ElephantId = 0, AnimalId = 10 }).ToString();
// ElephantId: Must not be zero
elephantValidator.Validate(new Elephant() { ElephantId = 10, AnimalId = 0 }).ToString();
// AnimalId: Must not be zero
```
_It works also in opposite direction. You can create a validator for the ancestor type and use descendants' specifications:_
``` csharp
Specification<int> idSpecification = s => s.NonZero();
Specification<Elephant> elephantSpecification = s => s
.Member(m => m.ElephantId, idSpecification);
Specification<Animal> animalSpecification = s => s
.Member(m => m.AnimalId, idSpecification)
.AsType(elephantSpecification);
var animalValidator = Validator.Factory.Create(animalSpecification);
animalValidator.Validate(new Elephant() { ElephantId = 10, AnimalId = 10 }).AnyErrors; // false
animalValidator.Validate(new Elephant() { ElephantId = 0, AnimalId = 10 }).ToString();
// ElephantId: Must not be zero
animalValidator.Validate(new Elephant() { ElephantId = 10, AnimalId = 0 }).ToString();
// AnimalId: Must not be zero
```
_`AsType` executes only if the type can be cast (`value is TTargetType` is true), so you can use specifiction of unrelated types if for whatever reason you need something that works like a validation hub. Notice that you can construct the specification inline as well (but it's handy to do it with a constructor notation so the compiler can pick up the types from it):_
``` csharp
Specification<object> specification = s => s
.AsType(new Specification<int>(number => number.NonZero()))
.AsType(new Specification<string>(text => text.NotEmpty()));
var validator = Validator.Factory.Create(specification);
validator.Validate(12).AnyErrors // false
validator.Validate("test").AnyErrors // false
validator.Validate(0L).AnyErrors // false, because it's not an integer
validator.Validate(0).ToString();
// Must not be zero
validator.Validate("").ToString();
// Must not be empty
```
_Naturally, errors from all levels are ultimately grouped by the paths in the report. Below the example of the one containing messages from all three levels:_
``` csharp
Specification<int> idSpecification = s => s.NonZero();
Specification<Animal> animalSpecification = s => s
.Member(m => m.AnimalId, idSpecification);
Specification<Mammal> mammalSpecification = s => s
.Member(m => m.MammalId, idSpecification)
.And()
.Member(m => m.AnimalId, idSpecification)
.WithMessage("Something wrong with animal from mammal perspective")
.And()
.AsType(animalSpecification);
Specification<Elephant> elephantSpecification = s => s
.Member(m => m.ElephantId, idSpecification)
.And()
.Member(m => m.MammalId, idSpecification)
.WithMessage("Something wrong with mammal from elephant perspective")
.And()
.Member(m => m.AnimalId, idSpecification)
.WithMessage("Something wrong with animal from elephant perspective")
.And()
.AsType(mammalSpecification);
var elephantValidator = Validator.Factory.Create(elephantSpecification);
elephantValidator.Validate(new Elephant() { ElephantId = 10, MammalId = 10, AnimalId = 10 }).AnyErrors; // false
elephantValidator.Validate(new Elephant() { ElephantId = 0, MammalId = 10, AnimalId = 10 }).ToString();
// ElephantId: Must not be zero
elephantValidator.Validate(new Elephant() { ElephantId = 10, MammalId = 0, AnimalId = 10 }).ToString();
// MammalId: Must not be zero
// MammalId: Something wrong with mammal from elephant perspective
elephantValidator.Validate(new Elephant() { ElephantId = 0, MammalId = 0, AnimalId = 0 }).ToString();
// ElephantId: Must not be zero
// MammalId: Must not be zero
// MammalId: Something wrong with mammal from elephant perspective
// AnimalId: Must not be zero
// AnimalId: Something wrong with animal from mammal perspective
// AnimalId: Something wrong with animal from elephant perspective
```
---
#### AsDictionary
- `AsDictionary` is a [scope command](#scope-commands).
- Can be placed after:
- any command except [Forbidden](#forbidden).
- Can be followed by:
- any of the [scope commands](#scope-commands).
- any of the [parameter commands](#parameter-commands).
- `AsDictionary` in its core has three generic type parameters: `AsDictionary<T, TKey, TValue>`, where:
- `T` - is the type of the key-value pair collection (to be exact: `IEnumerable<KeyValuePair<TKey, TValue>>`), which applies to many dotnet native dictionary-like types.
- `TKey` - is the type of the dictionary key.
- `TValue` - is the type of the dictionary value.
- `AsDictionary` has dedicated versions for some dotnet native dictionary-like types, so you don't need to specify `T`, `TKey`, and `TValue` while dealing with:
- `Dictionary<TKey, TValue>`
- `IDictionary<TKey, TValue>`
- `IReadOnlyDictionary<TKey, TValue>`
- `IReadOnlyCollection<KeyValuePair<TKey, TValue>>`
- `AsDictionary` accepts two parameters;
- dictionary value [specification](#specification) `Specification<TValue>`.
- dictionary key stringifier `Func<TKey, string> keyStringifier` (function that converts `TKey` to a `string` so it could become a part of the [path](#path)).
- `AsDictionary` executes the passed [specification](#specification) upon each value in the dictionary.
- Internally, getting the items out of the `IEnumerable<KeyValuePair<TKey, TValue>>` collection is done using `foreach` loop.
- Validation doesn't materialize the collection. Elements are picked up using enumerator (as in standard `foreach` loop).
- So it might get very tricky when you implement `IEnumerable<KeyValuePair<TKey, TValue>>` yourself; there is no protection against an infinite stream of objects coming from the enumerator, etc.
- For some types, the results won't be deterministic, simple because the collection itself doesn't guarantee to keep the order. It might happen that the error output saved under path `#1` next time will be saved under `#13`. This could be a problem for custom collections or some particular use cases, like instance of `HashSet<TItem>` that gets modified between the two validations. But it will never happen for e.g. array or `List<T>`.
- [Error output](#error-output) from every pair's value is saved under the path of the same pair's stringified key.
- After the key is stringified, it gets also also normalized so it could be used as a part of the path:
- If the key is null or empty, the path is ` ` (single space).
- `<` is trimmed from the beginning of the key and then `.` is trimmed from both ends.
- Multiple dots (e.g. `..`, or `.......`) are replaced with a single dot `.`.
- Normalization ensures that the error location isn't modified by the key's content.
- `AsDictionary` has dedicated version for the dictionaries that have `string` keys, so you don't need to provide the key stringifier.
- The dedicated versions are the same as in the regular `AsDictionary`:
- `Dictionary<string, TValue>`
- `IDictionary<string, TValue>`
- `IReadOnlyDictionary<string, TValue>`
- `IReadOnlyCollection<KeyValuePair<string, TValue>>`
- Essentially, it's like the stringifier is `key => key`.
_Let's start with validating an instance of `Dictionary<string, int>`._
``` csharp
Specification<int> intValueSpecification = s => s.Rule(p => p % 2 == 0).WithMessage("Value must be even");
Specification<Dictionary<string, int>> specification = s => s.AsDictionary(intValueSpecification);
var validator = Validator.Factory.Create(specification);
var dictionary = new Dictionary<string, int>()
{
["One"] = 11,
["Two"] = 22,
["Three"] = 33,
["Four"] = 44,
["Five"] = 55
};
validator.Validate(dictionary).ToString();
// One: Value must be even
// Three: Value must be even
// Five: Value must be even
```
_Above, `intValueSpecification` that specifies integer numbers is used to validate the dictionary values. The dictionary has string keys, and no key stringifier is provided, so the errors are saved under the path determined by the key._
_Below, same example but the key stringifier upper-cases the key._
``` csharp
Specification<Dictionary<string, int>> specification = s => s
.AsDictionary(
// AsDictionary's first argument is inline specification for the value
s => s.Rule(p => p % 2 == 0).WithMessage("Value must be even"),
// AsDictionary's second argument is the key stringifier
k => k.ToUpperInvariant()
);
var validator = Validator.Factory.Create(specification);
var dictionary = new Dictionary<string, int>()
{
["One"] = 11,
["Two"] = 22,
["Three"] = 33,
["Four"] = 44,
["Five"] = 55
};
validator.Validate(dictionary).ToString();
// ONE: Value must be even
// THREE: Value must be even
// FIVE: Value must be even
```
_Null values are handled in the same way as everywhere else: by default, the dictionary value is expected to be non-null._
``` csharp
Specification<Dictionary<string, string>> specification = s => s
.AsDictionary(d => d
.Rule(p => p.Length % 2 == 0).WithMessage("Value length must be even")
);
var validator = Validator.Factory.Create(specification);
var dictionary = new Dictionary<string, string>()
{
["One"] = "11",
["Two"] = "22222",
["Three"] = null,
["Four"] = null,
["Five"] = "55"
};
validator.Validate(dictionary).ToString();
// Two: Value length must be even
// Three: Required
// Four: Required
```
_Null as a dictionary value could be enabled by placing `Optional()` as the specification's first command:_
``` csharp
Specification<Dictionary<string, string>> specification = s => s
.AsDictionary(d => d
.Optional()
.Rule(p => p.Length % 2 == 0).WithMessage("Value length must be even")
);
var validator = Validator.Factory.Create(specification);
var dictionary = new Dictionary<string, string>()
{
["One"] = "11",
["Two"] = "22222",
["Three"] = null,
["Four"] = null,
["Five"] = "55"
};
validator.Validate(dictionary).ToString();
// Two: Value length must be even
```
_The path in the template uses `#` as dictionary key, so it's the same behavior as in [AsCollection](#ascollection)._
``` csharp
Specification<Dictionary<string, string>> specification = s => s
.AsDictionary(d => d
.Rule(p => p.Length % 2 == 0).WithMessage("Value length must be even")
);
var validator = Validator.Factory.Create(specification);
validator.Template.ToString();
// Required
// #: Required
// #: Value length must be even
```
_The keys are normalized, so they can't result in invalid error path or alter it. No multiple dots `...` , no `<` at the beginning._
``` csharp
Specification<Dictionary<string, int>> specification = s => s
.AsDictionary(
d => d.Rule(p => p % 2 == 0).WithMessage("Value must be even"),
k => k.ToLowerInvariant()
);
var validator = Validator.Factory.Create(specification);
var dictionary = new Dictionary<string, int>()
{
["OnE..."] = 11,
["ThR...eE"] = 33,
["<<<...FiVe..."] = 55,
["...SeVeN"] = 77,
["<<<NiNe"] = 99,
};
validator.Validate(dictionary).ToString();
// one: Value must be even
// thr.ee: Value must be even
// five: Value must be even
// seven: Value must be even
// nine: Value must be even
```
_Under the hood, `AsDictionary` processes not even a dictionary, but `IEnumerable<KeyValuePair<TKey, TValue>>`. So it's not a problem to use it with any class that implements this interface:_
``` csharp
class SimpleDictionary : IEnumerable<KeyValuePair<int, int>>
{
public SimpleDictionary(Dictionary<int, int> items)
{
Items = items;
}
private IEnumerable<KeyValuePair<int, int>> Items { get; }
IEnumerator<KeyValuePair<int, int>> IEnumerable<KeyValuePair<int, int>>.GetEnumerator() => Items.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable<KeyValuePair<int, int>>)this).GetEnumerator();
}
```
_Above, the custom class that implements `IEnumerable<KeyValuePair<int, int>>`. Below, the example presenting how straightforward is to validate it using `AsDictionary`:_
``` csharp
Specification<int> valueSpecification = s => s
.Rule(p => p % 2 == 0).WithMessage("Value must be even");
Func<int, string> keyStringifier = key =>
{
var keyString = "";
for (var i = 0; i < key; i++)
{
keyString += "X";
}
return keyString;
};
Specification<SimpleDictionary> specification = s => s
.AsDictionary(valueSpecification, keyStringifier);
var validator = Validator.Factory.Create(specification);
var dictionary = new SimpleDictionary(new Dictionary<int, int>()
{
[1] = 11,
[2] = 22,
[3] = 33,
[4] = 44,
[5] = 55
});
validator.Validate(dictionary).ToString();
// X: Value must be even
// XXX: Value must be even
// XXXXX: Value must be even
```
_This works also if a class implements multiple generic versions of `IEnumerable<KeyValuePair<TKey, TValue>>`:_
``` csharp
class DoubleDictionary : IEnumerable<KeyValuePair<int, int>>, IEnumerable<KeyValuePair<string, string>>
{
private readonly IEnumerable<KeyValuePair<int, int>> _ints;
private readonly IEnumerable<KeyValuePair<string, string>> _strings;
public DoubleDictionary(Dictionary<int, int> ints, Dictionary<string, string> strings)
{
_ints = ints;
_strings = strings;
}
IEnumerator<KeyValuePair<int, int>> IEnumerable<KeyValuePair<int, int>>.GetEnumerator() => _ints.GetEnumerator();
IEnumerator<KeyValuePair<string, string>> IEnumerable<KeyValuePair<string, string>>.G
gitextract_6qgujrz3/
├── .editorconfig
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── config.yml
│ │ └── feature_request.md
│ ├── README.md
│ ├── pull_request_template.md
│ └── workflows/
│ ├── CI.yml
│ └── Init-WorkflowVariables.ps1
├── .gitignore
├── .nuke/
│ ├── build.schema.json
│ └── parameters.json
├── LICENSE
├── Validot.sln
├── build/
│ ├── .editorconfig
│ ├── Build.cs
│ ├── Configuration.cs
│ ├── _build.csproj
│ └── _build.csproj.DotSettings
├── build.cmd
├── build.ps1
├── build.sh
├── docs/
│ ├── CHANGELOG.md
│ ├── CONTRIBUTING.md
│ ├── DOCUMENTATION.md
│ └── articles/
│ ├── crafting-model-specifications-using-validot.md
│ └── validots-performance-explained.md
├── nuget.config
├── src/
│ └── Validot/
│ ├── CodeHelper.cs
│ ├── Errors/
│ │ ├── Args/
│ │ │ ├── ArgHelper.cs
│ │ │ ├── ArgPlaceholder.cs
│ │ │ ├── EnumArg.cs
│ │ │ ├── EnumArgFactory.cs
│ │ │ ├── GuidArg.cs
│ │ │ ├── GuidArgFactory.cs
│ │ │ ├── IArg.cs
│ │ │ ├── NameArg.cs
│ │ │ ├── NumberArg.cs
│ │ │ ├── NumberArgFactory.cs
│ │ │ ├── TextArg.cs
│ │ │ ├── TextArgFactory.cs
│ │ │ ├── TimeArg.cs
│ │ │ ├── TimeArgFactory.cs
│ │ │ ├── TranslationArg.cs
│ │ │ ├── TypeArg.cs
│ │ │ └── TypeArgFactory.cs
│ │ ├── CacheIntegrityException.cs
│ │ ├── Error.cs
│ │ ├── IError.cs
│ │ ├── IMessageService.cs
│ │ ├── MessageCache.cs
│ │ ├── MessageService.cs
│ │ ├── ReferenceLoopError.cs
│ │ └── Translator/
│ │ ├── MessageTranslator.cs
│ │ └── TranslationResult.cs
│ ├── Factory/
│ │ ├── HolderInfo.cs
│ │ ├── ISettingsHolder.cs
│ │ ├── ISpecificationHolder.cs
│ │ └── ValidatorFactory.cs
│ ├── IValidator.cs
│ ├── PathHelper.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── Results/
│ │ ├── IValidationResult.cs
│ │ └── ValidationResult.cs
│ ├── Rules/
│ │ ├── BoolRules.cs
│ │ ├── CharRules.cs
│ │ ├── Collections/
│ │ │ ├── ArrayRules.cs
│ │ │ ├── BaseCollectionRules.cs
│ │ │ ├── IEnumerableRules.cs
│ │ │ ├── IListRules.cs
│ │ │ ├── IReadOnlyCollectionRules.cs
│ │ │ ├── IReadOnlyListRules.cs
│ │ │ └── ListRules.cs
│ │ ├── GuidRules.cs
│ │ ├── Numbers/
│ │ │ ├── ByteRules.cs
│ │ │ ├── CharNumbersRules.cs
│ │ │ ├── DecimalRules.cs
│ │ │ ├── DoubleRules.cs
│ │ │ ├── FloatRules.cs
│ │ │ ├── IntRules.cs
│ │ │ ├── LongRules.cs
│ │ │ ├── SByteRules.cs
│ │ │ ├── ShortRules.cs
│ │ │ ├── UIntRules.cs
│ │ │ ├── ULongRules.cs
│ │ │ └── UShortRules.cs
│ │ ├── Text/
│ │ │ ├── EmailRules.cs
│ │ │ ├── EmailValidationMode.cs
│ │ │ └── StringRules.cs
│ │ ├── TimeSpanRules.cs
│ │ └── Times/
│ │ ├── DateTimeFormats.cs
│ │ ├── DateTimeOffsetRules.cs
│ │ ├── DateTimeRules.cs
│ │ ├── TimeComparer.cs
│ │ └── TimeComparison.cs
│ ├── Settings/
│ │ ├── IValidatorSettings.cs
│ │ ├── ValidatorSettings.cs
│ │ └── ValidatorSettingsExtensions.cs
│ ├── Specification/
│ │ ├── AndExtension.cs
│ │ ├── AsCollectionExtension.cs
│ │ ├── AsConvertedExtension.cs
│ │ ├── AsDictionaryExtension.cs
│ │ ├── AsDictionaryWithStringKeyExtension.cs
│ │ ├── AsModelExtension.cs
│ │ ├── AsNullableExtension.cs
│ │ ├── AsTypeExtension.cs
│ │ ├── Commands/
│ │ │ ├── AsCollectionCommand.cs
│ │ │ ├── AsConvertedCommand.cs
│ │ │ ├── AsDictionaryCommand.cs
│ │ │ ├── AsModelCommand.cs
│ │ │ ├── AsNullableCommand.cs
│ │ │ ├── AsTypeCommand.cs
│ │ │ ├── ForbiddenCommand.cs
│ │ │ ├── ICommand.cs
│ │ │ ├── IScopeCommand.cs
│ │ │ ├── MemberCommand.cs
│ │ │ ├── OptionalCommand.cs
│ │ │ ├── RequiredCommand.cs
│ │ │ ├── RuleCommand.cs
│ │ │ ├── WithCodeCommand.cs
│ │ │ ├── WithConditionCommand.cs
│ │ │ ├── WithExtraCodeCommand.cs
│ │ │ ├── WithExtraMessageCommand.cs
│ │ │ ├── WithMessageCommand.cs
│ │ │ └── WithPathCommand.cs
│ │ ├── ForbiddenExtension.cs
│ │ ├── MemberExtension.cs
│ │ ├── OptionalExtension.cs
│ │ ├── RequiredExtension.cs
│ │ ├── RuleExtension.cs
│ │ ├── Specification.cs
│ │ ├── SpecificationApi.cs
│ │ ├── WithCodeExtension.cs
│ │ ├── WithConditionExtension.cs
│ │ ├── WithExtraCodeExtension.cs
│ │ ├── WithExtraMessageExtension.cs
│ │ ├── WithMessageExtension.cs
│ │ └── WithPathExtension.cs
│ ├── Testing/
│ │ ├── TestFailedException.cs
│ │ ├── TestResult.cs
│ │ ├── Tester.cs
│ │ └── ToStringContentType.cs
│ ├── ThrowHelper.cs
│ ├── Translations/
│ │ ├── Chinese/
│ │ │ ├── ChineseTranslation.cs
│ │ │ └── ChineseTranslationsExtensions.cs
│ │ ├── English/
│ │ │ ├── EnglishTranslation.cs
│ │ │ └── EnglishTranslationsExtensions.cs
│ │ ├── German/
│ │ │ ├── GermanTranslation.cs
│ │ │ └── GermanTranslationsExtensions.cs
│ │ ├── ITranslationCompiler.cs
│ │ ├── MessageKey.cs
│ │ ├── Polish/
│ │ │ ├── PolishTranslation.cs
│ │ │ └── PolishTranslationsExtensions.cs
│ │ ├── Portuguese/
│ │ │ ├── PortugueseTranslation.cs
│ │ │ └── PortugueseTranslationsExtensions.cs
│ │ ├── Russian/
│ │ │ ├── RussianTranslation.cs
│ │ │ └── RussianTranslationsExtensions.cs
│ │ ├── Spanish/
│ │ │ ├── SpanishTranslation.cs
│ │ │ └── SpanishTranslationsExtensions.cs
│ │ ├── TranslationCompiler.cs
│ │ └── _Template/
│ │ ├── _TemplateTranslation.cs.txt
│ │ └── _TemplateTranslationsExtensions.cs.txt
│ ├── TypeStringifier.cs
│ ├── Validation/
│ │ ├── DiscoveryContext.cs
│ │ ├── ErrorFlag.cs
│ │ ├── IDiscoveryContext.cs
│ │ ├── IDiscoveryContextActions.cs
│ │ ├── IErrorsHolder.cs
│ │ ├── IValidationContext.cs
│ │ ├── IsValidValidationContext.cs
│ │ ├── Scheme/
│ │ │ ├── IModelScheme.cs
│ │ │ ├── ModelScheme.cs
│ │ │ └── ModelSchemeFactory.cs
│ │ ├── Scopes/
│ │ │ ├── Builders/
│ │ │ │ ├── CommandScopeBuilder.cs
│ │ │ │ ├── ErrorBuilder.cs
│ │ │ │ ├── ErrorMode.cs
│ │ │ │ ├── ICommandScopeBuilder.cs
│ │ │ │ ├── IScopeBuilderContext.cs
│ │ │ │ ├── RuleCommandScopeBuilder.cs
│ │ │ │ ├── ScopeBuilder.cs
│ │ │ │ └── ScopeBuilderContext.cs
│ │ │ ├── CollectionCommandScope.cs
│ │ │ ├── CommandScope.cs
│ │ │ ├── ConvertedCommandScope.cs
│ │ │ ├── DictionaryCommandScope.cs
│ │ │ ├── ICommandScope.cs
│ │ │ ├── IDiscoverable.cs
│ │ │ ├── IScope.cs
│ │ │ ├── ISpecificationScope.cs
│ │ │ ├── IValidatable.cs
│ │ │ ├── MemberCommandScope.cs
│ │ │ ├── ModelCommandScope.cs
│ │ │ ├── NullableCommandScope.cs
│ │ │ ├── Presence.cs
│ │ │ ├── RuleCommandScope.cs
│ │ │ ├── SpecificationScope.cs
│ │ │ └── TypeCommandScope.cs
│ │ ├── Stacks/
│ │ │ ├── PathStack.cs
│ │ │ ├── ReferenceLoopException.cs
│ │ │ ├── ReferenceLoopProtectionSettings.cs
│ │ │ └── ReferencesStack.cs
│ │ └── ValidationContext.cs
│ ├── Validator.cs
│ ├── Validot.csproj
│ └── ValidotException.cs
└── tests/
├── AssemblyWithHolders/
│ ├── AssemblyWithHolders.csproj
│ ├── AssemblyWithHoldersHook.cs
│ ├── HolderOfDecimalSpecification.cs
│ ├── HolderOfIntSpecificationAndSettings.cs
│ ├── HolderOfMultipleSpecifications.cs
│ ├── HolderOfMultipleSpecificationsAndSettings.cs
│ ├── HolderOfStringSpecification.cs
│ ├── HolderOfStringSpecificationAndSettings.cs
│ ├── NestedHolders.cs
│ ├── PrivateSpecificationAndSettingsHolder.cs
│ ├── PrivateSpecificationHolder.cs
│ └── Properties/
│ └── AssemblyInfo.cs
├── Validot.Benchmarks/
│ ├── .editorconfig
│ ├── Comparisons/
│ │ ├── ComparisonDataSet.cs
│ │ ├── EngineOnlyBenchmark.cs
│ │ ├── InitializationBenchmark.cs
│ │ ├── ReportingBenchmark.cs
│ │ ├── ToStringBenchmark.cs
│ │ └── ValidationBenchmark.cs
│ ├── EmailModesBenchmark.cs
│ ├── Program.cs
│ └── Validot.Benchmarks.csproj
├── Validot.MemoryLeak/
│ ├── .editorconfig
│ ├── Program.cs
│ ├── StreamDataSet.cs
│ ├── Validot.MemoryLeak.csproj
│ └── Validot.MemoryLeak.dockerfile
├── Validot.Tests.Functional/
│ ├── .editorconfig
│ ├── ConcurrencyFuncTests.cs
│ ├── Documentation/
│ │ ├── CustomRulesFuncTests.cs
│ │ ├── ErrorOutputFuncTests.cs
│ │ ├── FactoryFuncTests.cs
│ │ ├── FluentApiFuncTests.cs
│ │ ├── MessageArgumentsFuncTests.cs
│ │ ├── Models/
│ │ │ ├── A.cs
│ │ │ ├── AuthorModel.cs
│ │ │ ├── B.cs
│ │ │ ├── BookModel.cs
│ │ │ ├── Language.cs
│ │ │ └── PublisherModel.cs
│ │ ├── ParameterCommandsFuncTests.cs
│ │ ├── PresenceCommandsFuncTests.cs
│ │ ├── ReferenceLoopFuncTests.cs
│ │ ├── ResultFuncTests.cs
│ │ ├── ScopeCommandsFuncTests.cs
│ │ ├── SettingsFuncTests.cs
│ │ ├── SpecificationFuncTests.cs
│ │ ├── TranslationsFuncTests.cs
│ │ └── ValidatorFuncTests.cs
│ ├── Readme/
│ │ ├── FeaturesFuncTests.cs
│ │ └── QuickStartFuncTests.cs
│ └── Validot.Tests.Functional.csproj
└── Validot.Tests.Unit/
├── .editorconfig
├── CodeHelperTests.cs
├── ErrorContentApiHelper.cs
├── ErrorSetupApiHelper.cs
├── Errors/
│ ├── Args/
│ │ ├── ArgHelperTests.cs
│ │ ├── EnumArgTests.cs
│ │ ├── GuidArgTests.cs
│ │ ├── NameArgTests.cs
│ │ ├── NumberArgTests.cs
│ │ ├── TextArgTests.cs
│ │ ├── TimeArgTests.cs
│ │ ├── TranslationArgTests.cs
│ │ └── TypeArgTests.cs
│ ├── MessageCacheTests.cs
│ ├── MessageServiceTests.cs
│ ├── ReferenceLoopErrorTests.cs
│ └── Translator/
│ └── MessageTranslatorTests.cs
├── Factory/
│ ├── HolderInfoTests.cs
│ └── ValidatorFactoryTests.cs
├── GuardTests.cs
├── PathHelperTests.cs
├── PathTestData.cs
├── Results/
│ └── ValidationResultTests.cs
├── Rules/
│ ├── BoolRulesTests.cs
│ ├── CharRulesTests.cs
│ ├── Collections/
│ │ ├── ArrayRulesTests.cs
│ │ ├── BaseCollectionRulesTests.cs
│ │ ├── CollectionsTestData.cs
│ │ ├── IEnumerableRulesTests.cs
│ │ ├── IListRulesTests.cs
│ │ ├── IReadOnlyCollectionRulesTests.cs
│ │ ├── IReadOnlyListRulesTests.cs
│ │ └── ListRulesTests.cs
│ ├── GuidRulesTests.cs
│ ├── Numbers/
│ │ ├── ByteRulesTests.cs
│ │ ├── CharNumbersRulesTests.cs
│ │ ├── DecimalRulesTests.cs
│ │ ├── DoubleRulesTests.cs
│ │ ├── FloatRulesTests.cs
│ │ ├── IntRulesTests.cs
│ │ ├── LongRulesTests.cs
│ │ ├── NumbersTestData.cs
│ │ ├── SByteRulesTests.cs
│ │ ├── ShortRulesTests.cs
│ │ ├── UIntRulesTests.cs
│ │ ├── ULongRulesTests.cs
│ │ └── UShortRulesTests.cs
│ ├── RulesHelper.cs
│ ├── Text/
│ │ ├── CharRulesTests.cs
│ │ ├── EmailRulesTests.cs
│ │ └── StringRulesTests.cs
│ ├── TimeSpanRulesTests.cs
│ └── Times/
│ ├── DateTimeOffsetRulesTests.cs
│ ├── DateTimeRulesTests.cs
│ └── TimesTestData.cs
├── Settings/
│ ├── ValidatorSettingsExtensionsTests.cs
│ ├── ValidatorSettingsTestHelpers.cs
│ └── ValidatorSettingsTests.cs
├── Specification/
│ ├── AndExtensionTests.cs
│ ├── ApiTester.cs
│ ├── AsCollectionExtensionTests.cs
│ ├── AsConvertedExtensionTests.cs
│ ├── AsDictionaryExtensionTests.cs
│ ├── AsDictionaryWithKeyStringExtensionTests.cs
│ ├── AsModelExtensionTests.cs
│ ├── AsNullableExtensionTests.cs
│ ├── AsTypeExtensionTests.cs
│ ├── Commands/
│ │ ├── AsCollectionCommandTests.cs
│ │ ├── AsConvertedCommandTests.cs
│ │ ├── AsDictionaryCommandTests.cs
│ │ ├── AsModelCommandTests.cs
│ │ ├── AsNullableCommandTests.cs
│ │ ├── AsTypeCommandTests.cs
│ │ ├── MemberCommandTests.cs
│ │ └── RuleCommandTests.cs
│ ├── ForbiddenExtensionTests.cs
│ ├── MemberExtensionTests.cs
│ ├── OptionalExtensionTests.cs
│ ├── RequiredExtensionTests.cs
│ ├── RuleExtensionTests.cs
│ ├── WithCodeExtensionTests.cs
│ ├── WithConditionExtensionTests.cs
│ ├── WithExtraCodeExtensionTests.cs
│ ├── WithExtraMessageExtensionTests.cs
│ ├── WithMessageExtensionTests.cs
│ └── WithPathExtensionTests.cs
├── TempTests.cs
├── Testing/
│ └── TesterTests.cs
├── Translations/
│ ├── Chinese/
│ │ └── ChineseTranslationsExtensionsTests.cs
│ ├── English/
│ │ └── EnglishTranslationsExtensionsTests.cs
│ ├── German/
│ │ └── GermanTranslationsExtensionsTests.cs
│ ├── MessageKeyTests.cs
│ ├── Polish/
│ │ └── PolishTranslationsExtensionsTests.cs
│ ├── Portuguese/
│ │ └── PortugueseTranslationsExtensionsTests.cs
│ ├── Russian/
│ │ └── RussianTranslationsExtensionsTests.cs
│ ├── Spanish/
│ │ └── SpanishTranslationsExtensionsTests.cs
│ ├── TranslationCompilerTests.cs
│ ├── TranslationTestHelpers.cs
│ └── _Template/
│ └── _TemplateTranslationsExtensionsTests.cs.txt
├── TypeStringifierTests.cs
├── Validation/
│ ├── DiscoveryContextTests.cs
│ ├── ErrorFlagTests.cs
│ ├── IsValidValidationContextTests.cs
│ ├── Scheme/
│ │ ├── ModelSchemeFactoryTests.cs
│ │ └── ModelSchemeTests.cs
│ ├── Scopes/
│ │ ├── Builders/
│ │ │ ├── CommandScopeBuilderTests.cs
│ │ │ ├── ErrorBuilderTestData.cs
│ │ │ ├── ErrorBuilderTests.cs
│ │ │ ├── ErrorTestsHelpers.cs
│ │ │ ├── RuleCommandScopeBuilderTests.cs
│ │ │ ├── ScopeBuilderContextTests.cs
│ │ │ └── ScopeBuilderTests.cs
│ │ ├── CollectionCommandScopeTests.cs
│ │ ├── CommandScopeTestHelper.cs
│ │ ├── ConvertedCommandScopeTests.cs
│ │ ├── DictionaryCommandScopeTests.cs
│ │ ├── MemberCommandScopeTests.cs
│ │ ├── ModelCommandScopeTests.cs
│ │ ├── NullableCommandScopeTests.cs
│ │ ├── RuleCommandScopeTests.cs
│ │ └── SpecificationScopeTests.cs
│ ├── Stack/
│ │ ├── PathStackTests.cs
│ │ ├── ReferenceLoopExceptionTests.cs
│ │ ├── ReferenceLoopProtectionSettingsTests.cs
│ │ └── ReferencesStackTests.cs
│ ├── TraversingTestCases.cs
│ └── ValidationContextTests.cs
├── ValidationTestData.cs
├── ValidationTestHelpers.cs
├── ValidatorTests.cs
├── Validot.Tests.Unit.csproj
└── ValidotExceptionTests.cs
Showing preview only (348K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3625 symbols across 346 files)
FILE: build/Build.cs
class Build (line 22) | [ShutdownDotNetAfterServerBuild]
method Main (line 33) | public static int Main() => Execute<Build>(x => x.Compile);
method OnBuildInitialized (line 81) | protected override void OnBuildInitialized()
method OnBuildFinished (line 109) | protected override void OnBuildFinished()
method SetFrameworkInTests (line 340) | void SetFrameworkInTests(string framework)
method SetFrameworkInCsProj (line 355) | void SetFrameworkInCsProj(string framework, string csProjPath)
method SetVersionInAssemblyInfo (line 364) | void SetVersionInAssemblyInfo(string version, string commitSha)
method ResetVersionInAssemblyInfo (line 402) | void ResetVersionInAssemblyInfo() => SetVersionInAssemblyInfo("0.0.0",...
method ResetFrameworkInTests (line 404) | void ResetFrameworkInTests() => SetFrameworkInTests(DefaultFrameworkId);
method GetFramework (line 406) | string GetFramework(string dotnet)
method GetVersion (line 472) | string GetVersion(string version)
method ExecuteTool (line 484) | void ExecuteTool(string toolPath, string parameters)
method InstallAndGetToolPath (line 489) | string InstallAndGetToolPath(string name, string version, string execu...
FILE: build/Configuration.cs
class Configuration (line 6) | [TypeConverter(typeof(TypeConverter<Configuration>))]
FILE: src/Validot/CodeHelper.cs
class CodeHelper (line 5) | internal static class CodeHelper
method IsCodeValid (line 7) | public static bool IsCodeValid(string code)
FILE: src/Validot/Errors/Args/ArgHelper.cs
class ArgHelper (line 8) | internal static class ArgHelper
method FormatMessage (line 18) | public static string FormatMessage(string message, IReadOnlyList<ArgPl...
method ExtractPlaceholders (line 64) | public static IReadOnlyList<ArgPlaceholder> ExtractPlaceholders(string...
FILE: src/Validot/Errors/Args/ArgPlaceholder.cs
class ArgPlaceholder (line 5) | public sealed class ArgPlaceholder
FILE: src/Validot/Errors/Args/EnumArg.cs
class EnumArg (line 6) | public sealed class EnumArg<T> : IArg<T>
method EnumArg (line 17) | public EnumArg(string name, T value)
method ToString (line 35) | public string ToString(IReadOnlyDictionary<string, string> parameters)
FILE: src/Validot/Errors/Args/EnumArgFactory.cs
class Arg (line 5) | public static partial class Arg
method Enum (line 7) | public static IArg Enum<T>(string name, T value)
FILE: src/Validot/Errors/Args/GuidArg.cs
class GuidArg (line 7) | public sealed class GuidArg : IArg<Guid>
method GuidArg (line 19) | public GuidArg(string name, Guid value)
method ToString (line 37) | public string ToString(IReadOnlyDictionary<string, string> parameters)
FILE: src/Validot/Errors/Args/GuidArgFactory.cs
class Arg (line 7) | public static partial class Arg
method GuidValue (line 9) | public static IArg GuidValue(string name, Guid value)
FILE: src/Validot/Errors/Args/IArg.cs
type IArg (line 5) | public interface IArg
method ToString (line 11) | string ToString(IReadOnlyDictionary<string, string> parameters);
type IArg (line 14) | public interface IArg<out T> : IArg
method ToString (line 11) | string ToString(IReadOnlyDictionary<string, string> parameters);
FILE: src/Validot/Errors/Args/NameArg.cs
class NameArg (line 8) | public sealed class NameArg : IArg
method ToString (line 40) | public string ToString(IReadOnlyDictionary<string, string> parameters)
method NameArg (line 54) | public NameArg(string name)
method Stringify (line 61) | private static string Stringify(string value, string formatParameter)
method ConvertToTitleCase (line 72) | private static string ConvertToTitleCase(string input)
FILE: src/Validot/Errors/Args/NumberArg.cs
class NumberArg (line 7) | public sealed class NumberArg<T> : NumberArg, IArg<T>
method NumberArg (line 11) | public NumberArg(string name, T value, Func<T, string, CultureInfo, st...
method ToString (line 31) | public override string ToString(IReadOnlyDictionary<string, string> pa...
method ToString (line 65) | public abstract string ToString(IReadOnlyDictionary<string, string> pa...
class NumberArg (line 55) | public abstract class NumberArg
method NumberArg (line 11) | public NumberArg(string name, T value, Func<T, string, CultureInfo, st...
method ToString (line 31) | public override string ToString(IReadOnlyDictionary<string, string> pa...
method ToString (line 65) | public abstract string ToString(IReadOnlyDictionary<string, string> pa...
FILE: src/Validot/Errors/Args/NumberArgFactory.cs
class Arg (line 5) | public static partial class Arg
method Number (line 7) | public static IArg Number(string name, int value)
method Number (line 12) | public static IArg Number(string name, uint value)
method Number (line 17) | public static IArg Number(string name, float value)
method Number (line 22) | public static IArg Number(string name, double value)
method Number (line 27) | public static IArg Number(string name, decimal value)
method Number (line 32) | public static IArg Number(string name, byte value)
method Number (line 37) | public static IArg Number(string name, sbyte value)
method Number (line 42) | public static IArg Number(string name, long value)
method Number (line 47) | public static IArg Number(string name, ulong value)
method Number (line 52) | public static IArg Number(string name, short value)
method Number (line 57) | public static IArg Number(string name, ushort value)
FILE: src/Validot/Errors/Args/TextArg.cs
class TextArg (line 6) | public sealed class TextArg : IArg<string>
method TextArg (line 19) | public TextArg(string name, string value)
method TextArg (line 28) | public TextArg(string name, char value)
method ToString (line 39) | public string ToString(IReadOnlyDictionary<string, string> parameters)
method Stringify (line 55) | private static string Stringify(string value, string caseParameter)
FILE: src/Validot/Errors/Args/TextArgFactory.cs
class Arg (line 5) | public static partial class Arg
method Text (line 7) | public static IArg Text(string name, string value)
method Text (line 12) | public static IArg Text(string name, char value)
FILE: src/Validot/Errors/Args/TimeArg.cs
class TimeArg (line 7) | public sealed class TimeArg<T> : TimeArg, IArg
method TimeArg (line 11) | public TimeArg(string name, T value, Func<T, string, CultureInfo, stri...
method ToString (line 31) | public override string ToString(IReadOnlyDictionary<string, string> pa...
method ToString (line 65) | public abstract string ToString(IReadOnlyDictionary<string, string> pa...
class TimeArg (line 55) | public abstract class TimeArg
method TimeArg (line 11) | public TimeArg(string name, T value, Func<T, string, CultureInfo, stri...
method ToString (line 31) | public override string ToString(IReadOnlyDictionary<string, string> pa...
method ToString (line 65) | public abstract string ToString(IReadOnlyDictionary<string, string> pa...
FILE: src/Validot/Errors/Args/TimeArgFactory.cs
class Arg (line 7) | public static partial class Arg
method Time (line 9) | public static IArg Time(string name, DateTime value)
method Time (line 17) | public static IArg Time(string name, DateTimeOffset value)
method Time (line 25) | public static IArg Time(string name, TimeSpan value)
FILE: src/Validot/Errors/Args/TranslationArg.cs
class TranslationArg (line 5) | public sealed class TranslationArg : IArg
method TranslationArg (line 16) | public TranslationArg(IReadOnlyDictionary<string, string> translation)
method CreatePlaceholder (line 29) | public static string CreatePlaceholder(string key)
method ToString (line 34) | public string ToString(IReadOnlyDictionary<string, string> parameters)
FILE: src/Validot/Errors/Args/TypeArg.cs
class TypeArg (line 6) | public sealed class TypeArg : IArg<Type>
method TypeArg (line 22) | public TypeArg(string name, Type value)
method ToString (line 40) | public string ToString(IReadOnlyDictionary<string, string> parameters)
FILE: src/Validot/Errors/Args/TypeArgFactory.cs
class Arg (line 7) | public static partial class Arg
method Type (line 9) | public static IArg Type(string name, Type value)
FILE: src/Validot/Errors/CacheIntegrityException.cs
class CacheIntegrityException (line 3) | public sealed class CacheIntegrityException : ValidotException
method CacheIntegrityException (line 5) | public CacheIntegrityException(string message)
FILE: src/Validot/Errors/Error.cs
class Error (line 7) | internal class Error : IError
FILE: src/Validot/Errors/IError.cs
type IError (line 7) | public interface IError
FILE: src/Validot/Errors/IMessageService.cs
type IMessageService (line 5) | internal interface IMessageService
method GetTranslation (line 9) | IReadOnlyDictionary<string, string> GetTranslation(string translationN...
method GetMessages (line 11) | IReadOnlyDictionary<string, IReadOnlyList<string>> GetMessages(Diction...
FILE: src/Validot/Errors/MessageCache.cs
class MessageCache (line 9) | internal class MessageCache
method AddMessage (line 19) | public void AddMessage(string translationName, int errorId, IReadOnlyL...
method AddIndexedPathPlaceholders (line 38) | public void AddIndexedPathPlaceholders(string translationName, int err...
method AddMessageWithPathArgs (line 61) | public void AddMessageWithPathArgs(string translationName, string path...
method GetMessageAmount (line 80) | public int GetMessageAmount(List<int> errorsIds)
method GetMessages (line 92) | public IReadOnlyList<string> GetMessages(string translationName, int e...
method GetIndexedPathPlaceholders (line 97) | public IReadOnlyDictionary<int, IReadOnlyList<ArgPlaceholder>> GetInde...
method GetMessagesWithPathArgs (line 102) | public IReadOnlyList<string> GetMessagesWithPathArgs(string translatio...
method IsMessageWithPathArgsCached (line 107) | public bool IsMessageWithPathArgsCached(string translationName, string...
method ContainsPathArgs (line 114) | public bool ContainsPathArgs(string translationName, int errorId)
method VerifyIntegrity (line 119) | public void VerifyIntegrity()
method IsNullInArgPlaceholder (line 209) | private bool IsNullInArgPlaceholder(ArgPlaceholder argPlaceholder)
FILE: src/Validot/Errors/MessageService.cs
class MessageService (line 9) | internal class MessageService : IMessageService
method MessageService (line 15) | public MessageService(
method GetTranslation (line 27) | public IReadOnlyDictionary<string, string> GetTranslation(string trans...
method GetMessages (line 32) | public IReadOnlyDictionary<string, IReadOnlyList<string>> GetMessages(...
method CopyMessages (line 85) | private void CopyMessages(IReadOnlyList<string> source, string[] targe...
method BuildMessageCache (line 95) | private MessageCache BuildMessageCache(MessageTranslator translator, I...
FILE: src/Validot/Errors/ReferenceLoopError.cs
class ReferenceLoopError (line 9) | internal class ReferenceLoopError : IError
method ReferenceLoopError (line 11) | public ReferenceLoopError(Type type)
FILE: src/Validot/Errors/Translator/MessageTranslator.cs
class MessageTranslator (line 8) | internal class MessageTranslator
method MessageTranslator (line 16) | public MessageTranslator(IReadOnlyDictionary<string, IReadOnlyDictiona...
method TranslateMessagesWithPathPlaceholders (line 39) | public static IReadOnlyList<string> TranslateMessagesWithPathPlacehold...
method TranslateMessages (line 60) | public TranslationResult TranslateMessages(string translationName, IEr...
method CreatePathArgsForPath (line 105) | private static IReadOnlyList<IArg> CreatePathArgsForPath(string path)
method TryExtractPathPlaceholders (line 116) | private static bool TryExtractPathPlaceholders(string message, out Arg...
method TryExtractSpecialArgs (line 123) | private bool TryExtractSpecialArgs(string translationName, string mess...
method BuildTranslationArgs (line 139) | private IReadOnlyDictionary<string, IArg[]> BuildTranslationArgs(IRead...
FILE: src/Validot/Errors/Translator/TranslationResult.cs
class TranslationResult (line 7) | internal class TranslationResult
FILE: src/Validot/Factory/HolderInfo.cs
class HolderInfo (line 11) | public class HolderInfo
method HolderInfo (line 13) | internal HolderInfo(Type holderType, Type specifiedType)
method CreateValidator (line 69) | public object CreateValidator()
FILE: src/Validot/Factory/ISettingsHolder.cs
type ISettingsHolder (line 7) | public interface ISettingsHolder
FILE: src/Validot/Factory/ISpecificationHolder.cs
type ISpecificationHolder (line 7) | public interface ISpecificationHolder<T>
FILE: src/Validot/Factory/ValidatorFactory.cs
class ValidatorFactory (line 14) | public sealed class ValidatorFactory
method Create (line 23) | public IValidator<T> Create<T>(Specification<T> specification, Func<Va...
method Create (line 43) | public IValidator<T> Create<T>(ISpecificationHolder<T> specificationHo...
method Create (line 80) | public IValidator<T> Create<T>(Specification<T> specification, IValida...
method FetchHolders (line 104) | public IReadOnlyList<HolderInfo> FetchHolders(params Assembly[] assemb...
method SetReferenceLoopProtection (line 148) | private static void SetReferenceLoopProtection(ValidatorSettings setti...
method GetResolvedSettings (line 158) | private static ValidatorSettings GetResolvedSettings(ValidatorSettings...
FILE: src/Validot/IValidator.cs
type IValidator (line 11) | public interface IValidator<T>
method IsValid (line 32) | bool IsValid(T model);
method Validate (line 42) | IValidationResult Validate(T model, bool failFast = false);
FILE: src/Validot/PathHelper.cs
class PathHelper (line 8) | internal static class PathHelper
method ResolvePath (line 32) | public static string ResolvePath(string basePath, string relativePath)
method GetWithoutIndexes (line 83) | public static string GetWithoutIndexes(string path)
method GetWithIndexes (line 88) | public static string GetWithIndexes(string path, IReadOnlyCollection<s...
method ContainsIndexes (line 134) | public static bool ContainsIndexes(string path)
method GetIndexesAmount (line 139) | public static int GetIndexesAmount(string path)
method GetLastLevel (line 144) | public static string GetLastLevel(string path)
method IsValidAsPath (line 156) | public static bool IsValidAsPath(string path)
method NormalizePath (line 179) | public static string NormalizePath(string path)
method FormatCollectionIndex (line 196) | private static string FormatCollectionIndex(string index)
FILE: src/Validot/Results/IValidationResult.cs
type IValidationResult (line 10) | public interface IValidationResult
method GetTranslatedMessageMap (line 54) | IReadOnlyDictionary<string, IReadOnlyList<string>> GetTranslatedMessag...
method ToString (line 63) | string ToString(string translationName);
FILE: src/Validot/Results/ValidationResult.cs
class ValidationResult (line 10) | internal class ValidationResult : IValidationResult
method ValidationResult (line 30) | public ValidationResult(Dictionary<string, List<int>> resultErrors, IR...
method GetTranslatedMessageMap (line 53) | public IReadOnlyDictionary<string, IReadOnlyList<string>> GetTranslate...
method ToString (line 60) | public override string ToString()
method ToString (line 65) | public string ToString(string translationName)
method GetErrorOutput (line 130) | internal IReadOnlyDictionary<string, IReadOnlyList<IError>> GetErrorOu...
method EstimateCapacityAndLines (line 149) | private static (int capacity, int lines) EstimateCapacityAndLines(IRea...
method GetCodes (line 190) | private IReadOnlyCollection<string> GetCodes()
method GetCodeMap (line 219) | private IReadOnlyDictionary<string, IReadOnlyList<string>> GetCodeMap()
FILE: src/Validot/Rules/BoolRules.cs
class BoolRules (line 6) | public static class BoolRules
method True (line 8) | public static IRuleOut<bool> True(this IRuleIn<bool> @this)
method True (line 13) | public static IRuleOut<bool?> True(this IRuleIn<bool?> @this)
method False (line 18) | public static IRuleOut<bool> False(this IRuleIn<bool> @this)
method False (line 23) | public static IRuleOut<bool?> False(this IRuleIn<bool?> @this)
FILE: src/Validot/Rules/CharRules.cs
class CharRules (line 9) | public static class CharRules
method EqualToIgnoreCase (line 11) | public static IRuleOut<char> EqualToIgnoreCase(this IRuleIn<char> @thi...
method EqualToIgnoreCase (line 16) | public static IRuleOut<char?> EqualToIgnoreCase(this IRuleIn<char?> @t...
method NotEqualToIgnoreCase (line 21) | public static IRuleOut<char> NotEqualToIgnoreCase(this IRuleIn<char> @...
method NotEqualToIgnoreCase (line 26) | public static IRuleOut<char?> NotEqualToIgnoreCase(this IRuleIn<char?>...
FILE: src/Validot/Rules/Collections/ArrayRules.cs
class ArrayRules (line 5) | public static class ArrayRules
method EmptyCollection (line 7) | public static IRuleOut<TItem[]> EmptyCollection<TItem>(this IRuleIn<TI...
method NotEmptyCollection (line 12) | public static IRuleOut<TItem[]> NotEmptyCollection<TItem>(this IRuleIn...
method ExactCollectionSize (line 17) | public static IRuleOut<TItem[]> ExactCollectionSize<TItem>(this IRuleI...
method MinCollectionSize (line 22) | public static IRuleOut<TItem[]> MinCollectionSize<TItem>(this IRuleIn<...
method MaxCollectionSize (line 27) | public static IRuleOut<TItem[]> MaxCollectionSize<TItem>(this IRuleIn<...
method CollectionSizeBetween (line 32) | public static IRuleOut<TItem[]> CollectionSizeBetween<TItem>(this IRul...
FILE: src/Validot/Rules/Collections/BaseCollectionRules.cs
class BaseCollectionRules (line 9) | public static class BaseCollectionRules
method EmptyCollection (line 11) | public static IRuleOut<TCollection> EmptyCollection<TCollection, TItem...
method NotEmptyCollection (line 17) | public static IRuleOut<TCollection> NotEmptyCollection<TCollection, TI...
method ExactCollectionSize (line 23) | public static IRuleOut<TCollection> ExactCollectionSize<TCollection, T...
method MinCollectionSize (line 31) | public static IRuleOut<TCollection> MinCollectionSize<TCollection, TIt...
method MaxCollectionSize (line 39) | public static IRuleOut<TCollection> MaxCollectionSize<TCollection, TIt...
method CollectionSizeBetween (line 47) | public static IRuleOut<TCollection> CollectionSizeBetween<TCollection,...
FILE: src/Validot/Rules/Collections/IEnumerableRules.cs
class IEnumerableRules (line 7) | public static class IEnumerableRules
method EmptyCollection (line 9) | public static IRuleOut<IEnumerable<TItem>> EmptyCollection<TItem>(this...
method NotEmptyCollection (line 14) | public static IRuleOut<IEnumerable<TItem>> NotEmptyCollection<TItem>(t...
method ExactCollectionSize (line 19) | public static IRuleOut<IEnumerable<TItem>> ExactCollectionSize<TItem>(...
method MinCollectionSize (line 24) | public static IRuleOut<IEnumerable<TItem>> MinCollectionSize<TItem>(th...
method MaxCollectionSize (line 29) | public static IRuleOut<IEnumerable<TItem>> MaxCollectionSize<TItem>(th...
method CollectionSizeBetween (line 34) | public static IRuleOut<IEnumerable<TItem>> CollectionSizeBetween<TItem...
FILE: src/Validot/Rules/Collections/IListRules.cs
class IListRules (line 7) | public static class IListRules
method EmptyCollection (line 9) | public static IRuleOut<IList<TItem>> EmptyCollection<TItem>(this IRule...
method NotEmptyCollection (line 14) | public static IRuleOut<IList<TItem>> NotEmptyCollection<TItem>(this IR...
method ExactCollectionSize (line 19) | public static IRuleOut<IList<TItem>> ExactCollectionSize<TItem>(this I...
method MinCollectionSize (line 24) | public static IRuleOut<IList<TItem>> MinCollectionSize<TItem>(this IRu...
method MaxCollectionSize (line 29) | public static IRuleOut<IList<TItem>> MaxCollectionSize<TItem>(this IRu...
method CollectionSizeBetween (line 34) | public static IRuleOut<IList<TItem>> CollectionSizeBetween<TItem>(this...
FILE: src/Validot/Rules/Collections/IReadOnlyCollectionRules.cs
class IReadOnlyCollectionRules (line 7) | public static class IReadOnlyCollectionRules
method EmptyCollection (line 9) | public static IRuleOut<IReadOnlyCollection<TItem>> EmptyCollection<TIt...
method NotEmptyCollection (line 14) | public static IRuleOut<IReadOnlyCollection<TItem>> NotEmptyCollection<...
method ExactCollectionSize (line 19) | public static IRuleOut<IReadOnlyCollection<TItem>> ExactCollectionSize...
method MinCollectionSize (line 24) | public static IRuleOut<IReadOnlyCollection<TItem>> MinCollectionSize<T...
method MaxCollectionSize (line 29) | public static IRuleOut<IReadOnlyCollection<TItem>> MaxCollectionSize<T...
method CollectionSizeBetween (line 34) | public static IRuleOut<IReadOnlyCollection<TItem>> CollectionSizeBetwe...
FILE: src/Validot/Rules/Collections/IReadOnlyListRules.cs
class IReadOnlyListRules (line 7) | public static class IReadOnlyListRules
method EmptyCollection (line 9) | public static IRuleOut<IReadOnlyList<TItem>> EmptyCollection<TItem>(th...
method NotEmptyCollection (line 14) | public static IRuleOut<IReadOnlyList<TItem>> NotEmptyCollection<TItem>...
method ExactCollectionSize (line 19) | public static IRuleOut<IReadOnlyList<TItem>> ExactCollectionSize<TItem...
method MinCollectionSize (line 24) | public static IRuleOut<IReadOnlyList<TItem>> MinCollectionSize<TItem>(...
method MaxCollectionSize (line 29) | public static IRuleOut<IReadOnlyList<TItem>> MaxCollectionSize<TItem>(...
method CollectionSizeBetween (line 34) | public static IRuleOut<IReadOnlyList<TItem>> CollectionSizeBetween<TIt...
FILE: src/Validot/Rules/Collections/ListRules.cs
class ListRules (line 7) | public static class ListRules
method EmptyCollection (line 9) | public static IRuleOut<List<TItem>> EmptyCollection<TItem>(this IRuleI...
method NotEmptyCollection (line 14) | public static IRuleOut<List<TItem>> NotEmptyCollection<TItem>(this IRu...
method ExactCollectionSize (line 19) | public static IRuleOut<List<TItem>> ExactCollectionSize<TItem>(this IR...
method MinCollectionSize (line 24) | public static IRuleOut<List<TItem>> MinCollectionSize<TItem>(this IRul...
method MaxCollectionSize (line 29) | public static IRuleOut<List<TItem>> MaxCollectionSize<TItem>(this IRul...
method CollectionSizeBetween (line 34) | public static IRuleOut<List<TItem>> CollectionSizeBetween<TItem>(this ...
FILE: src/Validot/Rules/GuidRules.cs
class GuidRules (line 8) | public static class GuidRules
method EqualTo (line 10) | public static IRuleOut<Guid> EqualTo(this IRuleIn<Guid> @this, Guid va...
method EqualTo (line 15) | public static IRuleOut<Guid?> EqualTo(this IRuleIn<Guid?> @this, Guid ...
method NotEqualTo (line 20) | public static IRuleOut<Guid> NotEqualTo(this IRuleIn<Guid> @this, Guid...
method NotEqualTo (line 25) | public static IRuleOut<Guid?> NotEqualTo(this IRuleIn<Guid?> @this, Gu...
method NotEmpty (line 30) | public static IRuleOut<Guid> NotEmpty(this IRuleIn<Guid> @this)
method NotEmpty (line 35) | public static IRuleOut<Guid?> NotEmpty(this IRuleIn<Guid?> @this)
FILE: src/Validot/Rules/Numbers/ByteRules.cs
class ByteRules (line 6) | public static class ByteRules
method EqualTo (line 8) | public static IRuleOut<byte> EqualTo(this IRuleIn<byte> @this, byte va...
method EqualTo (line 13) | public static IRuleOut<byte?> EqualTo(this IRuleIn<byte?> @this, byte ...
method NotEqualTo (line 18) | public static IRuleOut<byte> NotEqualTo(this IRuleIn<byte> @this, byte...
method NotEqualTo (line 23) | public static IRuleOut<byte?> NotEqualTo(this IRuleIn<byte?> @this, by...
method GreaterThan (line 28) | public static IRuleOut<byte> GreaterThan(this IRuleIn<byte> @this, byt...
method GreaterThan (line 33) | public static IRuleOut<byte?> GreaterThan(this IRuleIn<byte?> @this, b...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<byte> GreaterThanOrEqualTo(this IRuleIn<byte> @...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<byte?> GreaterThanOrEqualTo(this IRuleIn<byte?>...
method LessThan (line 48) | public static IRuleOut<byte> LessThan(this IRuleIn<byte> @this, byte max)
method LessThan (line 53) | public static IRuleOut<byte?> LessThan(this IRuleIn<byte?> @this, byte...
method LessThanOrEqualTo (line 58) | public static IRuleOut<byte> LessThanOrEqualTo(this IRuleIn<byte> @thi...
method LessThanOrEqualTo (line 63) | public static IRuleOut<byte?> LessThanOrEqualTo(this IRuleIn<byte?> @t...
method Between (line 68) | public static IRuleOut<byte> Between(this IRuleIn<byte> @this, byte mi...
method Between (line 75) | public static IRuleOut<byte?> Between(this IRuleIn<byte?> @this, byte ...
method BetweenOrEqualTo (line 82) | public static IRuleOut<byte> BetweenOrEqualTo(this IRuleIn<byte> @this...
method BetweenOrEqualTo (line 89) | public static IRuleOut<byte?> BetweenOrEqualTo(this IRuleIn<byte?> @th...
method NonZero (line 96) | public static IRuleOut<byte> NonZero(this IRuleIn<byte> @this)
method NonZero (line 101) | public static IRuleOut<byte?> NonZero(this IRuleIn<byte?> @this)
method Positive (line 106) | public static IRuleOut<byte> Positive(this IRuleIn<byte> @this)
method Positive (line 111) | public static IRuleOut<byte?> Positive(this IRuleIn<byte?> @this)
method NonPositive (line 116) | public static IRuleOut<byte> NonPositive(this IRuleIn<byte> @this)
method NonPositive (line 121) | public static IRuleOut<byte?> NonPositive(this IRuleIn<byte?> @this)
FILE: src/Validot/Rules/Numbers/CharNumbersRules.cs
class CharNumbersRules (line 6) | public static class CharNumbersRules
method EqualTo (line 8) | public static IRuleOut<char> EqualTo(this IRuleIn<char> @this, char va...
method EqualTo (line 13) | public static IRuleOut<char?> EqualTo(this IRuleIn<char?> @this, char ...
method NotEqualTo (line 18) | public static IRuleOut<char> NotEqualTo(this IRuleIn<char> @this, char...
method NotEqualTo (line 23) | public static IRuleOut<char?> NotEqualTo(this IRuleIn<char?> @this, ch...
method GreaterThan (line 28) | public static IRuleOut<char> GreaterThan(this IRuleIn<char> @this, cha...
method GreaterThan (line 33) | public static IRuleOut<char?> GreaterThan(this IRuleIn<char?> @this, c...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<char> GreaterThanOrEqualTo(this IRuleIn<char> @...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<char?> GreaterThanOrEqualTo(this IRuleIn<char?>...
method LessThan (line 48) | public static IRuleOut<char> LessThan(this IRuleIn<char> @this, char max)
method LessThan (line 53) | public static IRuleOut<char?> LessThan(this IRuleIn<char?> @this, char...
method LessThanOrEqualTo (line 58) | public static IRuleOut<char> LessThanOrEqualTo(this IRuleIn<char> @thi...
method LessThanOrEqualTo (line 63) | public static IRuleOut<char?> LessThanOrEqualTo(this IRuleIn<char?> @t...
method Between (line 68) | public static IRuleOut<char> Between(this IRuleIn<char> @this, char mi...
method Between (line 75) | public static IRuleOut<char?> Between(this IRuleIn<char?> @this, char ...
method BetweenOrEqualTo (line 82) | public static IRuleOut<char> BetweenOrEqualTo(this IRuleIn<char> @this...
method BetweenOrEqualTo (line 89) | public static IRuleOut<char?> BetweenOrEqualTo(this IRuleIn<char?> @th...
method NonZero (line 96) | public static IRuleOut<char> NonZero(this IRuleIn<char> @this)
method NonZero (line 101) | public static IRuleOut<char?> NonZero(this IRuleIn<char?> @this)
method Positive (line 106) | public static IRuleOut<char> Positive(this IRuleIn<char> @this)
method Positive (line 111) | public static IRuleOut<char?> Positive(this IRuleIn<char?> @this)
method NonPositive (line 116) | public static IRuleOut<char> NonPositive(this IRuleIn<char> @this)
method NonPositive (line 121) | public static IRuleOut<char?> NonPositive(this IRuleIn<char?> @this)
FILE: src/Validot/Rules/Numbers/DecimalRules.cs
class DecimalRules (line 6) | public static class DecimalRules
method EqualTo (line 8) | public static IRuleOut<decimal> EqualTo(this IRuleIn<decimal> @this, d...
method EqualTo (line 13) | public static IRuleOut<decimal?> EqualTo(this IRuleIn<decimal?> @this,...
method NotEqualTo (line 18) | public static IRuleOut<decimal> NotEqualTo(this IRuleIn<decimal> @this...
method NotEqualTo (line 23) | public static IRuleOut<decimal?> NotEqualTo(this IRuleIn<decimal?> @th...
method GreaterThan (line 28) | public static IRuleOut<decimal> GreaterThan(this IRuleIn<decimal> @thi...
method GreaterThan (line 33) | public static IRuleOut<decimal?> GreaterThan(this IRuleIn<decimal?> @t...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<decimal> GreaterThanOrEqualTo(this IRuleIn<deci...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<decimal?> GreaterThanOrEqualTo(this IRuleIn<dec...
method LessThan (line 48) | public static IRuleOut<decimal> LessThan(this IRuleIn<decimal> @this, ...
method LessThan (line 53) | public static IRuleOut<decimal?> LessThan(this IRuleIn<decimal?> @this...
method LessThanOrEqualTo (line 58) | public static IRuleOut<decimal> LessThanOrEqualTo(this IRuleIn<decimal...
method LessThanOrEqualTo (line 63) | public static IRuleOut<decimal?> LessThanOrEqualTo(this IRuleIn<decima...
method Between (line 68) | public static IRuleOut<decimal> Between(this IRuleIn<decimal> @this, d...
method Between (line 75) | public static IRuleOut<decimal?> Between(this IRuleIn<decimal?> @this,...
method BetweenOrEqualTo (line 82) | public static IRuleOut<decimal> BetweenOrEqualTo(this IRuleIn<decimal>...
method BetweenOrEqualTo (line 89) | public static IRuleOut<decimal?> BetweenOrEqualTo(this IRuleIn<decimal...
method NonZero (line 96) | public static IRuleOut<decimal> NonZero(this IRuleIn<decimal> @this)
method NonZero (line 101) | public static IRuleOut<decimal?> NonZero(this IRuleIn<decimal?> @this)
method Positive (line 106) | public static IRuleOut<decimal> Positive(this IRuleIn<decimal> @this)
method Positive (line 111) | public static IRuleOut<decimal?> Positive(this IRuleIn<decimal?> @this)
method NonPositive (line 116) | public static IRuleOut<decimal> NonPositive(this IRuleIn<decimal> @this)
method NonPositive (line 121) | public static IRuleOut<decimal?> NonPositive(this IRuleIn<decimal?> @t...
method Negative (line 126) | public static IRuleOut<decimal> Negative(this IRuleIn<decimal> @this)
method Negative (line 131) | public static IRuleOut<decimal?> Negative(this IRuleIn<decimal?> @this)
method NonNegative (line 136) | public static IRuleOut<decimal> NonNegative(this IRuleIn<decimal> @this)
method NonNegative (line 141) | public static IRuleOut<decimal?> NonNegative(this IRuleIn<decimal?> @t...
FILE: src/Validot/Rules/Numbers/DoubleRules.cs
class DoubleRules (line 8) | public static class DoubleRules
method EqualTo (line 10) | public static IRuleOut<double> EqualTo(this IRuleIn<double> @this, dou...
method EqualTo (line 15) | public static IRuleOut<double?> EqualTo(this IRuleIn<double?> @this, d...
method NotEqualTo (line 20) | public static IRuleOut<double> NotEqualTo(this IRuleIn<double> @this, ...
method NotEqualTo (line 25) | public static IRuleOut<double?> NotEqualTo(this IRuleIn<double?> @this...
method GreaterThan (line 30) | public static IRuleOut<double> GreaterThan(this IRuleIn<double> @this,...
method GreaterThan (line 35) | public static IRuleOut<double?> GreaterThan(this IRuleIn<double?> @thi...
method LessThan (line 40) | public static IRuleOut<double> LessThan(this IRuleIn<double> @this, do...
method LessThan (line 45) | public static IRuleOut<double?> LessThan(this IRuleIn<double?> @this, ...
method Between (line 50) | public static IRuleOut<double> Between(this IRuleIn<double> @this, dou...
method Between (line 57) | public static IRuleOut<double?> Between(this IRuleIn<double?> @this, d...
method NonZero (line 64) | public static IRuleOut<double> NonZero(this IRuleIn<double> @this, dou...
method NonZero (line 69) | public static IRuleOut<double?> NonZero(this IRuleIn<double?> @this, d...
method NonNaN (line 74) | public static IRuleOut<double> NonNaN(this IRuleIn<double> @this)
method NonNaN (line 79) | public static IRuleOut<double?> NonNaN(this IRuleIn<double?> @this)
method Positive (line 84) | public static IRuleOut<double> Positive(this IRuleIn<double> @this)
method Positive (line 89) | public static IRuleOut<double?> Positive(this IRuleIn<double?> @this)
method NonPositive (line 94) | public static IRuleOut<double> NonPositive(this IRuleIn<double> @this)
method NonPositive (line 99) | public static IRuleOut<double?> NonPositive(this IRuleIn<double?> @this)
method Negative (line 104) | public static IRuleOut<double> Negative(this IRuleIn<double> @this)
method Negative (line 109) | public static IRuleOut<double?> Negative(this IRuleIn<double?> @this)
method NonNegative (line 114) | public static IRuleOut<double> NonNegative(this IRuleIn<double> @this)
method NonNegative (line 119) | public static IRuleOut<double?> NonNegative(this IRuleIn<double?> @this)
method AreEqual (line 124) | private static bool AreEqual(double a, double b, double tolerance)
FILE: src/Validot/Rules/Numbers/FloatRules.cs
class FloatRules (line 8) | public static class FloatRules
method EqualTo (line 10) | public static IRuleOut<float> EqualTo(this IRuleIn<float> @this, float...
method EqualTo (line 15) | public static IRuleOut<float?> EqualTo(this IRuleIn<float?> @this, flo...
method NotEqualTo (line 20) | public static IRuleOut<float> NotEqualTo(this IRuleIn<float> @this, fl...
method NotEqualTo (line 25) | public static IRuleOut<float?> NotEqualTo(this IRuleIn<float?> @this, ...
method GreaterThan (line 30) | public static IRuleOut<float> GreaterThan(this IRuleIn<float> @this, f...
method GreaterThan (line 35) | public static IRuleOut<float?> GreaterThan(this IRuleIn<float?> @this,...
method LessThan (line 40) | public static IRuleOut<float> LessThan(this IRuleIn<float> @this, floa...
method LessThan (line 45) | public static IRuleOut<float?> LessThan(this IRuleIn<float?> @this, fl...
method Between (line 50) | public static IRuleOut<float> Between(this IRuleIn<float> @this, float...
method Between (line 57) | public static IRuleOut<float?> Between(this IRuleIn<float?> @this, flo...
method NonZero (line 64) | public static IRuleOut<float> NonZero(this IRuleIn<float> @this, float...
method NonZero (line 69) | public static IRuleOut<float?> NonZero(this IRuleIn<float?> @this, flo...
method NonNaN (line 74) | public static IRuleOut<float> NonNaN(this IRuleIn<float> @this)
method NonNaN (line 79) | public static IRuleOut<float?> NonNaN(this IRuleIn<float?> @this)
method Positive (line 84) | public static IRuleOut<float> Positive(this IRuleIn<float> @this)
method Positive (line 89) | public static IRuleOut<float?> Positive(this IRuleIn<float?> @this)
method NonPositive (line 94) | public static IRuleOut<float> NonPositive(this IRuleIn<float> @this)
method NonPositive (line 99) | public static IRuleOut<float?> NonPositive(this IRuleIn<float?> @this)
method Negative (line 104) | public static IRuleOut<float> Negative(this IRuleIn<float> @this)
method Negative (line 109) | public static IRuleOut<float?> Negative(this IRuleIn<float?> @this)
method NonNegative (line 114) | public static IRuleOut<float> NonNegative(this IRuleIn<float> @this)
method NonNegative (line 119) | public static IRuleOut<float?> NonNegative(this IRuleIn<float?> @this)
method AreEqual (line 124) | private static bool AreEqual(float a, float b, float tolerance)
FILE: src/Validot/Rules/Numbers/IntRules.cs
class IntRules (line 6) | public static class IntRules
method EqualTo (line 8) | public static IRuleOut<int> EqualTo(this IRuleIn<int> @this, int value)
method EqualTo (line 13) | public static IRuleOut<int?> EqualTo(this IRuleIn<int?> @this, int value)
method NotEqualTo (line 18) | public static IRuleOut<int> NotEqualTo(this IRuleIn<int> @this, int va...
method NotEqualTo (line 23) | public static IRuleOut<int?> NotEqualTo(this IRuleIn<int?> @this, int ...
method GreaterThan (line 28) | public static IRuleOut<int> GreaterThan(this IRuleIn<int> @this, int min)
method GreaterThan (line 33) | public static IRuleOut<int?> GreaterThan(this IRuleIn<int?> @this, int...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<int> GreaterThanOrEqualTo(this IRuleIn<int> @th...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<int?> GreaterThanOrEqualTo(this IRuleIn<int?> @...
method LessThan (line 48) | public static IRuleOut<int> LessThan(this IRuleIn<int> @this, int max)
method LessThan (line 53) | public static IRuleOut<int?> LessThan(this IRuleIn<int?> @this, int max)
method LessThanOrEqualTo (line 58) | public static IRuleOut<int> LessThanOrEqualTo(this IRuleIn<int> @this,...
method LessThanOrEqualTo (line 63) | public static IRuleOut<int?> LessThanOrEqualTo(this IRuleIn<int?> @thi...
method Between (line 68) | public static IRuleOut<int> Between(this IRuleIn<int> @this, int min, ...
method Between (line 75) | public static IRuleOut<int?> Between(this IRuleIn<int?> @this, int min...
method BetweenOrEqualTo (line 82) | public static IRuleOut<int> BetweenOrEqualTo(this IRuleIn<int> @this, ...
method BetweenOrEqualTo (line 89) | public static IRuleOut<int?> BetweenOrEqualTo(this IRuleIn<int?> @this...
method NonZero (line 96) | public static IRuleOut<int> NonZero(this IRuleIn<int> @this)
method NonZero (line 101) | public static IRuleOut<int?> NonZero(this IRuleIn<int?> @this)
method Positive (line 106) | public static IRuleOut<int> Positive(this IRuleIn<int> @this)
method Positive (line 111) | public static IRuleOut<int?> Positive(this IRuleIn<int?> @this)
method NonPositive (line 116) | public static IRuleOut<int> NonPositive(this IRuleIn<int> @this)
method NonPositive (line 121) | public static IRuleOut<int?> NonPositive(this IRuleIn<int?> @this)
method Negative (line 126) | public static IRuleOut<int> Negative(this IRuleIn<int> @this)
method Negative (line 131) | public static IRuleOut<int?> Negative(this IRuleIn<int?> @this)
method NonNegative (line 136) | public static IRuleOut<int> NonNegative(this IRuleIn<int> @this)
method NonNegative (line 141) | public static IRuleOut<int?> NonNegative(this IRuleIn<int?> @this)
FILE: src/Validot/Rules/Numbers/LongRules.cs
class LongRules (line 6) | public static class LongRules
method EqualTo (line 8) | public static IRuleOut<long> EqualTo(this IRuleIn<long> @this, long va...
method EqualTo (line 13) | public static IRuleOut<long?> EqualTo(this IRuleIn<long?> @this, long ...
method NotEqualTo (line 18) | public static IRuleOut<long> NotEqualTo(this IRuleIn<long> @this, long...
method NotEqualTo (line 23) | public static IRuleOut<long?> NotEqualTo(this IRuleIn<long?> @this, lo...
method GreaterThan (line 28) | public static IRuleOut<long> GreaterThan(this IRuleIn<long> @this, lon...
method GreaterThan (line 33) | public static IRuleOut<long?> GreaterThan(this IRuleIn<long?> @this, l...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<long> GreaterThanOrEqualTo(this IRuleIn<long> @...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<long?> GreaterThanOrEqualTo(this IRuleIn<long?>...
method LessThan (line 48) | public static IRuleOut<long> LessThan(this IRuleIn<long> @this, long max)
method LessThan (line 53) | public static IRuleOut<long?> LessThan(this IRuleIn<long?> @this, long...
method LessThanOrEqualTo (line 58) | public static IRuleOut<long> LessThanOrEqualTo(this IRuleIn<long> @thi...
method LessThanOrEqualTo (line 63) | public static IRuleOut<long?> LessThanOrEqualTo(this IRuleIn<long?> @t...
method Between (line 68) | public static IRuleOut<long> Between(this IRuleIn<long> @this, long mi...
method Between (line 75) | public static IRuleOut<long?> Between(this IRuleIn<long?> @this, long ...
method BetweenOrEqualTo (line 82) | public static IRuleOut<long> BetweenOrEqualTo(this IRuleIn<long> @this...
method BetweenOrEqualTo (line 89) | public static IRuleOut<long?> BetweenOrEqualTo(this IRuleIn<long?> @th...
method NonZero (line 96) | public static IRuleOut<long> NonZero(this IRuleIn<long> @this)
method NonZero (line 101) | public static IRuleOut<long?> NonZero(this IRuleIn<long?> @this)
method Positive (line 106) | public static IRuleOut<long> Positive(this IRuleIn<long> @this)
method Positive (line 111) | public static IRuleOut<long?> Positive(this IRuleIn<long?> @this)
method NonPositive (line 116) | public static IRuleOut<long> NonPositive(this IRuleIn<long> @this)
method NonPositive (line 121) | public static IRuleOut<long?> NonPositive(this IRuleIn<long?> @this)
method Negative (line 126) | public static IRuleOut<long> Negative(this IRuleIn<long> @this)
method Negative (line 131) | public static IRuleOut<long?> Negative(this IRuleIn<long?> @this)
method NonNegative (line 136) | public static IRuleOut<long> NonNegative(this IRuleIn<long> @this)
method NonNegative (line 141) | public static IRuleOut<long?> NonNegative(this IRuleIn<long?> @this)
FILE: src/Validot/Rules/Numbers/SByteRules.cs
class SByteRules (line 6) | public static class SByteRules
method EqualTo (line 8) | public static IRuleOut<sbyte> EqualTo(this IRuleIn<sbyte> @this, sbyte...
method EqualTo (line 13) | public static IRuleOut<sbyte?> EqualTo(this IRuleIn<sbyte?> @this, sby...
method NotEqualTo (line 18) | public static IRuleOut<sbyte> NotEqualTo(this IRuleIn<sbyte> @this, sb...
method NotEqualTo (line 23) | public static IRuleOut<sbyte?> NotEqualTo(this IRuleIn<sbyte?> @this, ...
method GreaterThan (line 28) | public static IRuleOut<sbyte> GreaterThan(this IRuleIn<sbyte> @this, s...
method GreaterThan (line 33) | public static IRuleOut<sbyte?> GreaterThan(this IRuleIn<sbyte?> @this,...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<sbyte> GreaterThanOrEqualTo(this IRuleIn<sbyte>...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<sbyte?> GreaterThanOrEqualTo(this IRuleIn<sbyte...
method LessThan (line 48) | public static IRuleOut<sbyte> LessThan(this IRuleIn<sbyte> @this, sbyt...
method LessThan (line 53) | public static IRuleOut<sbyte?> LessThan(this IRuleIn<sbyte?> @this, sb...
method LessThanOrEqualTo (line 58) | public static IRuleOut<sbyte> LessThanOrEqualTo(this IRuleIn<sbyte> @t...
method LessThanOrEqualTo (line 63) | public static IRuleOut<sbyte?> LessThanOrEqualTo(this IRuleIn<sbyte?> ...
method Between (line 68) | public static IRuleOut<sbyte> Between(this IRuleIn<sbyte> @this, sbyte...
method Between (line 75) | public static IRuleOut<sbyte?> Between(this IRuleIn<sbyte?> @this, sby...
method BetweenOrEqualTo (line 82) | public static IRuleOut<sbyte> BetweenOrEqualTo(this IRuleIn<sbyte> @th...
method BetweenOrEqualTo (line 89) | public static IRuleOut<sbyte?> BetweenOrEqualTo(this IRuleIn<sbyte?> @...
method NonZero (line 96) | public static IRuleOut<sbyte> NonZero(this IRuleIn<sbyte> @this)
method NonZero (line 101) | public static IRuleOut<sbyte?> NonZero(this IRuleIn<sbyte?> @this)
method Positive (line 106) | public static IRuleOut<sbyte> Positive(this IRuleIn<sbyte> @this)
method Positive (line 111) | public static IRuleOut<sbyte?> Positive(this IRuleIn<sbyte?> @this)
method NonPositive (line 116) | public static IRuleOut<sbyte> NonPositive(this IRuleIn<sbyte> @this)
method NonPositive (line 121) | public static IRuleOut<sbyte?> NonPositive(this IRuleIn<sbyte?> @this)
method Negative (line 126) | public static IRuleOut<sbyte> Negative(this IRuleIn<sbyte> @this)
method Negative (line 131) | public static IRuleOut<sbyte?> Negative(this IRuleIn<sbyte?> @this)
method NonNegative (line 136) | public static IRuleOut<sbyte> NonNegative(this IRuleIn<sbyte> @this)
method NonNegative (line 141) | public static IRuleOut<sbyte?> NonNegative(this IRuleIn<sbyte?> @this)
FILE: src/Validot/Rules/Numbers/ShortRules.cs
class ShortRules (line 6) | public static class ShortRules
method EqualTo (line 8) | public static IRuleOut<short> EqualTo(this IRuleIn<short> @this, short...
method EqualTo (line 13) | public static IRuleOut<short?> EqualTo(this IRuleIn<short?> @this, sho...
method NotEqualTo (line 18) | public static IRuleOut<short> NotEqualTo(this IRuleIn<short> @this, sh...
method NotEqualTo (line 23) | public static IRuleOut<short?> NotEqualTo(this IRuleIn<short?> @this, ...
method GreaterThan (line 28) | public static IRuleOut<short> GreaterThan(this IRuleIn<short> @this, s...
method GreaterThan (line 33) | public static IRuleOut<short?> GreaterThan(this IRuleIn<short?> @this,...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<short> GreaterThanOrEqualTo(this IRuleIn<short>...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<short?> GreaterThanOrEqualTo(this IRuleIn<short...
method LessThan (line 48) | public static IRuleOut<short> LessThan(this IRuleIn<short> @this, shor...
method LessThan (line 53) | public static IRuleOut<short?> LessThan(this IRuleIn<short?> @this, sh...
method LessThanOrEqualTo (line 58) | public static IRuleOut<short> LessThanOrEqualTo(this IRuleIn<short> @t...
method LessThanOrEqualTo (line 63) | public static IRuleOut<short?> LessThanOrEqualTo(this IRuleIn<short?> ...
method Between (line 68) | public static IRuleOut<short> Between(this IRuleIn<short> @this, short...
method Between (line 75) | public static IRuleOut<short?> Between(this IRuleIn<short?> @this, sho...
method BetweenOrEqualTo (line 82) | public static IRuleOut<short> BetweenOrEqualTo(this IRuleIn<short> @th...
method BetweenOrEqualTo (line 89) | public static IRuleOut<short?> BetweenOrEqualTo(this IRuleIn<short?> @...
method NonZero (line 96) | public static IRuleOut<short> NonZero(this IRuleIn<short> @this)
method NonZero (line 101) | public static IRuleOut<short?> NonZero(this IRuleIn<short?> @this)
method Positive (line 106) | public static IRuleOut<short> Positive(this IRuleIn<short> @this)
method Positive (line 111) | public static IRuleOut<short?> Positive(this IRuleIn<short?> @this)
method NonPositive (line 116) | public static IRuleOut<short> NonPositive(this IRuleIn<short> @this)
method NonPositive (line 121) | public static IRuleOut<short?> NonPositive(this IRuleIn<short?> @this)
method Negative (line 126) | public static IRuleOut<short> Negative(this IRuleIn<short> @this)
method Negative (line 131) | public static IRuleOut<short?> Negative(this IRuleIn<short?> @this)
method NonNegative (line 136) | public static IRuleOut<short> NonNegative(this IRuleIn<short> @this)
method NonNegative (line 141) | public static IRuleOut<short?> NonNegative(this IRuleIn<short?> @this)
FILE: src/Validot/Rules/Numbers/UIntRules.cs
class UIntRules (line 6) | public static class UIntRules
method EqualTo (line 8) | public static IRuleOut<uint> EqualTo(this IRuleIn<uint> @this, uint va...
method EqualTo (line 13) | public static IRuleOut<uint?> EqualTo(this IRuleIn<uint?> @this, uint ...
method NotEqualTo (line 18) | public static IRuleOut<uint> NotEqualTo(this IRuleIn<uint> @this, uint...
method NotEqualTo (line 23) | public static IRuleOut<uint?> NotEqualTo(this IRuleIn<uint?> @this, ui...
method GreaterThan (line 28) | public static IRuleOut<uint> GreaterThan(this IRuleIn<uint> @this, uin...
method GreaterThan (line 33) | public static IRuleOut<uint?> GreaterThan(this IRuleIn<uint?> @this, u...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<uint> GreaterThanOrEqualTo(this IRuleIn<uint> @...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<uint?> GreaterThanOrEqualTo(this IRuleIn<uint?>...
method LessThan (line 48) | public static IRuleOut<uint> LessThan(this IRuleIn<uint> @this, uint max)
method LessThan (line 53) | public static IRuleOut<uint?> LessThan(this IRuleIn<uint?> @this, uint...
method LessThanOrEqualTo (line 58) | public static IRuleOut<uint> LessThanOrEqualTo(this IRuleIn<uint> @thi...
method LessThanOrEqualTo (line 63) | public static IRuleOut<uint?> LessThanOrEqualTo(this IRuleIn<uint?> @t...
method Between (line 68) | public static IRuleOut<uint> Between(this IRuleIn<uint> @this, uint mi...
method Between (line 75) | public static IRuleOut<uint?> Between(this IRuleIn<uint?> @this, uint ...
method BetweenOrEqualTo (line 82) | public static IRuleOut<uint> BetweenOrEqualTo(this IRuleIn<uint> @this...
method BetweenOrEqualTo (line 89) | public static IRuleOut<uint?> BetweenOrEqualTo(this IRuleIn<uint?> @th...
method NonZero (line 96) | public static IRuleOut<uint> NonZero(this IRuleIn<uint> @this)
method NonZero (line 101) | public static IRuleOut<uint?> NonZero(this IRuleIn<uint?> @this)
method Positive (line 106) | public static IRuleOut<uint> Positive(this IRuleIn<uint> @this)
method Positive (line 111) | public static IRuleOut<uint?> Positive(this IRuleIn<uint?> @this)
method NonPositive (line 116) | public static IRuleOut<uint> NonPositive(this IRuleIn<uint> @this)
method NonPositive (line 121) | public static IRuleOut<uint?> NonPositive(this IRuleIn<uint?> @this)
FILE: src/Validot/Rules/Numbers/ULongRules.cs
class ULongRules (line 6) | public static class ULongRules
method EqualTo (line 8) | public static IRuleOut<ulong> EqualTo(this IRuleIn<ulong> @this, ulong...
method EqualTo (line 13) | public static IRuleOut<ulong?> EqualTo(this IRuleIn<ulong?> @this, ulo...
method NotEqualTo (line 18) | public static IRuleOut<ulong> NotEqualTo(this IRuleIn<ulong> @this, ul...
method NotEqualTo (line 23) | public static IRuleOut<ulong?> NotEqualTo(this IRuleIn<ulong?> @this, ...
method GreaterThan (line 28) | public static IRuleOut<ulong> GreaterThan(this IRuleIn<ulong> @this, u...
method GreaterThan (line 33) | public static IRuleOut<ulong?> GreaterThan(this IRuleIn<ulong?> @this,...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<ulong> GreaterThanOrEqualTo(this IRuleIn<ulong>...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<ulong?> GreaterThanOrEqualTo(this IRuleIn<ulong...
method LessThan (line 48) | public static IRuleOut<ulong> LessThan(this IRuleIn<ulong> @this, ulon...
method LessThan (line 53) | public static IRuleOut<ulong?> LessThan(this IRuleIn<ulong?> @this, ul...
method LessThanOrEqualTo (line 58) | public static IRuleOut<ulong> LessThanOrEqualTo(this IRuleIn<ulong> @t...
method LessThanOrEqualTo (line 63) | public static IRuleOut<ulong?> LessThanOrEqualTo(this IRuleIn<ulong?> ...
method Between (line 68) | public static IRuleOut<ulong> Between(this IRuleIn<ulong> @this, ulong...
method Between (line 75) | public static IRuleOut<ulong?> Between(this IRuleIn<ulong?> @this, ulo...
method BetweenOrEqualTo (line 82) | public static IRuleOut<ulong> BetweenOrEqualTo(this IRuleIn<ulong> @th...
method BetweenOrEqualTo (line 89) | public static IRuleOut<ulong?> BetweenOrEqualTo(this IRuleIn<ulong?> @...
method NonZero (line 96) | public static IRuleOut<ulong> NonZero(this IRuleIn<ulong> @this)
method NonZero (line 101) | public static IRuleOut<ulong?> NonZero(this IRuleIn<ulong?> @this)
method Positive (line 106) | public static IRuleOut<ulong> Positive(this IRuleIn<ulong> @this)
method Positive (line 111) | public static IRuleOut<ulong?> Positive(this IRuleIn<ulong?> @this)
method NonPositive (line 116) | public static IRuleOut<ulong> NonPositive(this IRuleIn<ulong> @this)
method NonPositive (line 121) | public static IRuleOut<ulong?> NonPositive(this IRuleIn<ulong?> @this)
FILE: src/Validot/Rules/Numbers/UShortRules.cs
class UShortRules (line 6) | public static class UShortRules
method EqualTo (line 8) | public static IRuleOut<ushort> EqualTo(this IRuleIn<ushort> @this, ush...
method EqualTo (line 13) | public static IRuleOut<ushort?> EqualTo(this IRuleIn<ushort?> @this, u...
method NotEqualTo (line 18) | public static IRuleOut<ushort> NotEqualTo(this IRuleIn<ushort> @this, ...
method NotEqualTo (line 23) | public static IRuleOut<ushort?> NotEqualTo(this IRuleIn<ushort?> @this...
method GreaterThan (line 28) | public static IRuleOut<ushort> GreaterThan(this IRuleIn<ushort> @this,...
method GreaterThan (line 33) | public static IRuleOut<ushort?> GreaterThan(this IRuleIn<ushort?> @thi...
method GreaterThanOrEqualTo (line 38) | public static IRuleOut<ushort> GreaterThanOrEqualTo(this IRuleIn<ushor...
method GreaterThanOrEqualTo (line 43) | public static IRuleOut<ushort?> GreaterThanOrEqualTo(this IRuleIn<usho...
method LessThan (line 48) | public static IRuleOut<ushort> LessThan(this IRuleIn<ushort> @this, us...
method LessThan (line 53) | public static IRuleOut<ushort?> LessThan(this IRuleIn<ushort?> @this, ...
method LessThanOrEqualTo (line 58) | public static IRuleOut<ushort> LessThanOrEqualTo(this IRuleIn<ushort> ...
method LessThanOrEqualTo (line 63) | public static IRuleOut<ushort?> LessThanOrEqualTo(this IRuleIn<ushort?...
method Between (line 68) | public static IRuleOut<ushort> Between(this IRuleIn<ushort> @this, ush...
method Between (line 75) | public static IRuleOut<ushort?> Between(this IRuleIn<ushort?> @this, u...
method BetweenOrEqualTo (line 82) | public static IRuleOut<ushort> BetweenOrEqualTo(this IRuleIn<ushort> @...
method BetweenOrEqualTo (line 89) | public static IRuleOut<ushort?> BetweenOrEqualTo(this IRuleIn<ushort?>...
method NonZero (line 96) | public static IRuleOut<ushort> NonZero(this IRuleIn<ushort> @this)
method NonZero (line 101) | public static IRuleOut<ushort?> NonZero(this IRuleIn<ushort?> @this)
method Positive (line 106) | public static IRuleOut<ushort> Positive(this IRuleIn<ushort> @this)
method Positive (line 111) | public static IRuleOut<ushort?> Positive(this IRuleIn<ushort?> @this)
method NonPositive (line 116) | public static IRuleOut<ushort> NonPositive(this IRuleIn<ushort> @this)
method NonPositive (line 121) | public static IRuleOut<ushort?> NonPositive(this IRuleIn<ushort?> @this)
FILE: src/Validot/Rules/Text/EmailRules.cs
class EmailRules (line 10) | public static class EmailRules
method Email (line 16) | public static IRuleOut<string> Email(this IRuleIn<string> @this, Email...
method IsEmailValidAccordingToRegex (line 31) | private static bool IsEmailValidAccordingToRegex(string email)
method IsEmailValidAccordingToDataAnnotations (line 71) | private static bool IsEmailValidAccordingToDataAnnotations(string email)
FILE: src/Validot/Rules/Text/EmailValidationMode.cs
type EmailValidationMode (line 3) | public enum EmailValidationMode
FILE: src/Validot/Rules/Text/StringRules.cs
class StringRules (line 9) | public static class StringRules
method EqualTo (line 11) | public static IRuleOut<string> EqualTo(this IRuleIn<string> @this, str...
method NotEqualTo (line 18) | public static IRuleOut<string> NotEqualTo(this IRuleIn<string> @this, ...
method Contains (line 25) | public static IRuleOut<string> Contains(this IRuleIn<string> @this, st...
method NotContains (line 32) | public static IRuleOut<string> NotContains(this IRuleIn<string> @this,...
method NotEmpty (line 39) | public static IRuleOut<string> NotEmpty(this IRuleIn<string> @this)
method NotWhiteSpace (line 44) | public static IRuleOut<string> NotWhiteSpace(this IRuleIn<string> @this)
method SingleLine (line 49) | public static IRuleOut<string> SingleLine(this IRuleIn<string> @this)
method ExactLength (line 54) | public static IRuleOut<string> ExactLength(this IRuleIn<string> @this,...
method MaxLength (line 61) | public static IRuleOut<string> MaxLength(this IRuleIn<string> @this, i...
method MinLength (line 68) | public static IRuleOut<string> MinLength(this IRuleIn<string> @this, i...
method LengthBetween (line 75) | public static IRuleOut<string> LengthBetween(this IRuleIn<string> @thi...
method Matches (line 93) | public static IRuleOut<string> Matches(this IRuleIn<string> @this, str...
method Matches (line 100) | public static IRuleOut<string> Matches(this IRuleIn<string> @this, Reg...
method StartsWith (line 107) | public static IRuleOut<string> StartsWith(this IRuleIn<string> @this, ...
method EndsWith (line 114) | public static IRuleOut<string> EndsWith(this IRuleIn<string> @this, st...
FILE: src/Validot/Rules/TimeSpanRules.cs
class TimeSpanRules (line 8) | public static class TimeSpanRules
method EqualTo (line 10) | public static IRuleOut<TimeSpan> EqualTo(this IRuleIn<TimeSpan> @this,...
method EqualTo (line 15) | public static IRuleOut<TimeSpan?> EqualTo(this IRuleIn<TimeSpan?> @thi...
method NotEqualTo (line 20) | public static IRuleOut<TimeSpan> NotEqualTo(this IRuleIn<TimeSpan> @th...
method NotEqualTo (line 25) | public static IRuleOut<TimeSpan?> NotEqualTo(this IRuleIn<TimeSpan?> @...
method GreaterThan (line 30) | public static IRuleOut<TimeSpan> GreaterThan(this IRuleIn<TimeSpan> @t...
method GreaterThan (line 35) | public static IRuleOut<TimeSpan?> GreaterThan(this IRuleIn<TimeSpan?> ...
method GreaterThanOrEqualTo (line 40) | public static IRuleOut<TimeSpan> GreaterThanOrEqualTo(this IRuleIn<Tim...
method GreaterThanOrEqualTo (line 45) | public static IRuleOut<TimeSpan?> GreaterThanOrEqualTo(this IRuleIn<Ti...
method LessThan (line 50) | public static IRuleOut<TimeSpan> LessThan(this IRuleIn<TimeSpan> @this...
method LessThan (line 55) | public static IRuleOut<TimeSpan?> LessThan(this IRuleIn<TimeSpan?> @th...
method LessThanOrEqualTo (line 60) | public static IRuleOut<TimeSpan> LessThanOrEqualTo(this IRuleIn<TimeSp...
method LessThanOrEqualTo (line 65) | public static IRuleOut<TimeSpan?> LessThanOrEqualTo(this IRuleIn<TimeS...
method Between (line 70) | public static IRuleOut<TimeSpan> Between(this IRuleIn<TimeSpan> @this,...
method Between (line 77) | public static IRuleOut<TimeSpan?> Between(this IRuleIn<TimeSpan?> @thi...
method BetweenOrEqualTo (line 84) | public static IRuleOut<TimeSpan> BetweenOrEqualTo(this IRuleIn<TimeSpa...
method BetweenOrEqualTo (line 91) | public static IRuleOut<TimeSpan?> BetweenOrEqualTo(this IRuleIn<TimeSp...
method NonZero (line 98) | public static IRuleOut<TimeSpan> NonZero(this IRuleIn<TimeSpan> @this)
method NonZero (line 103) | public static IRuleOut<TimeSpan?> NonZero(this IRuleIn<TimeSpan?> @this)
method Positive (line 108) | public static IRuleOut<TimeSpan> Positive(this IRuleIn<TimeSpan> @this)
method Positive (line 113) | public static IRuleOut<TimeSpan?> Positive(this IRuleIn<TimeSpan?> @this)
method NonPositive (line 118) | public static IRuleOut<TimeSpan> NonPositive(this IRuleIn<TimeSpan> @t...
method NonPositive (line 123) | public static IRuleOut<TimeSpan?> NonPositive(this IRuleIn<TimeSpan?> ...
method Negative (line 128) | public static IRuleOut<TimeSpan> Negative(this IRuleIn<TimeSpan> @this)
method Negative (line 133) | public static IRuleOut<TimeSpan?> Negative(this IRuleIn<TimeSpan?> @this)
method NonNegative (line 138) | public static IRuleOut<TimeSpan> NonNegative(this IRuleIn<TimeSpan> @t...
method NonNegative (line 143) | public static IRuleOut<TimeSpan?> NonNegative(this IRuleIn<TimeSpan?> ...
FILE: src/Validot/Rules/Times/DateTimeFormats.cs
class DateTimeFormats (line 3) | public static class DateTimeFormats
FILE: src/Validot/Rules/Times/DateTimeOffsetRules.cs
class DateTimeOffsetRules (line 8) | public static class DateTimeOffsetRules
method EqualTo (line 10) | public static IRuleOut<DateTimeOffset> EqualTo(this IRuleIn<DateTimeOf...
method EqualTo (line 15) | public static IRuleOut<DateTimeOffset?> EqualTo(this IRuleIn<DateTimeO...
method NotEqualTo (line 20) | public static IRuleOut<DateTimeOffset> NotEqualTo(this IRuleIn<DateTim...
method NotEqualTo (line 25) | public static IRuleOut<DateTimeOffset?> NotEqualTo(this IRuleIn<DateTi...
method After (line 30) | public static IRuleOut<DateTimeOffset> After(this IRuleIn<DateTimeOffs...
method After (line 35) | public static IRuleOut<DateTimeOffset?> After(this IRuleIn<DateTimeOff...
method AfterOrEqualTo (line 40) | public static IRuleOut<DateTimeOffset> AfterOrEqualTo(this IRuleIn<Dat...
method AfterOrEqualTo (line 45) | public static IRuleOut<DateTimeOffset?> AfterOrEqualTo(this IRuleIn<Da...
method Before (line 50) | public static IRuleOut<DateTimeOffset> Before(this IRuleIn<DateTimeOff...
method Before (line 55) | public static IRuleOut<DateTimeOffset?> Before(this IRuleIn<DateTimeOf...
method BeforeOrEqualTo (line 60) | public static IRuleOut<DateTimeOffset> BeforeOrEqualTo(this IRuleIn<Da...
method BeforeOrEqualTo (line 65) | public static IRuleOut<DateTimeOffset?> BeforeOrEqualTo(this IRuleIn<D...
method Between (line 70) | public static IRuleOut<DateTimeOffset> Between(this IRuleIn<DateTimeOf...
method Between (line 75) | public static IRuleOut<DateTimeOffset?> Between(this IRuleIn<DateTimeO...
method BetweenOrEqualTo (line 80) | public static IRuleOut<DateTimeOffset> BetweenOrEqualTo(this IRuleIn<D...
method BetweenOrEqualTo (line 85) | public static IRuleOut<DateTimeOffset?> BetweenOrEqualTo(this IRuleIn<...
FILE: src/Validot/Rules/Times/DateTimeRules.cs
class DateTimeRules (line 8) | public static class DateTimeRules
method EqualTo (line 10) | public static IRuleOut<DateTime> EqualTo(this IRuleIn<DateTime> @this,...
method EqualTo (line 15) | public static IRuleOut<DateTime?> EqualTo(this IRuleIn<DateTime?> @thi...
method NotEqualTo (line 20) | public static IRuleOut<DateTime> NotEqualTo(this IRuleIn<DateTime> @th...
method NotEqualTo (line 25) | public static IRuleOut<DateTime?> NotEqualTo(this IRuleIn<DateTime?> @...
method After (line 30) | public static IRuleOut<DateTime> After(this IRuleIn<DateTime> @this, D...
method After (line 35) | public static IRuleOut<DateTime?> After(this IRuleIn<DateTime?> @this,...
method AfterOrEqualTo (line 40) | public static IRuleOut<DateTime> AfterOrEqualTo(this IRuleIn<DateTime>...
method AfterOrEqualTo (line 45) | public static IRuleOut<DateTime?> AfterOrEqualTo(this IRuleIn<DateTime...
method Before (line 50) | public static IRuleOut<DateTime> Before(this IRuleIn<DateTime> @this, ...
method Before (line 55) | public static IRuleOut<DateTime?> Before(this IRuleIn<DateTime?> @this...
method BeforeOrEqualTo (line 60) | public static IRuleOut<DateTime> BeforeOrEqualTo(this IRuleIn<DateTime...
method BeforeOrEqualTo (line 65) | public static IRuleOut<DateTime?> BeforeOrEqualTo(this IRuleIn<DateTim...
method Between (line 70) | public static IRuleOut<DateTime> Between(this IRuleIn<DateTime> @this,...
method Between (line 75) | public static IRuleOut<DateTime?> Between(this IRuleIn<DateTime?> @thi...
method BetweenOrEqualTo (line 80) | public static IRuleOut<DateTime> BetweenOrEqualTo(this IRuleIn<DateTim...
method BetweenOrEqualTo (line 85) | public static IRuleOut<DateTime?> BetweenOrEqualTo(this IRuleIn<DateTi...
FILE: src/Validot/Rules/Times/TimeComparer.cs
class TimeComparer (line 5) | internal static class TimeComparer
method Compare (line 7) | public static int Compare(DateTime a, DateTime b, TimeComparison mode)
method Compare (line 23) | public static int Compare(DateTimeOffset a, DateTimeOffset b, TimeComp...
FILE: src/Validot/Rules/Times/TimeComparison.cs
type TimeComparison (line 3) | public enum TimeComparison
FILE: src/Validot/Settings/IValidatorSettings.cs
type IValidatorSettings (line 5) | public interface IValidatorSettings
FILE: src/Validot/Settings/ValidatorSettings.cs
class ValidatorSettings (line 11) | public sealed class ValidatorSettings : IValidatorSettings
method ValidatorSettings (line 15) | internal ValidatorSettings()
method GetDefault (line 33) | public static ValidatorSettings GetDefault()
method WithReferenceLoopProtection (line 45) | public ValidatorSettings WithReferenceLoopProtection()
method WithReferenceLoopProtectionDisabled (line 60) | public ValidatorSettings WithReferenceLoopProtectionDisabled()
method WithTranslation (line 76) | public ValidatorSettings WithTranslation(string name, string messageKe...
method ThrowIfLocked (line 85) | private void ThrowIfLocked()
FILE: src/Validot/Settings/ValidatorSettingsExtensions.cs
class ValidatorSettingsExtensions (line 7) | public static class ValidatorSettingsExtensions
method WithTranslation (line 16) | public static ValidatorSettings WithTranslation(this ValidatorSettings...
method WithTranslation (line 36) | public static ValidatorSettings WithTranslation(this ValidatorSettings...
FILE: src/Validot/Specification/AndExtension.cs
class AndExtension (line 5) | public static class AndExtension
method And (line 13) | public static IAndOut<T> And<T>(this IAndIn<T> @this)
type IAndOut (line 23) | public interface IAndOut<T> :
type IAndIn (line 28) | public interface IAndIn<T>
class SpecificationApi (line 32) | internal partial class SpecificationApi<T> : IAndIn<T>, IAndOut<T>
FILE: src/Validot/Specification/AsCollectionExtension.cs
class AsCollectionExtension (line 8) | public static class AsCollectionExtension
method AsCollection (line 20) | public static IRuleOut<T> AsCollection<T, TItem>(this IRuleIn<T> @this...
method AsCollection (line 29) | public static IRuleOut<TItem[]> AsCollection<TItem>(this IRuleIn<TItem...
method AsCollection (line 35) | public static IRuleOut<IEnumerable<TItem>> AsCollection<TItem>(this IR...
method AsCollection (line 41) | public static IRuleOut<ICollection<TItem>> AsCollection<TItem>(this IR...
method AsCollection (line 47) | public static IRuleOut<IReadOnlyCollection<TItem>> AsCollection<TItem>...
method AsCollection (line 53) | public static IRuleOut<IList<TItem>> AsCollection<TItem>(this IRuleIn<...
method AsCollection (line 59) | public static IRuleOut<IReadOnlyList<TItem>> AsCollection<TItem>(this ...
method AsCollection (line 65) | public static IRuleOut<List<TItem>> AsCollection<TItem>(this IRuleIn<L...
FILE: src/Validot/Specification/AsConvertedExtension.cs
class AsConvertedExtension (line 8) | public static class AsConvertedExtension
method AsConverted (line 20) | public static IRuleOut<T> AsConverted<T, TTarget>(this IRuleIn<T> @thi...
FILE: src/Validot/Specification/AsDictionaryExtension.cs
class AsDictionaryExtension (line 9) | public static class AsDictionaryExtension
method AsDictionary (line 23) | public static IRuleOut<T> AsDictionary<T, TKey, TValue>(this IRuleIn<T...
method AsDictionary (line 33) | public static IRuleOut<IReadOnlyCollection<KeyValuePair<TKey, TValue>>...
method AsDictionary (line 39) | public static IRuleOut<Dictionary<TKey, TValue>> AsDictionary<TKey, TV...
method AsDictionary (line 45) | public static IRuleOut<IDictionary<TKey, TValue>> AsDictionary<TKey, T...
method AsDictionary (line 51) | public static IRuleOut<IReadOnlyDictionary<TKey, TValue>> AsDictionary...
FILE: src/Validot/Specification/AsDictionaryWithStringKeyExtension.cs
class AsDictionaryWithStringKeyExtension (line 8) | public static class AsDictionaryWithStringKeyExtension
method AsDictionary (line 20) | public static IRuleOut<T> AsDictionary<T, TValue>(this IRuleIn<T> @thi...
method AsDictionary (line 29) | public static IRuleOut<IReadOnlyCollection<KeyValuePair<string, TValue...
method AsDictionary (line 35) | public static IRuleOut<Dictionary<string, TValue>> AsDictionary<TValue...
method AsDictionary (line 41) | public static IRuleOut<IDictionary<string, TValue>> AsDictionary<TValu...
method AsDictionary (line 47) | public static IRuleOut<IReadOnlyDictionary<string, TValue>> AsDictiona...
FILE: src/Validot/Specification/AsModelExtension.cs
class AsModelExtension (line 6) | public static class AsModelExtension
method AsModel (line 16) | public static IRuleOut<T> AsModel<T>(this IRuleIn<T> @this, Specificat...
FILE: src/Validot/Specification/AsNullableExtension.cs
class AsNullableExtension (line 6) | public static class AsNullableExtension
method AsNullable (line 16) | public static IRuleOut<T?> AsNullable<T>(this IRuleIn<T?> @this, Speci...
FILE: src/Validot/Specification/AsTypeExtension.cs
class AsTypeExtension (line 6) | public static class AsTypeExtension
method AsType (line 17) | public static IRuleOut<T> AsType<T, TType>(this IRuleIn<T> @this, Spec...
FILE: src/Validot/Specification/Commands/AsCollectionCommand.cs
class AsCollectionCommand (line 8) | internal abstract class AsCollectionCommand : IScopeCommand
method GetScopeBuilder (line 10) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsCollectionCommand (line 16) | public AsCollectionCommand(Specification<TItem> specification)
method GetScopeBuilder (line 25) | public override ICommandScopeBuilder GetScopeBuilder()
class AsCollectionCommand (line 13) | internal class AsCollectionCommand<T, TItem> : AsCollectionCommand
method GetScopeBuilder (line 10) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsCollectionCommand (line 16) | public AsCollectionCommand(Specification<TItem> specification)
method GetScopeBuilder (line 25) | public override ICommandScopeBuilder GetScopeBuilder()
FILE: src/Validot/Specification/Commands/AsConvertedCommand.cs
class AsConvertedCommand (line 8) | internal abstract class AsConvertedCommand : IScopeCommand
method GetScopeBuilder (line 10) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsConvertedCommand (line 15) | public AsConvertedCommand(Converter<T, TTarget> converter, Specificati...
method GetScopeBuilder (line 30) | public override ICommandScopeBuilder GetScopeBuilder()
class AsConvertedCommand (line 13) | internal class AsConvertedCommand<T, TTarget> : AsConvertedCommand
method GetScopeBuilder (line 10) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsConvertedCommand (line 15) | public AsConvertedCommand(Converter<T, TTarget> converter, Specificati...
method GetScopeBuilder (line 30) | public override ICommandScopeBuilder GetScopeBuilder()
FILE: src/Validot/Specification/Commands/AsDictionaryCommand.cs
class AsDictionaryCommand (line 9) | internal abstract class AsDictionaryCommand : IScopeCommand
method GetScopeBuilder (line 11) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsDictionaryCommand (line 17) | public AsDictionaryCommand(Specification<TValue> specification, Func<T...
method GetScopeBuilder (line 30) | public override ICommandScopeBuilder GetScopeBuilder()
class AsDictionaryCommand (line 14) | internal class AsDictionaryCommand<T, TKey, TValue> : AsDictionaryCommand
method GetScopeBuilder (line 11) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsDictionaryCommand (line 17) | public AsDictionaryCommand(Specification<TValue> specification, Func<T...
method GetScopeBuilder (line 30) | public override ICommandScopeBuilder GetScopeBuilder()
FILE: src/Validot/Specification/Commands/AsModelCommand.cs
class AsModelCommand (line 6) | internal abstract class AsModelCommand : IScopeCommand
method GetScopeBuilder (line 8) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsModelCommand (line 13) | public AsModelCommand(Specification<T> specification)
method GetScopeBuilder (line 22) | public override ICommandScopeBuilder GetScopeBuilder()
class AsModelCommand (line 11) | internal class AsModelCommand<T> : AsModelCommand
method GetScopeBuilder (line 8) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsModelCommand (line 13) | public AsModelCommand(Specification<T> specification)
method GetScopeBuilder (line 22) | public override ICommandScopeBuilder GetScopeBuilder()
FILE: src/Validot/Specification/Commands/AsNullableCommand.cs
class AsNullableCommand (line 6) | internal abstract class AsNullableCommand : IScopeCommand
method GetScopeBuilder (line 8) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsNullableCommand (line 14) | public AsNullableCommand(Specification<T> specification)
method GetScopeBuilder (line 23) | public override ICommandScopeBuilder GetScopeBuilder()
class AsNullableCommand (line 11) | internal class AsNullableCommand<T> : AsNullableCommand
method GetScopeBuilder (line 8) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsNullableCommand (line 14) | public AsNullableCommand(Specification<T> specification)
method GetScopeBuilder (line 23) | public override ICommandScopeBuilder GetScopeBuilder()
FILE: src/Validot/Specification/Commands/AsTypeCommand.cs
class AsTypeCommand (line 6) | internal abstract class AsTypeCommand : IScopeCommand
method GetScopeBuilder (line 8) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsTypeCommand (line 13) | public AsTypeCommand(Specification<TType> specification)
method GetScopeBuilder (line 22) | public override ICommandScopeBuilder GetScopeBuilder()
class AsTypeCommand (line 11) | internal class AsTypeCommand<T, TType> : AsTypeCommand
method GetScopeBuilder (line 8) | public abstract ICommandScopeBuilder GetScopeBuilder();
method AsTypeCommand (line 13) | public AsTypeCommand(Specification<TType> specification)
method GetScopeBuilder (line 22) | public override ICommandScopeBuilder GetScopeBuilder()
FILE: src/Validot/Specification/Commands/ForbiddenCommand.cs
class ForbiddenCommand (line 5) | internal class ForbiddenCommand : ICommand
FILE: src/Validot/Specification/Commands/ICommand.cs
type ICommand (line 3) | internal interface ICommand
FILE: src/Validot/Specification/Commands/IScopeCommand.cs
type IScopeCommand (line 5) | internal interface IScopeCommand : ICommand
method GetScopeBuilder (line 7) | ICommandScopeBuilder GetScopeBuilder();
FILE: src/Validot/Specification/Commands/MemberCommand.cs
class MemberCommand (line 10) | internal abstract class MemberCommand : IScopeCommand
method GetScopeBuilder (line 12) | public abstract ICommandScopeBuilder GetScopeBuilder();
method MemberCommand (line 17) | public MemberCommand(Expression<Func<T, TMember>> memberSelector, Spec...
method GetScopeBuilder (line 30) | public override ICommandScopeBuilder GetScopeBuilder()
method GetMemberName (line 47) | private static string GetMemberName(Expression<Func<T, TMember>> field)
class MemberCommand (line 15) | internal class MemberCommand<T, TMember> : MemberCommand
method GetScopeBuilder (line 12) | public abstract ICommandScopeBuilder GetScopeBuilder();
method MemberCommand (line 17) | public MemberCommand(Expression<Func<T, TMember>> memberSelector, Spec...
method GetScopeBuilder (line 30) | public override ICommandScopeBuilder GetScopeBuilder()
method GetMemberName (line 47) | private static string GetMemberName(Expression<Func<T, TMember>> field)
FILE: src/Validot/Specification/Commands/OptionalCommand.cs
class OptionalCommand (line 5) | internal class OptionalCommand : ICommand
FILE: src/Validot/Specification/Commands/RequiredCommand.cs
class RequiredCommand (line 5) | internal class RequiredCommand : ICommand
FILE: src/Validot/Specification/Commands/RuleCommand.cs
class RuleCommand (line 9) | internal abstract class RuleCommand : IScopeCommand
method GetScopeBuilder (line 11) | public abstract ICommandScopeBuilder GetScopeBuilder();
method RuleCommand (line 16) | public RuleCommand(Predicate<T> predicate)
method RuleCommand (line 23) | public RuleCommand(Predicate<T> predicate, string message, IReadOnlyLi...
method GetScopeBuilder (line 44) | public override ICommandScopeBuilder GetScopeBuilder()
class RuleCommand (line 14) | internal class RuleCommand<T> : RuleCommand
method GetScopeBuilder (line 11) | public abstract ICommandScopeBuilder GetScopeBuilder();
method RuleCommand (line 16) | public RuleCommand(Predicate<T> predicate)
method RuleCommand (line 23) | public RuleCommand(Predicate<T> predicate, string message, IReadOnlyLi...
method GetScopeBuilder (line 44) | public override ICommandScopeBuilder GetScopeBuilder()
FILE: src/Validot/Specification/Commands/WithCodeCommand.cs
class WithCodeCommand (line 5) | internal class WithCodeCommand : ICommand
method WithCodeCommand (line 7) | public WithCodeCommand(string code)
FILE: src/Validot/Specification/Commands/WithConditionCommand.cs
class WithConditionCommand (line 5) | internal abstract class WithConditionCommand : ICommand
method WithConditionCommand (line 11) | public WithConditionCommand(Predicate<T> executionCondition)
class WithConditionCommand (line 9) | internal class WithConditionCommand<T> : WithConditionCommand
method WithConditionCommand (line 11) | public WithConditionCommand(Predicate<T> executionCondition)
FILE: src/Validot/Specification/Commands/WithExtraCodeCommand.cs
class WithExtraCodeCommand (line 5) | internal class WithExtraCodeCommand : ICommand
method WithExtraCodeCommand (line 7) | public WithExtraCodeCommand(string code)
FILE: src/Validot/Specification/Commands/WithExtraMessageCommand.cs
class WithExtraMessageCommand (line 3) | internal class WithExtraMessageCommand : ICommand
method WithExtraMessageCommand (line 5) | public WithExtraMessageCommand(string message)
FILE: src/Validot/Specification/Commands/WithMessageCommand.cs
class WithMessageCommand (line 3) | internal class WithMessageCommand : ICommand
method WithMessageCommand (line 5) | public WithMessageCommand(string message)
FILE: src/Validot/Specification/Commands/WithPathCommand.cs
class WithPathCommand (line 5) | internal class WithPathCommand : ICommand
method WithPathCommand (line 7) | public WithPathCommand(string path)
FILE: src/Validot/Specification/ForbiddenExtension.cs
class ForbiddenExtension (line 6) | public static class ForbiddenExtension
method Forbidden (line 15) | public static IForbiddenOut<T> Forbidden<T>(this IForbiddenIn<T> @this)
method Forbidden (line 24) | public static IForbiddenOut<T?> Forbidden<T>(this IForbiddenIn<T?> @this)
type IForbiddenOut (line 35) | public interface IForbiddenOut<T> :
type IForbiddenIn (line 44) | public interface IForbiddenIn<T>
type ISpecificationIn (line 48) | public partial interface ISpecificationIn<T> : IForbiddenIn<T>
class SpecificationApi (line 52) | internal partial class SpecificationApi<T> : IForbiddenIn<T>, IForbidden...
FILE: src/Validot/Specification/MemberExtension.cs
class MemberExtension (line 9) | public static class MemberExtension
method Member (line 21) | public static IRuleOut<T> Member<T, TMember>(this IRuleIn<T> @this, Ex...
FILE: src/Validot/Specification/OptionalExtension.cs
class OptionalExtension (line 6) | public static class OptionalExtension
method Optional (line 15) | public static IOptionalOut<T> Optional<T>(this IOptionalIn<T> @this)
method Optional (line 24) | public static IOptionalOut<T?> Optional<T>(this IOptionalIn<T?> @this)
type IOptionalOut (line 35) | public interface IOptionalOut<T> :
type IOptionalIn (line 42) | public interface IOptionalIn<T>
type ISpecificationIn (line 46) | public partial interface ISpecificationIn<T> : IOptionalIn<T>
class SpecificationApi (line 50) | internal partial class SpecificationApi<T> : IOptionalIn<T>, IOptionalOu...
FILE: src/Validot/Specification/RequiredExtension.cs
class RequiredExtension (line 6) | public static class RequiredExtension
method Required (line 16) | public static IRequiredOut<T> Required<T>(this IRequiredIn<T> @this)
method Required (line 25) | public static IRequiredOut<T?> Required<T>(this IRequiredIn<T?> @this)
type IRequiredOut (line 36) | public interface IRequiredOut<T> :
type IRequiredIn (line 47) | public interface IRequiredIn<T>
type ISpecificationIn (line 51) | public partial interface ISpecificationIn<T> : IRequiredIn<T>
class SpecificationApi (line 55) | internal partial class SpecificationApi<T> : IRequiredIn<T>, IRequiredOu...
FILE: src/Validot/Specification/RuleExtension.cs
class RuleExtension (line 9) | public static class RuleExtension
method Rule (line 20) | public static IRuleOut<T> Rule<T>(this IRuleIn<T> @this, Predicate<T> ...
method RuleTemplate (line 37) | public static IRuleOut<T> RuleTemplate<T>(this IRuleIn<T> @this, Predi...
type IRuleOut (line 47) | public interface IRuleOut<T> :
type IRuleIn (line 60) | public interface IRuleIn<T>
type ISpecificationIn (line 64) | public partial interface ISpecificationIn<T> : IRuleIn<T>
class SpecificationApi (line 68) | internal partial class SpecificationApi<T> : IRuleIn<T>, IRuleOut<T>
FILE: src/Validot/Specification/SpecificationApi.cs
type ISpecificationIn (line 7) | public partial interface ISpecificationIn<T> : ISpecificationOut<T>
type ISpecificationOut (line 11) | public interface ISpecificationOut<T>
class SpecificationApi (line 15) | internal partial class SpecificationApi<T> : ISpecificationIn<T>
method AddCommand (line 21) | public SpecificationApi<T> AddCommand(ICommand command)
FILE: src/Validot/Specification/WithCodeExtension.cs
class WithCodeExtension (line 6) | public static class WithCodeExtension
method WithCode (line 16) | public static IWithCodeOut<T> WithCode<T>(this IWithCodeIn<T> @this, s...
method WithCode (line 24) | public static IWithCodeForbiddenOut<T> WithCode<T>(this IWithCodeForbi...
type IWithCodeOut (line 34) | public interface IWithCodeOut<T> :
type IWithCodeIn (line 42) | public interface IWithCodeIn<T>
type IWithCodeForbiddenOut (line 46) | public interface IWithCodeForbiddenOut<T> :
type IWithCodeForbiddenIn (line 52) | public interface IWithCodeForbiddenIn<T>
class SpecificationApi (line 56) | internal partial class SpecificationApi<T> : IWithCodeIn<T>, IWithCodeOu...
FILE: src/Validot/Specification/WithConditionExtension.cs
class WithConditionExtension (line 8) | public static class WithConditionExtension
method WithCondition (line 18) | public static IWithConditionOut<T> WithCondition<T>(this IWithConditio...
type IWithConditionOut (line 28) | public interface IWithConditionOut<T> :
type IWithConditionIn (line 40) | public interface IWithConditionIn<T>
class SpecificationApi (line 44) | internal partial class SpecificationApi<T> : IWithConditionIn<T>, IWithC...
FILE: src/Validot/Specification/WithExtraCodeExtension.cs
class WithExtraCodeExtension (line 6) | public static class WithExtraCodeExtension
method WithExtraCode (line 16) | public static IWithExtraCodeOut<T> WithExtraCode<T>(this IWithExtraCod...
method WithExtraCode (line 24) | public static IWithExtraCodeForbiddenOut<T> WithExtraCode<T>(this IWit...
type IWithExtraCodeOut (line 34) | public interface IWithExtraCodeOut<T> :
type IWithExtraCodeIn (line 42) | public interface IWithExtraCodeIn<T>
type IWithExtraCodeForbiddenOut (line 46) | public interface IWithExtraCodeForbiddenOut<T> :
type IWithExtraCodeForbiddenIn (line 52) | public interface IWithExtraCodeForbiddenIn<T>
class SpecificationApi (line 56) | internal partial class SpecificationApi<T> : IWithExtraCodeIn<T>, IWithE...
FILE: src/Validot/Specification/WithExtraMessageExtension.cs
class WithExtraMessageExtension (line 6) | public static class WithExtraMessageExtension
method WithExtraMessage (line 16) | public static IWithExtraMessageOut<T> WithExtraMessage<T>(this IWithEx...
method WithExtraMessage (line 24) | public static IWithExtraMessageForbiddenOut<T> WithExtraMessage<T>(thi...
type IWithExtraMessageOut (line 34) | public interface IWithExtraMessageOut<T> :
type IWithExtraMessageIn (line 43) | public interface IWithExtraMessageIn<T>
type IWithExtraMessageForbiddenOut (line 47) | public interface IWithExtraMessageForbiddenOut<T> :
type IWithExtraMessageForbiddenIn (line 54) | public interface IWithExtraMessageForbiddenIn<T>
class SpecificationApi (line 58) | internal partial class SpecificationApi<T> : IWithExtraMessageIn<T>, IWi...
FILE: src/Validot/Specification/WithMessageExtension.cs
class WithMessageExtension (line 6) | public static class WithMessageExtension
method WithMessage (line 16) | public static IWithMessageOut<T> WithMessage<T>(this IWithMessageIn<T>...
method WithMessage (line 24) | public static IWithMessageForbiddenOut<T> WithMessage<T>(this IWithMes...
type IWithMessageOut (line 34) | public interface IWithMessageOut<T> :
type IWithMessageIn (line 43) | public interface IWithMessageIn<T>
type IWithMessageForbiddenOut (line 47) | public interface IWithMessageForbiddenOut<T> :
type IWithMessageForbiddenIn (line 54) | public interface IWithMessageForbiddenIn<T>
class SpecificationApi (line 58) | internal partial class SpecificationApi<T> : IWithMessageIn<T>, IWithMes...
FILE: src/Validot/Specification/WithPathExtension.cs
class WithPathExtension (line 6) | public static class WithPathExtension
method WithPath (line 16) | public static IWithPathOut<T> WithPath<T>(this IWithPathIn<T> @this, s...
type IWithPathOut (line 26) | public interface IWithPathOut<T> :
type IWithPathIn (line 37) | public interface IWithPathIn<T>
class SpecificationApi (line 41) | internal partial class SpecificationApi<T> : IWithPathIn<T>, IWithPathOu...
FILE: src/Validot/Testing/TestFailedException.cs
class TestFailedException (line 3) | public sealed class TestFailedException : ValidotException
method TestFailedException (line 5) | public TestFailedException(string message)
FILE: src/Validot/Testing/TestResult.cs
class TestResult (line 3) | public sealed class TestResult
method TestResult (line 7) | private TestResult(string message)
method Passed (line 16) | public static TestResult Passed()
method Failed (line 21) | public static TestResult Failed(string message)
method ThrowExceptionIfFailed (line 26) | public void ThrowExceptionIfFailed()
FILE: src/Validot/Testing/Tester.cs
class Tester (line 12) | public static class Tester
method TestSpecification (line 14) | public static TestResult TestSpecification<T>(T value, Specification<T...
method TestSingleRule (line 175) | public static void TestSingleRule<T>(T value, Specification<T> specifi...
method TestExceptionOnInit (line 203) | public static Exception TestExceptionOnInit<TMember>(Specification<TMe...
method TestResultToString (line 225) | public static TestResult TestResultToString(string toStringOutput, ToS...
method ShouldResultToStringHaveLines (line 323) | public static void ShouldResultToStringHaveLines(this string @this, To...
FILE: src/Validot/Testing/ToStringContentType.cs
type ToStringContentType (line 3) | public enum ToStringContentType
FILE: src/Validot/ThrowHelper.cs
class ThrowHelper (line 7) | internal static class ThrowHelper
method Fatal (line 9) | public static void Fatal(string message)
method NullArgument (line 14) | public static void NullArgument<T>(T argument, string name)
method NullInCollection (line 23) | public static void NullInCollection<T>(IReadOnlyList<T> collection, st...
method NullInCollection (line 37) | public static void NullInCollection<T>(IEnumerable<T> collection, stri...
method BelowZero (line 51) | public static void BelowZero(int argument, string name)
method InvalidRange (line 59) | public static void InvalidRange(long minArgument, string minName, long...
method InvalidRange (line 67) | public static void InvalidRange(ulong minArgument, string minName, ulo...
method InvalidRange (line 75) | public static void InvalidRange(decimal minArgument, string minName, d...
method InvalidRange (line 83) | public static void InvalidRange(double minArgument, string minName, do...
FILE: src/Validot/Translations/Chinese/ChineseTranslation.cs
class Translation (line 5) | public static partial class Translation
FILE: src/Validot/Translations/Chinese/ChineseTranslationsExtensions.cs
class TranslationsExtensions (line 6) | public static partial class TranslationsExtensions
method WithChineseTranslation (line 13) | public static ValidatorSettings WithChineseTranslation(this ValidatorS...
FILE: src/Validot/Translations/English/EnglishTranslation.cs
class Translation (line 5) | public static partial class Translation
FILE: src/Validot/Translations/English/EnglishTranslationsExtensions.cs
class TranslationsExtensions (line 6) | public static partial class TranslationsExtensions
method WithEnglishTranslation (line 14) | public static ValidatorSettings WithEnglishTranslation(this ValidatorS...
FILE: src/Validot/Translations/German/GermanTranslation.cs
class Translation (line 5) | public static partial class Translation
FILE: src/Validot/Translations/German/GermanTranslationsExtensions.cs
class TranslationsExtensions (line 6) | public static partial class TranslationsExtensions
method WithGermanTranslation (line 13) | public static ValidatorSettings WithGermanTranslation(this ValidatorSe...
FILE: src/Validot/Translations/ITranslationCompiler.cs
type ITranslationCompiler (line 5) | public interface ITranslationCompiler
method Add (line 9) | void Add(string name, string messageKey, string translation);
FILE: src/Validot/Translations/MessageKey.cs
class MessageKey (line 6) | public static class MessageKey
method MessageKey (line 8) | static MessageKey()
method Touch (line 34) | private static void Touch()
class GuidType (line 38) | public static class GuidType
method GuidType (line 40) | static GuidType()
class BoolType (line 52) | public static class BoolType
method BoolType (line 54) | static BoolType()
class Collections (line 64) | public static class Collections
method Collections (line 66) | static Collections()
class Numbers (line 84) | public static class Numbers
method Numbers (line 86) | static Numbers()
class Texts (line 120) | public static class Texts
method Texts (line 122) | static Texts()
class CharType (line 158) | public static class CharType
method CharType (line 160) | static CharType()
class Times (line 170) | public static class Times
method Times (line 172) | static Times()
class TimeSpanType (line 194) | public static class TimeSpanType
method TimeSpanType (line 196) | static TimeSpanType()
class Global (line 228) | public static class Global
method Global (line 230) | static Global()
FILE: src/Validot/Translations/Polish/PolishTranslation.cs
class Translation (line 5) | public static partial class Translation
FILE: src/Validot/Translations/Polish/PolishTranslationsExtensions.cs
class TranslationsExtensions (line 6) | public static partial class TranslationsExtensions
method WithPolishTranslation (line 13) | public static ValidatorSettings WithPolishTranslation(this ValidatorSe...
FILE: src/Validot/Translations/Portuguese/PortugueseTranslation.cs
class Translation (line 5) | public static partial class Translation
FILE: src/Validot/Translations/Portuguese/PortugueseTranslationsExtensions.cs
class TranslationsExtensions (line 6) | public static partial class TranslationsExtensions
method WithPortugueseTranslation (line 13) | public static ValidatorSettings WithPortugueseTranslation(this Validat...
FILE: src/Validot/Translations/Russian/RussianTranslation.cs
class Translation (line 5) | public static partial class Translation
FILE: src/Validot/Translations/Russian/RussianTranslationsExtensions.cs
class TranslationsExtensions (line 6) | public static partial class TranslationsExtensions
method WithRussianTranslation (line 13) | public static ValidatorSettings WithRussianTranslation(this ValidatorS...
FILE: src/Validot/Translations/Spanish/SpanishTranslation.cs
class Translation (line 5) | public static partial class Translation
FILE: src/Validot/Translations/Spanish/SpanishTranslationsExtensions.cs
class TranslationsExtensions (line 6) | public static partial class TranslationsExtensions
method WithSpanishTranslation (line 13) | public static ValidatorSettings WithSpanishTranslation(this ValidatorS...
FILE: src/Validot/Translations/TranslationCompiler.cs
class TranslationCompiler (line 6) | internal class TranslationCompiler : ITranslationCompiler
method Add (line 28) | public void Add(string name, string messageKey, string translation)
FILE: src/Validot/TypeStringifier.cs
class TypeStringifier (line 6) | internal static class TypeStringifier
method GetFriendlyName (line 9) | public static string GetFriendlyName(this Type type, bool includeNames...
FILE: src/Validot/Validation/DiscoveryContext.cs
class DiscoveryContext (line 8) | internal class DiscoveryContext : IDiscoveryContext, IErrorsHolder
method DiscoveryContext (line 18) | public DiscoveryContext(IDiscoveryContextActions actions, int rootSpec...
method AddError (line 30) | public void AddError(int errorId, bool skipIfDuplicateInPath = false)
method EnterScope (line 45) | public void EnterScope<T>(int id)
method LeavePath (line 68) | public void LeavePath()
method EnterCollectionItemPath (line 73) | public void EnterCollectionItemPath()
method EnterPath (line 80) | public void EnterPath(string path)
FILE: src/Validot/Validation/ErrorFlag.cs
class ErrorFlag (line 5) | internal class ErrorFlag
method ErrorFlag (line 11) | public ErrorFlag(int capacity = 0)
method SetEnabled (line 21) | public void SetEnabled(int level, int errorId)
method SetDetected (line 32) | public void SetDetected(int level)
method LeaveLevelAndTryGetError (line 49) | public bool LeaveLevelAndTryGetError(int level, out int errorId)
FILE: src/Validot/Validation/IDiscoveryContext.cs
type IDiscoveryContext (line 3) | internal interface IDiscoveryContext
method AddError (line 5) | void AddError(int errorId, bool skipIfDuplicateInPath = false);
method EnterPath (line 7) | void EnterPath(string name);
method LeavePath (line 9) | void LeavePath();
method EnterCollectionItemPath (line 11) | void EnterCollectionItemPath();
method EnterScope (line 13) | void EnterScope<T>(int id);
FILE: src/Validot/Validation/IDiscoveryContextActions.cs
type IDiscoveryContextActions (line 6) | internal interface IDiscoveryContextActions
method GetDiscoverableSpecificationScope (line 8) | IDiscoverable GetDiscoverableSpecificationScope(int id);
method RegisterError (line 10) | int RegisterError(IError error);
FILE: src/Validot/Validation/IErrorsHolder.cs
type IErrorsHolder (line 5) | public interface IErrorsHolder
FILE: src/Validot/Validation/IValidationContext.cs
type IValidationContext (line 5) | internal interface IValidationContext
method AddError (line 9) | void AddError(int errorId, bool skipIfDuplicateInPath = false);
method EnterPath (line 11) | void EnterPath(string path);
method LeavePath (line 13) | void LeavePath();
method EnableErrorDetectionMode (line 15) | void EnableErrorDetectionMode(ErrorMode errorMode, int errorId);
method EnterCollectionItemPath (line 17) | void EnterCollectionItemPath(int i);
method EnterScope (line 19) | void EnterScope<T>(int scopeId, T model);
FILE: src/Validot/Validation/IsValidValidationContext.cs
class IsValidValidationContext (line 9) | internal class IsValidValidationContext : IValidationContext
method IsValidValidationContext (line 21) | public IsValidValidationContext(IModelScheme modelScheme, ReferenceLoo...
method AddError (line 42) | public void AddError(int errorId, bool skipIfDuplicateInPath = false)
method EnterPath (line 47) | public void EnterPath(string path)
method LeavePath (line 51) | public void LeavePath()
method EnableErrorDetectionMode (line 55) | public void EnableErrorDetectionMode(ErrorMode errorMode, int errorId)
method EnterCollectionItemPath (line 59) | public void EnterCollectionItemPath(int i)
method EnterScope (line 63) | public void EnterScope<T>(int scopeId, T model)
method GetLoopProtectionReferencesStackCount (line 84) | public int? GetLoopProtectionReferencesStackCount()
method FailWithException (line 89) | private void FailWithException(int scopeId, Type type)
FILE: src/Validot/Validation/Scheme/IModelScheme.cs
type IModelScheme (line 9) | internal interface IModelScheme
method GetSpecificationScope (line 15) | ISpecificationScope<T> GetSpecificationScope<T>(int specificationScope...
method ResolvePath (line 17) | string ResolvePath(string basePath, string relativePath);
method GetPathWithIndexes (line 19) | string GetPathWithIndexes(string path, IReadOnlyCollection<string> ind...
type IModelScheme (line 22) | internal interface IModelScheme<T> : IModelScheme
method GetSpecificationScope (line 15) | ISpecificationScope<T> GetSpecificationScope<T>(int specificationScope...
method ResolvePath (line 17) | string ResolvePath(string basePath, string relativePath);
method GetPathWithIndexes (line 19) | string GetPathWithIndexes(string path, IReadOnlyCollection<string> ind...
FILE: src/Validot/Validation/Scheme/ModelScheme.cs
class ModelScheme (line 9) | internal class ModelScheme<T> : IModelScheme<T>
method ModelScheme (line 15) | public ModelScheme(IReadOnlyDictionary<int, object> specificationScope...
method ResolvePath (line 74) | public string ResolvePath(string basePath, string relativePath)
method GetSpecificationScope (line 87) | public ISpecificationScope<TModel> GetSpecificationScope<TModel>(int s...
method GetPathWithIndexes (line 92) | public string GetPathWithIndexes(string path, IReadOnlyCollection<stri...
FILE: src/Validot/Validation/Scheme/ModelSchemeFactory.cs
class ModelSchemeFactory (line 9) | internal static class ModelSchemeFactory
method Create (line 11) | public static IModelScheme<T> Create<T>(Specification<T> specification)
FILE: src/Validot/Validation/Scopes/Builders/CommandScopeBuilder.cs
class CommandScopeBuilder (line 7) | internal class CommandScopeBuilder<T> : ICommandScopeBuilder
method CommandScopeBuilder (line 19) | public CommandScopeBuilder(ICommand command, Func<ICommand, IScopeBuil...
method Build (line 29) | public ICommandScope Build(IScopeBuilderContext context)
method TryAdd (line 66) | public bool TryAdd(ICommand command)
FILE: src/Validot/Validation/Scopes/Builders/ErrorBuilder.cs
class ErrorBuilder (line 11) | internal class ErrorBuilder
method ErrorBuilder (line 19) | public ErrorBuilder()
method ErrorBuilder (line 23) | public ErrorBuilder(string key, IReadOnlyList<IArg> args = null)
method TryAdd (line 35) | public bool TryAdd(ICommand command)
method Build (line 65) | public IError Build()
method ClearError (line 75) | private void ClearError()
FILE: src/Validot/Validation/Scopes/Builders/ErrorMode.cs
type ErrorMode (line 3) | internal enum ErrorMode
FILE: src/Validot/Validation/Scopes/Builders/ICommandScopeBuilder.cs
type ICommandScopeBuilder (line 5) | internal interface ICommandScopeBuilder
method Build (line 7) | ICommandScope Build(IScopeBuilderContext context);
method TryAdd (line 9) | bool TryAdd(ICommand command);
FILE: src/Validot/Validation/Scopes/Builders/IScopeBuilderContext.cs
type IScopeBuilderContext (line 5) | internal interface IScopeBuilderContext
method RegisterError (line 13) | int RegisterError(IError error);
method GetOrRegisterSpecificationScope (line 15) | int GetOrRegisterSpecificationScope<T>(Specification<T> specification);
FILE: src/Validot/Validation/Scopes/Builders/RuleCommandScopeBuilder.cs
class RuleCommandScopeBuilder (line 7) | internal class RuleCommandScopeBuilder<T> : ICommandScopeBuilder
method RuleCommandScopeBuilder (line 17) | public RuleCommandScopeBuilder(RuleCommand<T> ruleCommand)
method Build (line 29) | public ICommandScope Build(IScopeBuilderContext context)
method TryAdd (line 55) | public bool TryAdd(ICommand command)
FILE: src/Validot/Validation/Scopes/Builders/ScopeBuilder.cs
class ScopeBuilder (line 9) | internal class ScopeBuilder
method Build (line 11) | public SpecificationScope<T> Build<T>(Specification<T> specification, ...
method ParsePresenceInfo (line 52) | private static PresenceInfo ParsePresenceInfo(IReadOnlyList<ICommand> ...
method IsPresenceCommand (line 128) | private static bool IsPresenceCommand(ICommand c)
class PresenceInfo (line 133) | private class PresenceInfo
FILE: src/Validot/Validation/Scopes/Builders/ScopeBuilderContext.cs
class ScopeBuilderContext (line 10) | internal class ScopeBuilderContext : IScopeBuilderContext, IDiscoveryCon...
method ScopeBuilderContext (line 22) | public ScopeBuilderContext()
method GetDiscoverableSpecificationScope (line 67) | public IDiscoverable GetDiscoverableSpecificationScope(int id)
method RegisterError (line 72) | public int RegisterError(IError error)
method GetOrRegisterSpecificationScope (line 82) | public int GetOrRegisterSpecificationScope<T>(Specification<T> specifi...
FILE: src/Validot/Validation/Scopes/CollectionCommandScope.cs
class CollectionCommandScope (line 5) | internal class CollectionCommandScope<T, TItem> : CommandScope<T>
method RunDiscovery (line 10) | protected override void RunDiscovery(IDiscoveryContext context)
method RunValidation (line 19) | protected override void RunValidation(T model, IValidationContext cont...
FILE: src/Validot/Validation/Scopes/CommandScope.cs
class CommandScope (line 7) | internal abstract class CommandScope<T> : ICommandScope<T>
method Discover (line 17) | public void Discover(IDiscoveryContext context)
method Validate (line 34) | public void Validate(T model, IValidationContext context)
method RunValidation (line 55) | protected abstract void RunValidation(T model, IValidationContext cont...
method RunDiscovery (line 57) | protected abstract void RunDiscovery(IDiscoveryContext context);
FILE: src/Validot/Validation/Scopes/ConvertedCommandScope.cs
class ConvertedCommandScope (line 5) | internal class ConvertedCommandScope<T, TTarget> : CommandScope<T>
method RunDiscovery (line 11) | protected override void RunDiscovery(IDiscoveryContext context)
method RunValidation (line 16) | protected override void RunValidation(T model, IValidationContext cont...
FILE: src/Validot/Validation/Scopes/DictionaryCommandScope.cs
class DictionaryCommandScope (line 6) | internal class DictionaryCommandScope<T, TKey, TValue> : CommandScope<T>
method RunDiscovery (line 13) | protected override void RunDiscovery(IDiscoveryContext context)
method RunValidation (line 22) | protected override void RunValidation(T model, IValidationContext cont...
FILE: src/Validot/Validation/Scopes/ICommandScope.cs
type ICommandScope (line 7) | internal interface ICommandScope
type ICommandScope (line 11) | internal interface ICommandScope<T> : ICommandScope, IScope<T>
FILE: src/Validot/Validation/Scopes/IDiscoverable.cs
type IDiscoverable (line 3) | internal interface IDiscoverable
method Discover (line 5) | void Discover(IDiscoveryContext context);
FILE: src/Validot/Validation/Scopes/IScope.cs
type IScope (line 3) | internal interface IScope<in T> : IValidatable<T>, IDiscoverable
FILE: src/Validot/Validation/Scopes/ISpecificationScope.cs
type ISpecificationScope (line 5) | internal interface ISpecificationScope<T> : IValidatable<T>, IDiscoverable
FILE: src/Validot/Validation/Scopes/IValidatable.cs
type IValidatable (line 3) | internal interface IValidatable<in T>
method Validate (line 5) | void Validate(T model, IValidationContext context);
FILE: src/Validot/Validation/Scopes/MemberCommandScope.cs
class MemberCommandScope (line 5) | internal class MemberCommandScope<T, TMember> : CommandScope<T>
method RunDiscovery (line 11) | protected override void RunDiscovery(IDiscoveryContext context)
method RunValidation (line 16) | protected override void RunValidation(T model, IValidationContext cont...
FILE: src/Validot/Validation/Scopes/ModelCommandScope.cs
class ModelCommandScope (line 3) | internal class ModelCommandScope<T> : CommandScope<T>
method RunDiscovery (line 7) | protected override void RunDiscovery(IDiscoveryContext context)
method RunValidation (line 12) | protected override void RunValidation(T model, IValidationContext cont...
FILE: src/Validot/Validation/Scopes/NullableCommandScope.cs
class NullableCommandScope (line 3) | internal class NullableCommandScope<T> : CommandScope<T?>
method RunDiscovery (line 8) | protected override void RunDiscovery(IDiscoveryContext context)
method RunValidation (line 13) | protected override void RunValidation(T? model, IValidationContext con...
FILE: src/Validot/Validation/Scopes/Presence.cs
type Presence (line 3) | internal enum Presence
FILE: src/Validot/Validation/Scopes/RuleCommandScope.cs
class RuleCommandScope (line 7) | internal class RuleCommandScope<T> : ICommandScope<T>
method Discover (line 33) | public void Discover(IDiscoveryContext context)
method Validate (line 40) | public void Validate(T model, IValidationContext context)
FILE: src/Validot/Validation/Scopes/SpecificationScope.cs
class SpecificationScope (line 5) | internal class SpecificationScope<T> : ISpecificationScope<T>
method Discover (line 17) | public void Discover(IDiscoveryContext context)
method Validate (line 40) | public void Validate(T model, IValidationContext context)
FILE: src/Validot/Validation/Scopes/TypeCommandScope.cs
class TypeCommandScope (line 3) | internal class TypeCommandScope<T, TType> : CommandScope<T>
method RunDiscovery (line 7) | protected override void RunDiscovery(IDiscoveryContext context)
method RunValidation (line 12) | protected override void RunValidation(T model, IValidationContext cont...
FILE: src/Validot/Validation/Stacks/PathStack.cs
class PathStack (line 7) | internal class PathStack
method Push (line 29) | public void Push(string path)
method PushWithIndex (line 36) | public void PushWithIndex(string path, int index)
method PushWithDiscoveryIndex (line 48) | public void PushWithDiscoveryIndex(string path)
method Pop (line 53) | public void Pop()
method PushWithIndex (line 66) | private void PushWithIndex(string path, string index)
FILE: src/Validot/Validation/Stacks/ReferenceLoopException.cs
class ReferenceLoopException (line 5) | public sealed class ReferenceLoopException : ValidotException
method ReferenceLoopException (line 7) | internal ReferenceLoopException(string path, string nestedPath, int sc...
method ReferenceLoopException (line 16) | internal ReferenceLoopException(int scopeId, Type type)
method GetMessage (line 33) | private static string GetMessage(string path, string infiniteLoopNeste...
FILE: src/Validot/Validation/Stacks/ReferenceLoopProtectionSettings.cs
class ReferenceLoopProtectionSettings (line 3) | internal class ReferenceLoopProtectionSettings
method ReferenceLoopProtectionSettings (line 5) | public ReferenceLoopProtectionSettings(object rootModelReference = null)
FILE: src/Validot/Validation/Stacks/ReferencesStack.cs
class ReferencesStack (line 5) | internal class ReferencesStack
method TryPush (line 13) | public bool TryPush(int scopeId, string path, object modelReference, o...
method Pop (line 46) | public object Pop(int scopeId, out string path)
method GetStoredReferencesCount (line 55) | public int GetStoredReferencesCount()
class StackItem (line 67) | private class StackItem
FILE: src/Validot/Validation/ValidationContext.cs
class ValidationContext (line 11) | internal class ValidationContext : IValidationContext, IErrorsHolder
method ValidationContext (line 25) | public ValidationContext(IModelScheme modelScheme, bool failFast, Refe...
method AddError (line 54) | public void AddError(int errorId, bool skipIfDuplicateInPath = false)
method EnableErrorDetectionMode (line 68) | public void EnableErrorDetectionMode(ErrorMode errorMode, int errorId)
method LeavePath (line 82) | public void LeavePath()
method EnterCollectionItemPath (line 97) | public void EnterCollectionItemPath(int i)
method EnterPath (line 104) | public void EnterPath(string path)
method EnterScope (line 113) | public void EnterScope<T>(int scopeId, T model)
method GetLoopProtectionReferencesStackCount (line 134) | public int? GetLoopProtectionReferencesStackCount()
method GetCurrentPath (line 139) | private string GetCurrentPath()
method FailWithException (line 146) | private void FailWithException(string higherLevelPath, int scopeId, Ty...
method SaveError (line 165) | private void SaveError(int errorId, bool skipIfDuplicateInPath)
FILE: src/Validot/Validator.cs
class Validator (line 14) | public abstract class Validator
method Validator (line 29) | internal Validator(IModelScheme<T> modelScheme, IValidatorSettings set...
method IsValid (line 45) | public bool IsValid(T model)
method Validate (line 55) | public IValidationResult Validate(T model, bool failFast = false)
class Validator (line 23) | public sealed class Validator<T> : Validator, IValidator<T>
method Validator (line 29) | internal Validator(IModelScheme<T> modelScheme, IValidatorSettings set...
method IsValid (line 45) | public bool IsValid(T model)
method Validate (line 55) | public IValidationResult Validate(T model, bool failFast = false)
FILE: src/Validot/ValidotException.cs
class ValidotException (line 5) | public class ValidotException : Exception
method ValidotException (line 7) | public ValidotException(string message)
method ValidotException (line 12) | public ValidotException(string message, Exception innerException)
FILE: tests/AssemblyWithHolders/AssemblyWithHoldersHook.cs
class AssemblyWithHoldersHook (line 3) | public class AssemblyWithHoldersHook
FILE: tests/AssemblyWithHolders/HolderOfDecimalSpecification.cs
class HolderOfDecimalSpecification (line 5) | public class HolderOfDecimalSpecification : ISpecificationHolder<decimal>
FILE: tests/AssemblyWithHolders/HolderOfIntSpecificationAndSettings.cs
class HolderOfIntSpecificationAndSettings (line 9) | public class HolderOfIntSpecificationAndSettings : ISpecificationHolder<...
FILE: tests/AssemblyWithHolders/HolderOfMultipleSpecifications.cs
class HolderOfMultipleSpecifications (line 7) | public class HolderOfMultipleSpecifications : ISpecificationHolder<DateT...
FILE: tests/AssemblyWithHolders/HolderOfMultipleSpecificationsAndSettings.cs
class HolderOfMultipleSpecificationsAndSettings (line 9) | public class HolderOfMultipleSpecificationsAndSettings : ISpecificationH...
FILE: tests/AssemblyWithHolders/HolderOfStringSpecification.cs
class HolderOfStringSpecification (line 5) | public class HolderOfStringSpecification : ISpecificationHolder<string>
FILE: tests/AssemblyWithHolders/HolderOfStringSpecificationAndSettings.cs
class HolderOfStringSpecificationAndSettings (line 9) | public class HolderOfStringSpecificationAndSettings : ISpecificationHold...
FILE: tests/AssemblyWithHolders/NestedHolders.cs
class NestedHolders (line 11) | public class NestedHolders
class NestedHolderOfBoolSpecification (line 13) | public class NestedHolderOfBoolSpecification : ISpecificationHolder<bool>
class NestedHolderOfStringSpecification (line 18) | public class NestedHolderOfStringSpecification : ISpecificationHolder<...
class NestedHolderOfStringSpecificationAndSettings (line 23) | public class NestedHolderOfStringSpecificationAndSettings : ISpecifica...
FILE: tests/AssemblyWithHolders/PrivateSpecificationAndSettingsHolder.cs
class PrivateSpecificationAndSettingsHolder (line 9) | internal class PrivateSpecificationAndSettingsHolder : ISpecificationHol...
FILE: tests/AssemblyWithHolders/PrivateSpecificationHolder.cs
class PrivateSpecificationHolder (line 5) | internal class PrivateSpecificationHolder : ISpecificationHolder<string>
FILE: tests/Validot.Benchmarks/Comparisons/ComparisonDataSet.cs
class ComparisonDataSet (line 12) | public static class ComparisonDataSet
method ComparisonDataSet (line 14) | static ComparisonDataSet()
class FullModel (line 172) | public class FullModel
class NestedModel (line 205) | public class NestedModel
class FullModelValidator (line 220) | public class FullModelValidator : AbstractValidator<FullModel>
method FullModelValidator (line 222) | public FullModelValidator()
class NestedModelValidator (line 277) | public class NestedModelValidator : AbstractValidator<NestedModel>
method NestedModelValidator (line 279) | public NestedModelValidator()
FILE: tests/Validot.Benchmarks/Comparisons/EngineOnlyBenchmark.cs
class EngineOnlyBenchmark (line 10) | [MemoryDiagnoser]
class VoidModel (line 23) | public class VoidModel
class NoLogicModelSingleRuleValidator (line 28) | public class NoLogicModelSingleRuleValidator : AbstractValidator<VoidM...
method NoLogicModelSingleRuleValidator (line 30) | public NoLogicModelSingleRuleValidator()
class NoLogicModelTenRulesValidator (line 36) | public class NoLogicModelTenRulesValidator : AbstractValidator<VoidModel>
method NoLogicModelTenRulesValidator (line 38) | public NoLogicModelTenRulesValidator()
method GlobalSetup (line 56) | [GlobalSetup]
method IsValid_SingleRule_FluentValidation (line 82) | [Benchmark]
method IsValid_TenRules_FluentValidation (line 95) | [Benchmark]
method IsValid_SingleRule_Validot (line 108) | [Benchmark]
method IsValid_TenRules_Validot (line 121) | [Benchmark]
method Validate_SingleRule_FluentValidation (line 134) | [Benchmark]
method Validate_TenRules_FluentValidation (line 147) | [Benchmark]
method Validate_SingleRule_Validot (line 160) | [Benchmark]
method Validate_TenRules_Validot (line 173) | [Benchmark]
FILE: tests/Validot.Benchmarks/Comparisons/InitializationBenchmark.cs
class InitializationBenchmark (line 5) | [MemoryDiagnoser]
method Initialization_FluentValidation (line 8) | [Benchmark]
method Initialization_Validot (line 14) | [Benchmark]
FILE: tests/Validot.Benchmarks/Comparisons/ReportingBenchmark.cs
class ReportingBenchmark (line 7) | [MemoryDiagnoser]
method GlobalSetup (line 19) | [GlobalSetup]
method Reporting_FluentValidation (line 29) | [Benchmark]
method Reporting_Validot (line 49) | [Benchmark]
FILE: tests/Validot.Benchmarks/Comparisons/ToStringBenchmark.cs
class ToStringBenchmark (line 17) | [MemoryDiagnoser]
method GlobalSetup (line 26) | [GlobalSetup]
method ToString_FluentValidation (line 51) | [Benchmark]
method ToString_Validot (line 66) | [Benchmark]
FILE: tests/Validot.Benchmarks/Comparisons/ValidationBenchmark.cs
class ValidationBenchmark (line 7) | [MemoryDiagnoser]
method GlobalSetup (line 19) | [GlobalSetup]
method IsValid_FluentValidation (line 29) | [Benchmark]
method IsValid_Validot (line 45) | [Benchmark]
method FailFast_FluentValidation (line 60) | [Benchmark]
method FailFast_Validot (line 76) | [Benchmark]
method Validate_FluentValidation (line 91) | [Benchmark]
method Validate_Validot (line 106) | [Benchmark]
FILE: tests/Validot.Benchmarks/EmailModesBenchmark.cs
class EmailModesBenchmark (line 11) | [MemoryDiagnoser]
method GlobalSetup (line 20) | [GlobalSetup]
method ComplexRegex (line 29) | [Benchmark]
method DataAnnotationsCompatible (line 42) | [Benchmark]
class EmailHolder (line 55) | private class EmailHolder
FILE: tests/Validot.Benchmarks/Program.cs
class Program (line 14) | class Program
method Main (line 16) | static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(type...
method SetupStats (line 28) | static void SetupStats()
method ErrorMessagesDataTest (line 56) | static void ErrorMessagesDataTest()
FILE: tests/Validot.MemoryLeak/Program.cs
class Program (line 10) | class Program
method Main (line 12) | static int Main(string[] args)
FILE: tests/Validot.MemoryLeak/StreamDataSet.cs
class StreamDataSet (line 10) | public static class StreamDataSet
method StreamDataSet (line 12) | static StreamDataSet()
class FullModel (line 73) | public class FullModel
class NestedModel (line 110) | public class NestedModel
FILE: tests/Validot.Tests.Functional/ConcurrencyFuncTests.cs
class ConcurrencyTests (line 17) | public class ConcurrencyTests
method ShouldHaveSameContent (line 19) | private void ShouldHaveSameContent(IValidationResult result1, IValidat...
class FullModel (line 59) | public class FullModel
class NestedModel (line 96) | public class NestedModel
method Should_HaveSameResults_When_RunInConcurrentEnvironment (line 111) | [Theory]
FILE: tests/Validot.Tests.Functional/Documentation/CustomRulesFuncTests.cs
class MyCustomValidotRules (line 13) | public static class MyCustomValidotRules
method HasCharacter (line 15) | public static IRuleOut<string> HasCharacter(this IRuleIn<string> @this)
method HasCharacter (line 53) | public static IRuleOut<string> HasCharacter(
method HasCharacter (line 96) | public static IRuleOut<string> HasCharacter(
class CustomRulesFuncTests (line 24) | public class CustomRulesFuncTests
method CustomRule (line 26) | [Fact]
method CustomRule (line 69) | [Fact]
method CustomRule (line 112) | [Fact]
class MyCustomValidotRules (line 51) | public static class MyCustomValidotRules
method HasCharacter (line 15) | public static IRuleOut<string> HasCharacter(this IRuleIn<string> @this)
method HasCharacter (line 53) | public static IRuleOut<string> HasCharacter(
method HasCharacter (line 96) | public static IRuleOut<string> HasCharacter(
class CustomRulesFuncTests (line 67) | public class CustomRulesFuncTests
method CustomRule (line 26) | [Fact]
method CustomRule (line 69) | [Fact]
method CustomRule (line 112) | [Fact]
class MyCustomValidotRules (line 94) | public static class MyCustomValidotRules
method HasCharacter (line 15) | public static IRuleOut<string> HasCharacter(this IRuleIn<string> @this)
method HasCharacter (line 53) | public static IRuleOut<string> HasCharacter(
method HasCharacter (line 96) | public static IRuleOut<string> HasCharacter(
class CustomRulesFuncTests (line 110) | public class CustomRulesFuncTests
method CustomRule (line 26) | [Fact]
method CustomRule (line 69) | [Fact]
method CustomRule (line 112) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/ErrorOutputFuncTests.cs
class ErrorOutputFuncTests (line 10) | public class ErrorOutputFuncTests
method ErrorMessages (line 12) | [Fact]
method ErrorMessages_Paths (line 39) | [Fact]
method ErrorCodes (line 76) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/FactoryFuncTests.cs
class FactoryFuncTests (line 14) | public class FactoryFuncTests
method Specification (line 16) | [Fact]
method SpecificationHolder (line 65) | [Fact]
method SettingsHolder (line 90) | [Fact]
method SettingsHolderWithInlineModification (line 137) | [Fact]
method ReusingSettings (line 161) | [Fact]
method FetchingHolders (line 199) | [Fact]
class BookSpecificationHolder (line 217) | public class BookSpecificationHolder : ISpecificationHolder<BookModel>
method BookSpecificationHolder (line 219) | public BookSpecificationHolder()
class AuthorSpecificationHolder (line 242) | public class AuthorSpecificationHolder : ISpecificationHolder<AuthorMo...
method AuthorSpecificationHolder (line 244) | public AuthorSpecificationHolder()
FILE: tests/Validot.Tests.Functional/Documentation/FluentApiFuncTests.cs
class FluentApiFuncTests (line 16) | public class FluentApiFuncTests
method Rule (line 18) | [Fact]
method Rule_WithMessage (line 35) | [Fact]
method Rule_Relation (line 48) | [Fact]
method Rule_NullMembers (line 64) | [Fact]
method Rule_ExceptionBubbledUp (line 88) | [Fact]
method RuleTemplate_RuleTemplateVsRule (line 107) | [Fact]
method RuleTemplate_Args (line 129) | [Fact]
method RuleTemplate_ArgsWithParameters (line 145) | [Fact]
method RuleTemplate_InvalidPlaceholders (line 166) | [Fact]
method RuleTemplate_MultipleParameters (line 187) | [Fact]
method RuleTemplate_WithMessageUsingArgs (line 212) | [Fact]
method Member (line 234) | [Fact]
method Member_NextLevel (line 266) | [Fact]
method Member_Inline (line 296) | [Fact]
method Member_InvalidMemberSelector (line 324) | [Fact]
method Member_HandlingNulls (line 342) | [Fact]
method AsModel (line 387) | [Fact]
method AsModel_NestedLevels (line 410) | [Fact]
method AsModel_MergingSpecifications (line 437) | [Fact]
method AsModel_ChangingPresenceRule_ToOptional (line 465) | [Fact]
method AsModel_ChangingPresenceRule_ToRequired (line 493) | [Fact]
method AsModel_BundleRules (line 525) | [Fact]
method AsModel_BundleRules_InlineAndWithoutMessages (line 554) | [Fact]
method AsCollection (line 572) | [Fact]
class NumberCollection (line 593) | private class NumberCollection : IEnumerable<int>, IEnumerable<double>
method GetEnumerator (line 599) | IEnumerator<double> IEnumerable<double>.GetEnumerator() => Doubles.G...
method GetEnumerator (line 601) | IEnumerator<int> IEnumerable<int>.GetEnumerator() => Ints.GetEnumera...
method GetEnumerator (line 603) | IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable<int>)this)....
method AsCollection_CustomIEnumerable (line 606) | [Fact]
method AsCollection_NullItem (line 640) | [Fact]
method AsCollection_NullItem_Optional (line 676) | [Fact]
method AsCollection_CollectionAndItems (line 710) | [Fact]
method AsNullable (line 748) | [Fact]
method AsNullable_Optional (line 772) | [Fact]
method AsNullable_BuiltInRules (line 794) | [Fact]
method AsNullable_ReuseSpecification (line 818) | [Fact]
method AsConverted_SameType (line 847) | [Fact]
method AsConverted_DifferentTypeAndInline (line 876) | [Fact]
method AsConverted_RequiredForValueTypeInTemplate (line 898) | [Fact]
class Animal (line 925) | private class Animal
class Mammal (line 930) | private class Mammal : Animal
class Elephant (line 935) | private class Elephant : Mammal
method AsType_SpecificationOfParentInSpecificationOfChild (line 940) | [Fact]
method AsType_SpecificationOfChildInSpecificationOfParent (line 967) | [Fact]
method AsType_NonRelatedTypes (line 994) | [Fact]
method AsType_SummingAllLevels (line 1018) | [Fact]
method AsDictionary_Simple (line 1071) | [Fact]
method AsDictionary_KeyStringifier (line 1099) | [Fact]
method AsDictionary_NullValues (line 1127) | [Fact]
method AsDictionary_NullValues_Optional (line 1154) | [Fact]
method AsDictionary_Template (line 1180) | [Fact]
method AsDictionary_KeyNormalization (line 1198) | [Fact]
class SimpleDictionary (line 1228) | private class SimpleDictionary : IEnumerable<KeyValuePair<int, int>>
method SimpleDictionary (line 1230) | public SimpleDictionary(Dictionary<int, int> items)
method GetEnumerator (line 1237) | IEnumerator<KeyValuePair<int, int>> IEnumerable<KeyValuePair<int, in...
method GetEnumerator (line 1239) | IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable<KeyValuePai...
method AsDictionary_CustomClass (line 1242) | [Fact]
class DoubleDictionary (line 1282) | private class DoubleDictionary : IEnumerable<KeyValuePair<int, int>>, ...
method DoubleDictionary (line 1288) | public DoubleDictionary(Dictionary<int, int> ints, Dictionary<string...
method GetEnumerator (line 1294) | IEnumerator<KeyValuePair<int, int>> IEnumerable<KeyValuePair<int, in...
method GetEnumerator (line 1296) | IEnumerator<KeyValuePair<string, string>> IEnumerable<KeyValuePair<s...
method GetEnumerator (line 1298) | IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedE...
method AsDictionary_CustomClassDoubleDictionary (line 1301) | [Fact]
method WithCondition (line 1359) | [Fact]
method WithCondition_PreVerification (line 1379) | [Fact]
method WithCondition_SelectiveSpecification (line 1432) | [Fact]
method WithPath (line 1489) | [Fact]
method WithPath_GoingUp (line 1515) | [Fact]
method WithPath_Restrictions (line 1543) | [Fact]
method WithPath_Member (line 1559) | [Fact]
method WithPath_MergeErrorOutputs (line 1583) | [Fact]
method WithPath_SplitErrorOutputs (line 1613) | [Fact]
method WithMessage (line 1642) | [Fact]
method WithMessage_Args (line 1667) | [Fact]
method WithMessage_OverrideMultipleMessages (line 1682) | [Fact]
method WithExtraMessage (line 1711) | [Fact]
method WithExtraMessage_AddToEntireErrorOutput (line 1730) | [Fact]
method WithExtraMessage_Args (line 1762) | [Fact]
method WithCode (line 1778) | [Fact]
method WithCode_Results (line 1795) | [Fact]
method WithCode_OverrideEntireErrorOutput (line 1822) | [Fact]
method WithExtraCode (line 1853) | [Fact]
method WithExtraCode_Mix (line 1871) | [Fact]
method Optional (line 1908) | [Fact]
method Optional_Member (line 1949) | [Fact]
method Required (line 1972) | [Fact]
method Required_WithMessageAndCodes (line 2019) | [Fact]
method Forbidden (line 2044) | [Fact]
method Forbidden_WithMessageAndCodes (line 2059) | [Fact]
method Required_WithPathWorkaround (line 2083) | [Fact]
method And_WithPathWorkaround (line 2112) | [Fact]
class VerySpecialException (line 2168) | public class VerySpecialException : Exception
FILE: tests/Validot.Tests.Functional/Documentation/MessageArgumentsFuncTests.cs
class MessageArgumentsFuncTests (line 10) | public class MessageArgumentsFuncTests
method MessageArguments (line 12) | [Fact]
method MessageArguments_Arguments (line 26) | [Fact]
method EnumArgument (line 42) | [Fact]
method GuidArgument (line 58) | [Fact]
method NumberArgument (line 72) | [Fact]
method TextArgument (line 86) | [Fact]
method TimeArgument (line 100) | [Fact]
method TranslationArgument (line 114) | [Fact]
method PathArgument (line 137) | [Fact]
method PathArgument_Root (line 154) | [Fact]
method NameArgument (line 170) | [Fact]
method NameArgument_Root (line 187) | [Fact]
method NameArgument_TitleCase (line 203) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/Models/A.cs
class A (line 3) | public class A
FILE: tests/Validot.Tests.Functional/Documentation/Models/AuthorModel.cs
class AuthorModel (line 3) | public class AuthorModel
FILE: tests/Validot.Tests.Functional/Documentation/Models/B.cs
class B (line 3) | public class B
FILE: tests/Validot.Tests.Functional/Documentation/Models/BookModel.cs
class BookModel (line 5) | public class BookModel
FILE: tests/Validot.Tests.Functional/Documentation/Models/Language.cs
type Language (line 3) | public enum Language
FILE: tests/Validot.Tests.Functional/Documentation/Models/PublisherModel.cs
class PublisherModel (line 3) | public class PublisherModel
FILE: tests/Validot.Tests.Functional/Documentation/ParameterCommandsFuncTests.cs
class ParameterCommandsFuncTests (line 7) | public class ParameterCommandsFuncTests
method ParameterCommands (line 9) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/PresenceCommandsFuncTests.cs
class PresenceCommandsFuncTests (line 7) | public class PresenceCommandsFuncTests
method PresenceCommands (line 9) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/ReferenceLoopFuncTests.cs
class ReferenceLoopFuncTests (line 13) | public class ReferenceLoopFuncTests
method ReferenceLoop_Results (line 15) | [Fact]
method ReferenceLoop_Exception (line 47) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/ResultFuncTests.cs
class ResultFuncTests (line 14) | public class ResultFuncTests
method AnyErrors (line 16) | [Fact]
method Paths (line 33) | [Fact]
method Codes (line 74) | [Fact]
method CodeMap (line 102) | [Fact]
method MessageMap (line 138) | [Fact]
method GetTranslatedMessageMap (line 174) | [Fact]
method GetTranslatedMessageMap_InvalidTranslationName (line 210) | [Fact]
method TranslationNames_Default (line 243) | [Fact]
method TranslationNames (line 257) | [Fact]
method ToStringMethod (line 273) | [Fact]
method ToStringMethod_Translation (line 316) | [Fact]
method ToStringMethod_Valid (line 363) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/ScopeCommandsFuncTests.cs
class ScopeCommandsFuncTests (line 7) | public class ScopeCommandsFuncTests
method ScopeCommands (line 9) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/SettingsFuncTests.cs
class SettingsFuncTests (line 12) | public class SettingsFuncTests
method Settings_Factory (line 14) | [Fact]
method WithTranslation (line 26) | [Fact]
method WithTranslation_FullDictionary (line 40) | [Fact]
method WithTranslation_Dictionaries (line 63) | [Fact]
method WithTranslation_OverwriteDefaults (line 83) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/SpecificationFuncTests.cs
class SpecificationFuncTests (line 7) | public class SpecificationFuncTests
method ChainCommands (line 9) | [Fact]
method Scopes (line 20) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/TranslationsFuncTests.cs
class TranslationsFuncTests (line 7) | public class TranslationsFuncTests
method Translation_PrintingMessageKey (line 9) | [Fact]
method Translation_DeliveringTranslation (line 22) | [Fact]
method OverridingMessages (line 44) | [Fact]
method OverridingMessages_Arguments (line 66) | [Fact]
class BuiltInTranslationsTests (line 85) | public class BuiltInTranslationsTests
method WithPolishTranslation (line 87) | [Fact]
method WithSpanishTranslation (line 114) | [Fact]
method WithRussianTranslation (line 141) | [Fact]
method WithPortugueseTranslation (line 168) | [Fact]
method WithGermanTranslation (line 195) | [Fact]
class WithYodaEnglishExtension (line 230) | public static class WithYodaEnglishExtension
method WithYodaEnglish (line 232) | public static ValidatorSettings WithYodaEnglish(this ValidatorSettings...
class CustomTranslationsFuncTests (line 244) | public class CustomTranslationsFuncTests
method CustomTranslation_Extension (line 246) | [Fact]
FILE: tests/Validot.Tests.Functional/Documentation/ValidatorFuncTests.cs
class ValidatorFuncTests (line 11) | public class ValidatorFuncTests
method Validator_Create (line 13) | [Fact]
method Validator_CreateWithSettings (line 24) | [Fact]
method Validator_ExecutionOptimization (line 41) | [Fact]
method Validate (line 63) | [Fact]
method Validate_IsValid (line 99) | [Fact]
method Template (line 132) | [Fact]
method Template_AsCollection (line 150) | [Fact]
method Template_ReferenceLoop (line 171) | [Fact]
method Template_Complex (line 198) | [Fact]
FILE: tests/Validot.Tests.Functional/Readme/FeaturesFuncTests.cs
class RulesExtensions (line 14) | public static class RulesExtensions
method ExactLinesCount (line 16) | public static IRuleOut<string> ExactLinesCount(this IRuleIn<string> @t...
class FeaturesFuncTests (line 26) | public class FeaturesFuncTests
class UserModel (line 28) | public class UserModel
class BookModel (line 39) | public class BookModel
method FluentApi (line 48) | [Fact]
method Validators (line 86) | [Fact]
method Rules (line 122) | [Fact]
method Translations (line 147) | [Fact]
method HandlingNulls (line 173) | [Fact]
FILE: tests/Validot.Tests.Functional/Readme/QuickStartFuncTests.cs
class QuickStartTest (line 12) | public class QuickStartTest
class UserModel (line 14) | public class UserModel
method UserModel (line 16) | public UserModel(string email = null, string name = null, int age = 0)
method QuickStart (line 32) | [Fact]
FILE: tests/Validot.Tests.Unit/CodeHelperTests.cs
class CodeHelperTests (line 9) | public class CodeHelperTests
method Codes_Invalid (line 11) | public static IEnumerable<object[]> Codes_Invalid()
method Codes_Valid (line 18) | public static IEnumerable<object[]> Codes_Valid()
method IsCodeValid_Should_ReturnTrue_When_CodeIsValid (line 29) | [Theory]
method IsCodeValid_Should_ReturnFalse_When_CodeIsInvalid (line 36) | [Theory]
FILE: tests/Validot.Tests.Unit/ErrorContentApiHelper.cs
class ErrorContentApiHelper (line 12) | public static class ErrorContentApiHelper
class ExpectedErrorContent (line 14) | public class ExpectedErrorContent
method ShouldBeEmpty (line 22) | public bool ShouldBeEmpty(int initialMessagesAmount = 1, int initial...
method Match (line 31) | public void Match(IError error, int initialMessagesAmount = 1, int i...
method AllCases (line 51) | public static IEnumerable<object[]> AllCases<T>()
method NoCommand (line 69) | public static IEnumerable<object[]> NoCommand<T>()
method SettingsOnlyMessages (line 83) | public static IEnumerable<object[]> SettingsOnlyMessages<T>()
method SettingsOnlyCodes (line 263) | public static IEnumerable<object[]> SettingsOnlyCodes<T>()
method SettingMessagesAndCodes (line 443) | public static IEnumerable<object[]> SettingMessagesAndCodes<T>()
method WithMessage (line 525) | private static dynamic WithMessage<T>(dynamic api, string message)
method WithExtraMessage (line 540) | private static dynamic WithExtraMessage<T>(dynamic api, string message)
method WithCode (line 555) | private static dynamic WithCode<T>(dynamic api, string code)
method WithExtraCode (line 570) | private static dynamic WithExtraCode<T>(dynamic api, string code)
FILE: tests/Validot.Tests.Unit/ErrorSetupApiHelper.cs
class ErrorSetupApiHelper (line 8) | public static class ErrorSetupApiHelper
class ExpectedErrorSetup (line 10) | public class ExpectedErrorSetup<T>
method AllCases (line 17) | public static IEnumerable<object[]> AllCases<T>()
method WithPath (line 87) | private static dynamic WithPath<T>(dynamic api, string message)
method WithCondition (line 97) | private static dynamic WithCondition<T>(dynamic api, Predicate<T> pred...
FILE: tests/Validot.Tests.Unit/Errors/Args/ArgHelperTests.cs
class ArgHelperTests (line 13) | public class ArgHelperTests
class FormatMessage (line 15) | public class FormatMessage
method Should_ReturnEmptyString_When_MessageIsNull (line 17) | [Fact]
method Should_ReturnMessage_When_NullPlaceholders (line 24) | [Fact]
method Should_ReturnMessage_When_NoPlaceholders (line 32) | [Fact]
method Should_ReturnMessage_When_NoArgs (line 40) | [Fact]
method Should_ReturnMessage_When_NullArgs (line 48) | [Fact]
method Should_FormatMessage_SinglePlaceholder (line 56) | [Fact]
method Should_FormatMessage_SinglePlaceholder_ManyOccurrencesInMessage (line 93) | [Fact]
method Should_FormatMessage_ManyPlaceholders_SingleArg (line 130) | [Fact]
method Should_FormatMessage_ManyArgs_ManyPlaceholders (line 195) | [Fact]
method Should_FormatMessage_ManyArgs_ManyPlaceholders_ManyParams (line 253) | [Fact]
method Should_FormatMessage_PassParametersToArgs (line 321) | [Fact]
method Should_FormatMessage_NotPassParametersToArgs_When_AtLeastOneParameterNotAllowed (line 363) | [Fact]
class TestArg (line 417) | private class TestArg : IArg
method TestArg (line 421) | public TestArg(Action<IReadOnlyDictionary<string, string>> paramet...
method ToString (line 432) | public string ToString(IReadOnlyDictionary<string, string> paramet...
class ExtractPlaceholders (line 441) | public class ExtractPlaceholders
method Should_ReturnEmptyCollection_When_NoVariable (line 443) | [Theory]
method Should_ReturnEmptyCollection_When_InvalidParameters (line 456) | [Theory]
method Should_ReturnEmptyCollection_When_EmptyName (line 468) | [Theory]
method Should_Extract_And_SquashDuplicates (line 478) | [Fact]
method Should_Parse_When_ManySameVariables_With_DifferentParameters (line 492) | [Fact]
method Should_Parse_When_ManyVariables (line 518) | [Fact]
method Should_Parse_When_ManyVariables_With_Parameters (line 538) | [Fact]
method Should_Parse_When_SingleVariable (line 570) | [Fact]
method Should_Parse_When_SingleVariable_With_ManyParameters (line 582) | [Fact]
method Should_Parse_When_SingleVariable_With_SingleParameter (line 600) | [Fact]
method Should_ParseOnlyValidOnes (line 614) | [Fact]
method Should_ReturnEmptyCollection_When_DuplicateParameter (line 632) | [Fact]
method Should_ThrowException_When_NullMessage (line 640) | [Fact]
method Assignment_Should_BeEqualitySign (line 649) | [Fact]
method Divider_Should_BeVerticalBar (line 655) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/EnumArgTests.cs
class EnumArgTests (line 13) | public class EnumArgTests
method Should_Stringify_UsingFormat (line 15) | [Theory]
method Should_Initialize (line 31) | [Fact]
method Should_NotStringify_Translation_When_ParameterValueIsNotTrue (line 46) | [Fact]
method Should_Stringify_Translation (line 67) | [Fact]
method Should_StringifyDefaultValues (line 88) | [Fact]
method Should_StringifyUsingTranslation_When_BothFormatAndTranslationPresent (line 97) | [Fact]
method Should_ThrowException_When_NullName (line 111) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/GuidArgTests.cs
class GuidArgTests (line 12) | public class GuidArgTests
method Should_Stringify_Case (line 14) | [Theory]
method Should_Stringify_Format (line 35) | [Theory]
method Should_Stringify (line 55) | [Theory]
method Should_Initialize (line 82) | [Fact]
method Should_Stringify_IntoSameValue_When_InvalidParameter (line 101) | [Fact]
method Should_ThrowException_When_NullName (line 116) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/NameArgTests.cs
class NameArgTests (line 12) | public class NameArgTests
method Should_Initialize (line 14) | [Fact]
method Should_Stringify_ReturnArgName_If_NullParameters (line 27) | [Fact]
method Should_Stringify_ReturnArgName_If_InvalidParameterName (line 42) | [Fact]
method Should_Stringify_To_TitleCase (line 57) | [Theory]
method Should_ThrowException_When_NullName (line 90) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/NumberArgTests.cs
class NumberArgTests (line 12) | public class NumberArgTests
method Should_Stringify_Numbers_WithFormatAndCulture_Data (line 14) | public static IEnumerable<object[]> Should_Stringify_Numbers_WithForma...
method Should_Stringify_Numbers_WithFormatAndCulture (line 105) | [Theory]
method Should_Stringify_Dates_WithCulture_Data (line 118) | public static IEnumerable<object[]> Should_Stringify_Dates_WithCulture...
method Should_Stringify_Dates_WithCulture (line 198) | [Theory]
method Should_Stringify_WithFormat_Data (line 210) | public static IEnumerable<object[]> Should_Stringify_WithFormat_Data()
method Should_Stringify_WithFormat (line 290) | [Theory]
method Should_Stringify_Default_Data (line 302) | public static IEnumerable<object[]> Should_Stringify_Default_Data()
method Should_Stringify_Default (line 371) | [Theory]
method Should_Initialize (line 380) | [Fact]
method Should_Initialize_Values (line 397) | [Fact]
method Should_ThrowException_When_NullName (line 445) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/TextArgTests.cs
class TextArgTests (line 12) | public class TextArgTests
method Should_Stringify_String (line 14) | [Theory]
method Should_Stringify_Char (line 33) | [Theory]
method Should_Stringify_Char_IntoSameValue_When_InvalidParameter (line 53) | [Theory]
method Should_Initialize (line 68) | [Fact]
method Should_Stringify_String_IntoSameValue_When_InvalidParameter (line 82) | [Fact]
method Should_ThrowException_When_NullName (line 95) | [Fact]
method Should_ThrowException_When_NullValue (line 103) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/TimeArgTests.cs
class TimeArgTests (line 13) | public class TimeArgTests
method Should_Stringify_Times_WithFormatAndCulture_Data (line 15) | public static IEnumerable<object[]> Should_Stringify_Times_WithFormatA...
method Should_Stringify_Times_WithFormatAndCulture (line 42) | [Theory]
method Should_Stringify_Dates_WithCulture_Data (line 59) | public static IEnumerable<object[]> Should_Stringify_Dates_WithCulture...
method Should_Stringify_Dates_WithCulture (line 83) | [Theory]
method Should_Stringify_WithFormat_Data (line 97) | public static IEnumerable<object[]> Should_Stringify_WithFormat_Data()
method Should_Stringify_WithFormat (line 135) | [Theory]
method Should_Stringify_Default_Data (line 149) | public static IEnumerable<object[]> Should_Stringify_Default_Data()
method Should_Stringify_Default (line 170) | [Theory]
method Should_Initialize (line 179) | [Fact]
method Should_ThrowException_When_NullName (line 191) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/TranslationArgTests.cs
class TranslationArgTests (line 12) | public class TranslationArgTests
method Should_Initialize (line 14) | [Fact]
method Should_CreatePlaceHolder (line 29) | [Theory]
method Should_Stringify_UsingDictionary_And_Key (line 39) | [Fact]
method Should_Stringify_ReturnKey_If_KeyNotInTranslation (line 64) | [Fact]
method Should_Stringify_ReturnArgName_If_NullParameters (line 89) | [Fact]
method Should_Stringify_ReturnArgName_If_InvalidParameterName (line 105) | [Fact]
method Should_ThrowException_When_NullKey (line 126) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Args/TypeArgTests.cs
class TypeArgTests (line 12) | public class TypeArgTests
method Should_Initialize (line 14) | [Fact]
method Should_Stringify_Format (line 29) | [Theory]
method Should_Stringify_Translation (line 48) | [Fact]
method Should_NotStringify_Translation_When_ParameterValueIsNotTrue (line 69) | [Fact]
method Should_StringifyUsingTranslation_When_BothFormatAndTranslationPresent (line 90) | [Fact]
method Should_StringifyDefaultValues (line 104) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/MessageCacheTests.cs
class MessageCacheTests (line 14) | public class MessageCacheTests
class AddMessage (line 16) | public class AddMessage
method Should_AddMessage (line 18) | [Fact]
method Should_AddMessage_MultipleTimes_ToDifferentDictionaries (line 39) | [Fact]
method Should_AddMessage_MultipleTimes_ToDifferentDictionaries_SameErrorId (line 69) | [Fact]
method Should_ThrowException_When_AddingMultipleTimes_ToSameDictionary_And_ToSameError (line 99) | [Fact]
method Should_ThrowException_When_MessagesCollectionContainsNull (line 123) | [Fact]
method Should_ThrowException_When_NullMessagesCollection (line 140) | [Fact]
method Should_ThrowException_When_NullTranslationName (line 153) | [Fact]
class GetMessages (line 170) | public class GetMessages
method Should_GetMessages (line 172) | [Fact]
method Should_ThrowException_When_InvalidErrorId (line 198) | [Fact]
method Should_ThrowException_When_InvalidTranslationName (line 216) | [Fact]
method Should_ThrowException_When_NullTranslationName (line 234) | [Fact]
class GetMessageAmount (line 248) | public class GetMessageAmount
method Should_GetMessageAmount_Data (line 250) | public static IEnumerable<object[]> Should_GetMessageAmount_Data()
method Should_GetMessageAmount (line 337) | [Theory]
method Should_NotModifyList (line 353) | [Fact]
method Should_ThrowException_When_NullIdsList (line 386) | [Fact]
class AddMessageWithPathArgs (line 400) | public class AddMessageWithPathArgs
method Should_AddMessageWithPathArgs_MultipleErrors (line 402) | [Fact]
method Should_AddMessageWithPathArgs_MultiplePaths (line 428) | [Fact]
method Should_AddMessageWithPathArgs_MultipleTranslations (line 461) | [Fact]
method Should_AddMessageWithPathArgs_SingleError (line 503) | [Fact]
method Should_ThrowException_When_AddMultipleTimesToSameError (line 519) | [Fact]
method Should_ThrowException_When_NullMessages (line 540) | [Fact]
method Should_ThrowException_When_MessagesWithNull (line 553) | [Fact]
method Should_ThrowException_When_NullPath (line 570) | [Fact]
method Should_ThrowException_When_NullTranslationName (line 586) | [Fact]
class GetMessagesWithPathArgs (line 603) | public class GetMessagesWithPathArgs
method Should_GetMessagesWithPathArgs (line 605) | [Fact]
method Should_ThrowException_When_NullPath (line 627) | [Fact]
method Should_ThrowException_When_NullTranslation (line 642) | [Fact]
method Should_ThrowException_When_InvalidErrorId (line 657) | [Fact]
method Should_ThrowException_When_InvalidPath (line 672) | [Fact]
method Should_ThrowException_When_InvalidTranslation (line 687) | [Fact]
class IsMessageWithPathArgsCached (line 703) | public class IsMessageWithPathArgsCached
method Should_ThrowException_When_NullPath (line 705) | [Fact]
method Should_ThrowException_When_NullTranslation (line 720) | [Fact]
method Should_ReturnTrue_When_MessageIsCached (line 735) | [Fact]
method Should_ReturnFalse_When_MessageIsNotCached (line 759) | [Theory]
class AddIndexedPathPlaceholders (line 778) | public class AddIndexedPathPlaceholders
method Should_AddIndexedPathPlaceholders (line 780) | [Fact]
method Should_AddIndexedPathPlaceholders_Multiple (line 815) | [Fact]
method Should_ThrowException_AddingMultiple_ToSameTranslationAndError (line 907) | [Fact]
method Should_ThrowException_When_NullTranslation (line 947) | [Fact]
method Should_ThrowException_When_NullIndexedPlaceholders (line 971) | [Fact]
method Should_ThrowException_When_IndexedPlaceholders_WithNullPlaceholdersArray (line 981) | [Fact]
method Should_ThrowException_When_IndexedPlaceholders_WithNullPlaceholderInArray (line 1006) | [Fact]
method Should_ThrowException_When_IndexedPlaceholders_WithPlaceholder_WithNullValue_Data (line 1031) | public static IEnumerable<object[]> Should_ThrowException_When_Index...
method Should_ThrowException_When_IndexedPlaceholders_WithPlaceholder_WithNullValue (line 1088) | [Theory]
class GetIndexedPathPlaceholders (line 1106) | public class GetIndexedPathPlaceholders
method Should_GetIndexedPathPlaceholders (line 1108) | [Fact]
method Should_GetIndexedPathPlaceholders_DifferentTranslationNameAndError (line 1136) | [Fact]
method Should_ThrowException_When_InvalidErrorId (line 1203) | [Fact]
method Should_ThrowException_When_InvalidTranslationName (line 1231) | [Fact]
method Should_ThrowException_When_NullTranslationName (line 1259) | [Fact]
class VerifyIntegrity (line 1288) | public class VerifyIntegrity
method Should_BeValid_When_EmptyCache (line 1290) | [Fact]
method Should_BeValid_When_SingleError (line 1298) | [Fact]
method Should_BeValid_When_MultipleErrors (line 1312) | [Fact]
method Should_ThrowException_When_MultipleErrors_DifferentAmountOfMessages (line 1338) | [Fact]
method Should_ThrowException_When_ErrorIdNotInAllTranslations (line 1373) | [Fact]
method Should_BeValid_When_PathPlaceholders (line 1401) | [Fact]
method Should_ThrowException_When_PathPlaceholders_WithInvalidTranslation (line 1431) | [Fact]
method Should_ThrowException_When_PathPlaceholders_WithInvalidErrorId (line 1463) | [Fact]
method Should_ThrowException_When_PathPlaceholders_IndexExceedsMessagesAmount (line 1495) | [Fact]
method Should_ThrowException_When_MessageWithPathArgs_WithInvalidTranslation (line 1529) | [Fact]
method Should_ThrowException_When_MessageWithPathArgs_WithInvalidErrorId (line 1563) | [Fact]
method Should_ThrowException_When_MessageWithPathArgs_MaxMessagesAmountExceeded (line 1597) | [Fact]
method Should_BeValid_When_MessageWithPathArgs (line 1632) | [Fact]
method Should_BeValid_When_Placeholders_And_MessageWithPathArgs (line 1666) | [Fact]
method Should_Initialize (line 1749) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/MessageServiceTests.cs
class MessageServiceTests (line 14) | public class MessageServiceTests
method Should_Initialize (line 93) | [Fact]
method Should_Initialize_WithEmptyTranslations (line 99) | [Fact]
method Should_ThrowException_When_Initialize_With_Translations_Null (line 105) | [Fact]
method Should_ThrowException_When_Initialize_With_Translations_WithNull (line 113) | [Fact]
method Should_ThrowException_When_Initialize_With_Errors_Null (line 138) | [Fact]
method Should_ThrowException_When_Initialize_With_Errors_WithNull (line 146) | [Fact]
method Should_ThrowException_When_Initialize_With_Template_Null (line 224) | [Fact]
method Should_ThrowException_When_Initialize_With_Template_WithNull (line 232) | [Fact]
method Should_ThrowException_When_Initialize_With_Template_WithInvalidErrorId (line 253) | [Fact]
method Should_Load_TranslationNames (line 273) | [Fact]
class GetTranslation (line 285) | public class GetTranslation
method Should_GetTranslation (line 287) | [Fact]
method Should_ThrowException_When_InvalidTranslationName (line 311) | [Fact]
method Should_ThrowException_When_NullTranslationName (line 324) | [Fact]
class GetMessages (line 335) | public class GetMessages
method Should_ThrowException_When_Errors (line 337) | [Fact]
method Should_ThrowException_When_Errors_WithNullErrorsIds (line 347) | [Fact]
method Should_Get_EmptyDictionary_When_PathsWithoutMessages (line 366) | [Theory]
method Should_Get_EmptyDictionary_When_ErrorsWithoutMessages (line 387) | [Theory]
method Should_Get_EmptyDictionary_When_OutputWithoutMessages (line 408) | [Theory]
method Should_Get_From_SinglePath_When_SingleError (line 433) | [Fact]
method Should_Get_From_SinglePath_When_ManyErrors (line 456) | [Fact]
method Should_Get_From_SinglePathWithManyErrors_But_SingleError (line 482) | [Fact]
method Should_Get_From_ManyPaths (line 505) | [Fact]
method Should_Get_From_ManyPaths_SkippingPathsWithNoMessages (line 549) | [Fact]
method Should_Get_From_ManyPaths_SkippingErrorsWithNoMessages (line 597) | [Fact]
method Should_Get_From_ManyPaths_And_DifferentTranslations (line 658) | [Fact]
method Should_Get_With_EnglishTranslation_When_NoTranslationSpecified (line 716) | [Fact]
method Should_Get_With_ErrorsWithCustomMessages (line 750) | [Fact]
method Should_Get_With_TranslateArg (line 805) | [Fact]
method Should_Get_With_TranslateArg_And_LeaveKey_When_KeyIsInvalid (line 860) | [Fact]
method Should_Get_With_PathArgs (line 898) | [Fact]
method Should_Get_With_PathArgs_MixedWithOtherArgs (line 965) | [Fact]
method Should_Get_With_IndexesInPath (line 1016) | [Fact]
method Should_Get_With_IndexesInPath_With_SamePathWithDifferentIndexes (line 1074) | [Fact]
method Should_Get_With_IndexesInPath_With_PathArgs (line 1150) | [Fact]
method Should_Get_With_NotRegisteredPaths (line 1248) | [Fact]
method Should_Get_With_NotRegisteredPaths_With_PathArgs (line 1283) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/ReferenceLoopErrorTests.cs
class ReferenceLoopErrorTests (line 13) | public class ReferenceLoopErrorTests
method Should_Initialize (line 15) | [Fact]
FILE: tests/Validot.Tests.Unit/Errors/Translator/MessageTranslatorTests.cs
class MessageTranslatorTests (line 15) | public class MessageTranslatorTests
class TranslateMessagesWithPathPlaceholders (line 17) | public class TranslateMessagesWithPathPlaceholders
method Should_ThrowException_When_Path_IsNull (line 43) | [Fact]
method Should_ThrowException_When_ErrorMessages_IsNull (line 65) | [Fact]
method Should_ThrowException_When_NullIndexedPathHolders (line 81) | [Fact]
method Should_Translate_WithPathArgs (line 95) | [Fact]
method Should_Translate_WithPathArgs_WithParameters (line 135) | [Fact]
method Should_Translate_WithNameArg_Data (line 179) | public static IEnumerable<object[]> Should_Translate_WithNameArg_Data()
method Should_Translate_WithNameArg (line 187) | [Theory]
method Should_Translate_WithPathArgs_And_Leave_When_MissingPlaceholders (line 206) | [Fact]
method Should_Translate_WithPathArgs_And_Leave_When_InvalidPlaceholders (line 241) | [Fact]
class TranslateMessages (line 295) | public class TranslateMessages
method Should_ThrowException_When_NullTranslationName (line 297) | [Fact]
method Should_ThrowException_When_NullError (line 327) | [Fact]
method Should_ThrowException_When_TranslationNameNotFound (line 349) | [Fact]
method Should_ThrowException_When_Error_ContainsNullMessage (line 380) | [Fact]
method Should_Translate_UsingSelectedTranslation_When_KeyInTranslation (line 415) | [Fact]
method Should_Translate_ReturnSameMessage_When_KeyInTranslation (line 452) | [Fact]
method Should_Translate_UsingTranslationForExistingKeys_And_ReturnSameMessageForKeyInTranslation (line 489) | [Fact]
method Should_Translate_And_UseArgs (line 534) | [Fact]
method Should_Translate_And_UseArgs_WithParameters (line 577) | [Fact]
method Should_Translate_And_UseArgs_Special_Translation (line 611) | [Fact]
method Should_Translate_And_UseArgs_Special_Translation_Recursion (line 645) | [Fact]
method Should_Translate_And_ExtractPathPlaceholders (line 678) | [Fact]
method Should_ThrowException_When_Error_ContainsNullArg (line 739) | [Fact]
method Should_Initialize (line 775) | [Fact]
method Should_Set_TranslationNames (line 781) | [Fact]
method Should_Set_Translations (line 815) | [Fact]
method Should_Set_Translations_WithoutModification (line 837) | [Fact]
method Should_Set_TranslationArgs (line 874) | [Fact]
method Should_ThrowException_When_Initialize_With_NullEntryInTranslation (line 936) | [Fact]
method Should_ThrowException_When_Initialize_With_NullTranslations (line 956) | [Fact]
method Should_ThrowException_When_Initialize_With_SingleNullTranslations (line 964) | [Fact]
FILE: tests/Validot.Tests.Unit/Factory/HolderInfoTests.cs
class HolderInfoTests (line 10) | public class HolderInfoTests
method Should_Initialize (line 12) | [Fact]
method Constructor_Should_ThrowException_When_HolderTypeIsNull (line 18) | [Fact]
method Constructor_Should_ThrowException_When_SpecifiedTypeIsNull (line 26) | [Fact]
method Should_AssignTypes (line 34) | [Fact]
method Should_ValidatorType_BeSetAs_IValidatorOfSpecifiedType (line 43) | [Fact]
method Should_HoldsSettings_Should_BeFalse_When_HolderIsNotSettingsHolder (line 51) | [Fact]
method Should_HoldsSettings_Should_BeTrue_When_HolderIsSettingsHolder (line 59) | [Fact]
method Should_ThrowException_When_HolderTypeIsNotSpecificationHolderForSpecifiedType (line 67) | [Fact]
method Should_ThrowException_When_HolderTypeDoesntHaveDefaultConstructor (line 78) | [Fact]
method Should_ThrowException_When_HolderTypeIsNotClass (line 89) | [Fact]
method Should_CreateValidator_ReturnValidatorInitializedWithSpecification (line 100) | [Fact]
method Should_CreateValidator_ReturnValidatorInitializedWithSpecificationAndSettings (line 148) | [Fact]
method Should_CreateValidator_ReturnValidatorInitializedWithSpecification_When_HolderHoldsMultipleSpecifications (line 196) | [Fact]
method Should_CreateValidator_ReturnValidatorInitializedWithSpecificationAndSettings_When_HolderHoldsMultipleSpecifications (line 240) | [Fact]
class HolderWithoutDefaultConstructor (line 284) | internal class HolderWithoutDefaultConstructor : ISpecificationHolder<...
method HolderWithoutDefaultConstructor (line 286) | public HolderWithoutDefaultConstructor(string a)
class ObjectSpecificationHolder (line 294) | internal class ObjectSpecificationHolder : ISpecificationHolder<Custom...
class ObjectSpecificationAndSettingsHolder (line 305) | internal class ObjectSpecificationAndSettingsHolder : ISpecificationHo...
class MultipleSpecificationHolder (line 319) | internal class MultipleSpecificationHolder : ISpecificationHolder<int>...
class MultipleSpecificationAndSettingsHolder (line 326) | internal class MultipleSpecificationAndSettingsHolder : ISpecification...
class CustomClass (line 337) | internal class CustomClass
type CustomStruct (line 342) | internal struct CustomStruct
FILE: tests/Validot.Tests.Unit/Factory/ValidatorFactoryTests.cs
class ValidatorFactoryTests (line 17) | public class ValidatorFactoryTests
class ValidationWhenFromSpecification (line 19) | public class ValidationWhenFromSpecification
method Should_HaveTemplate (line 21) | [Theory]
method Should_Validate (line 32) | [Theory]
method Should_Validate_AndFailFast (line 43) | [Theory]
method Should_IsValid_Return_True_If_NoErrors (line 54) | [Theory]
class ValidationWhenFromHolder (line 66) | public class ValidationWhenFromHolder
method Should_HaveTemplate (line 68) | [Theory]
method Should_Validate (line 84) | [Theory]
method Should_Validate_AndFailFast (line 100) | [Theory]
method Should_IsValid_Return_True_If_NoErrors (line 116) | [Theory]
class SettingsFromInlineBuilder (line 133) | public class SettingsFromInlineBuilder
method Should_LockSettings (line 135) | [Fact]
method Should_SetSettings (line 143) | [Fact]
method Should_SetSettings_WhenSpecificationIsFromHolder (line 174) | [Fact]
method Should_ThrowException_When_PassingExternalSettings (line 210) | [Fact]
class SettingsFromHolder (line 220) | public class SettingsFromHolder
method Should_LockSettings (line 222) | [Fact]
method Should_LockSettings_When_OverridenByInlineBuilder (line 236) | [Fact]
method Should_SetSettings (line 250) | [Fact]
method Should_InlineSettings_Overwrite_SettingsFromHolder (line 284) | [Fact]
method Should_ThrowException_When_PassingExternalSettings_UsingHolder (line 322) | [Fact]
method Should_ThrowException_When_PassingExternalSettings_UsingHolder_AndInlineBuilder (line 337) | [Fact]
method Should_ThrowException_When_SpecificationHolder_IsNull (line 352) | [Fact]
method Should_ThrowException_When_SpecificationHolder_ContainsNullSpecification (line 360) | [Fact]
class SettingsFromObject (line 377) | public class SettingsFromObject
method Should_LockSettings (line 379) | [Fact]
method Should_SetSettings (line 395) | [Fact]
method Should_ThrowException_When_NullSettings (line 433) | [Fact]
method Should_ThrowException_When_CustomSettingsInterfaceImplementation (line 441) | [Fact]
class CustomSettings (line 451) | internal class CustomSettings : IValidatorSettings
class Translating (line 459) | public class Translating
method Should_WithTranslation_AddNewTranslations_AddingNamesWithDictionaries (line 461) | [Fact]
method Should_WithTranslation_AddNewTranslations_AddingFullDictionary (line 519) | [Fact]
method Should_WithTranslation_ChangeDefaultTranslation (line 588) | [Fact]
method Should_AddTranslationFromSettingsHolder (line 653) | [Fact]
method Should_AddTranslationFromSettingsHolder_AndModifyItByWithTranslationFromSettings (line 697) | [Fact]
class TestClassSpecificationAndTranslationHolder (line 758) | public class TestClassSpecificationAndTranslationHolder : ISpecifica...
class FetchHolders (line 766) | public class FetchHolders
method Should_FetchAllHoldersFromAssembly (line 768) | [Fact]
method Should_FetchAllHoldersFromMultipleAssemblies (line 795) | [Fact]
method Should_FetchAllHolders_And_CreateValidatorsOutOfThem (line 817) | [Fact]
method Should_FetchHolders_And_InitializeValidatorsWithSettings (line 896) | [Fact]
method Should_ThrowException_When_Assemblies_IsEmpty (line 915) | [Fact]
method Should_ThrowException_When_Assemblies_ContainsNull (line 925) | [Fact]
method Should_HaveDefaultSettings (line 934) | [Fact]
method Should_HaveDefaultSettingsLocked (line 942) | [Fact]
class TestClassSpecificationAndSettingsHolder (line 950) | public class TestClassSpecificationAndSettingsHolder : ISpecificationH...
class TestClassSpecificationHolder (line 957) | public class TestClassSpecificationHolder : ISpecificationHolder<Valid...
FILE: tests/Validot.Tests.Unit/GuardTests.cs
class GuardTests (line 9) | public class GuardTests
class NullArgument (line 11) | public class NullArgument
method Should_Throw_When_ArgumentIsNull (line 13) | [Fact]
FILE: tests/Validot.Tests.Unit/PathHelperTests.cs
class PathHelperTests (line 10) | public class PathHelperTests
method Should_Initialize (line 12) | [Fact]
class ResolvePath (line 20) | public class ResolvePath
method Should_ThrowException_When_NullBasePath (line 22) | [Fact]
method Should_ThrowException_When_NullRelativePath (line 30) | [Fact]
method Should_ReturnBasePath_When_RelativePathIsEmpty (line 38) | [Fact]
method Should_ReturnNewSegment_When_BasePathIsEmpty (line 46) | [Fact]
method Should_Resolve_When_RelativePathIsSimple (line 54) | [Theory]
method Should_Resolve_When_RelativePathContainsMoreLevelsDown (line 63) | [Theory]
method Should_Resolve_When_UncommonCharacters (line 72) | [Theory]
method Should_Resolve_When_RelativePathGoesLevelUp (line 81) | [Theory]
method Should_Resolve_When_RelativePathIsEmpty_And_GoesLevelUp (line 90) | [Theory]
method Should_ReturnNewSegment_When_RelativePathGoesLevelUp_And_ExceedsMinimumLevel (line 99) | [Theory]
method Should_ReturnNewSegment_When_ToSamePath (line 108) | [Theory]
class GetWithIndexes (line 118) | public class GetWithIndexes
method Should_ThrowException_When_NullIndexes (line 120) | [Fact]
method Should_ReturnSamePath_When_NoIndexes (line 128) | [Theory]
method Should_Resolve_CommonCases (line 143) | [Theory]
method Should_Resolve_TrickyCases (line 152) | [Theory]
method Should_Resolve_LargeIndexes (line 161) | [Theory]
method GetWithoutIndexes (line 171) | [Theory]
class ContainsIndexes (line 185) | public class ContainsIndexes
method Should_ThrowException_When_NullPath (line 187) | [Fact]
method Should_ReturnTrue_When_ResolvedIndexes (line 195) | [Theory]
method Should_ReturnTrue_When_PlaceholdersIndexes (line 206) | [Theory]
method Should_ReturnTrue_When_WeirdIndexes (line 217) | [Theory]
method Should_ReturnFalse_When_InvalidIndexes (line 228) | [Theory]
method Should_ReturnFalse_When_NoIndexes (line 237) | [Theory]
class GetIndexesAmount (line 247) | public class GetIndexesAmount
method Should_ThrowException_When_NullPath (line 249) | [Fact]
method Should_GetAmount_When_ResolvedIndexes (line 257) | [Theory]
method Should_GetAmount_When_PlaceholdersIndexes (line 266) | [Theory]
method Should_GetAmount_When_WeirdIndexes (line 275) | [Theory]
method Should_ReturnZero_When_InvalidIndexes (line 284) | [Theory]
method Should_ReturnZero_When_NoIndexes (line 293) | [Theory]
class GetLastLevel (line 303) | public class GetLastLevel
method Should_ThrowException_When_NullPath (line 305) | [Fact]
method Should_GetLastLevel (line 313) | [Theory]
class IsValidAsPath (line 329) | public class IsValidAsPath
method Should_ReturnFalse_When_NullPath (line 331) | [Fact]
method Should_ReturnTrue_For_ValidPaths (line 339) | [Theory]
method Should_ReturnFalse_For_InvalidPaths (line 348) | [Theory]
class NormalizePath (line 358) | public class NormalizePath
method Should_ReturnSingleSpace_When_NullPath (line 360) | [Fact]
method Should_NormalizeInvalidPaths (line 370) | [Theory]
method Should_LeaveAsIs_If_PathIsValid (line 382) | [Theory]
FILE: tests/Validot.Tests.Unit/PathTestData.cs
class PathTestData (line 8) | public class PathTestData
method InvalidPaths (line 10) | public static IEnumerable<object[]> InvalidPaths()
method ValidPaths (line 27) | public static IEnumerable<object[]> ValidPaths()
method ResolvePath_AllCases (line 39) | public static IEnumerable<object[]> ResolvePath_AllCases()
class ResolvePath (line 61) | public class ResolvePath
method ToSamePath (line 63) | public static IEnumerable<object[]> ToSamePath()
method SimpleRelativePath (line 70) | public static IEnumerable<object[]> SimpleRelativePath()
method RelativePathContainsMoreLevelsDown (line 76) | public static IEnumerable<object[]> RelativePathContainsMoreLevelsDo...
method UncommonCharacters (line 82) | public static IEnumerable<object[]> UncommonCharacters()
method RelativePathGoesLevelUp (line 94) | public static IEnumerable<object[]> RelativePathGoesLevelUp()
method RelativePathIsEmpty_And_GoesLevelUp (line 103) | public static IEnumerable<object[]> RelativePathIsEmpty_And_GoesLeve...
method RelativePathGoesLevelUp_And_ExceedsMinimumLevel (line 110) | public static IEnumerable<object[]> RelativePathGoesLevelUp_And_Exce...
method GetWithIndexes_AllCases (line 122) | public static IEnumerable<object[]> GetWithIndexes_AllCases()
class GetWithIndexes (line 140) | public class GetWithIndexes
method CommonCases (line 142) | public static IEnumerable<object[]> CommonCases()
method TrickyCases (line 153) | public static IEnumerable<object[]> TrickyCases()
method LargeIndexes (line 163) | public static IEnumerable<object[]> LargeIndexes()
method GetIndexesStack (line 176) | private static Stack<string> GetIndexesStack(int count, Func<int, in...
class GetIndexesAmount (line 189) | public class GetIndexesAmount
method NoIndexes (line 191) | public static IEnumerable<object[]> NoIndexes()
method InvalidIndexes (line 198) | public static IEnumerable<object[]> InvalidIndexes()
method WeirdIndexes (line 207) | public static IEnumerable<object[]> WeirdIndexes()
method ResolvedIndexes (line 214) | public static IEnumerable<object[]> ResolvedIndexes()
method PlaceholdersIndexes (line 225) | public static IEnumerable<object[]> PlaceholdersIndexes()
class NormalizePath (line 237) | public class NormalizePath
method DotsTrimmingAndSquashing (line 239) | public static IEnumerable<object[]> DotsTrimmingAndSquashing()
method TrimmingInitialAngleBracts (line 254) | public static IEnumerable<object[]> TrimmingInitialAngleBracts()
FILE: tests/Validot.Tests.Unit/Results/ValidationResultTests.cs
class ValidationResultTests (line 17) | public class ValidationResultTests
method Should_Initialize (line 19) | [Fact]
method AnyErrors_Should_BeFalse_When_NoErrors (line 25) | [Fact]
method AnyErrors_Should_BeTrue_When_ResultContainsErrors (line 33) | [Fact]
method NoErrorsResult_Should_BeResultWithoutErrors (line 44) | [Fact]
method Paths_Should_ReturnAllPaths_Data (line 58) | public static IEnumerable<object[]> Paths_Should_ReturnAllPaths_Data()
method Paths_Should_ReturnAllPaths (line 87) | [Theory]
class TranslationNames (line 102) | public class TranslationNames
method Should_Return_TranslationNames_FromMessageService (line 104) | [Fact]
method Should_Return_EmptyTranslationNames_When_NullTranslationName_InMessageService (line 122) | [Fact]
method Should_Return_EmptyTranslationNames_When_NullMessageService (line 134) | [Fact]
class GetTranslatedMessageMap (line 143) | public class GetTranslatedMessageMap
method Should_Return_Messages_FromMessageService_WithDefaultTranslation_WhenNullTranslationName (line 145) | [Fact]
method Should_Return_Messages_FromMessageService_WithSpecifiedTranslation (line 173) | [Fact]
method Should_Return_EmptyMessageMap_When_Valid (line 208) | [Fact]
class CodeMap (line 224) | public class CodeMap
method Should_Return_EmptyCodeMap_When_Valid (line 226) | [Fact]
method Should_Return_AllCodes (line 235) | [Fact]
method Should_Return_AllCodes_MoreExamples_Data (line 289) | public static IEnumerable<object[]> Should_Return_AllCodes_MoreExamp...
method Should_Return_AllCodes_MoreExamples (line 390) | [Theory]
class Codes (line 409) | public class Codes
method Should_ReturnAllCodesFromErrors_WithoutDuplicates (line 411) | [Fact]
method Should_ReturnAllCodesFromErrors_WithoutDuplicates_MoreExamples_Data (line 453) | public static IEnumerable<object[]> Should_ReturnAllCodesFromErrors_...
method Should_ReturnAllCodesFromErrors_WithoutDuplicates_MoreExamples (line 558) | [Theory]
method Should_ReturnEmptyList_When_Valid (line 571) | [Fact]
class GetErrorOutput (line 581) | public class GetErrorOutput
method Should_ReturnErrorOutput (line 583) | [Fact]
method Should_ReturnErrorOutput_MoreExamples_Data (line 618) | public static IEnumerable<object[]> Should_ReturnErrorOutput_MoreExa...
method Should_ReturnErrorOutput_MoreExamples (line 706) | [Theory]
method Should_ReturnEmptyDictionary_When_Valid (line 730) | [Fact]
class ToStringTests (line 742) | public class ToStringTests
method Should_Return_NoErrorsString_When_Valid (line 744) | [Fact]
method Should_Return_Messages_FromMessageService_WithDefaultTranslation (line 754) | [Fact]
method Should_Return_Messages_FromMessageService_WithDefaultTranslation_And_Codes (line 789) | [Fact]
method Should_Return_Messages_FromMessageService_WithSpecifiedTranslation (line 839) | [Fact]
method Should_Return_Messages_FromMessageService_WithSpecifiedTranslation_And_Codes (line 881) | [Fact]
method Should_Return_Codes (line 938) | [Fact]
method Should_Return_Codes_WithoutDuplicates (line 970) | [Fact]
FILE: tests/Validot.Tests.Unit/Rules/BoolRulesTests.cs
class BoolRulesTests (line 8) | public class BoolRulesTests
method True_Should_CollectError (line 10) | [Theory]
method NullableTrue_Should_CollectError (line 23) | [Theory]
method False_Should_CollectError (line 36) | [Theory]
method NullableFalse_Should_CollectError (line 48) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/CharRulesTests.cs
class CharRulesTests (line 8) | public class CharRulesTests
method EqualIgnoreCase_Should_CollectError (line 10) | [Theory]
method EqualIgnoreCase_Nullable_Should_CollectError (line 32) | [Theory]
method NotEqualIgnoreCase_Should_CollectError (line 54) | [Theory]
method NotEqualIgnoreCase_Nullable_Should_CollectError (line 76) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Collections/ArrayRulesTests.cs
class ArrayRulesTests (line 11) | public class ArrayRulesTests
method ExactCollectionSize_Should_CollectError_Data (line 15) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method ExactCollectionSize_Should_CollectError (line 20) | [Theory]
method ExactCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 32) | [Theory]
method NotEmptyCollection_Should_CollectError_Data (line 42) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method NotEmptyCollection_Should_CollectError (line 47) | [Theory]
method EmptyCollection_Should_CollectError_Data (line 58) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method EmptyCollection_Should_CollectError (line 63) | [Theory]
method MaxCollectionSize_Should_CollectError_Data (line 74) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MaxCollectionSize_Should_CollectError (line 79) | [Theory]
method MinCollectionSize_Should_CollectError_Data (line 91) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError (line 96) | [Theory]
method MinCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 108) | [Theory]
method MaxCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 118) | [Theory]
method CollectionSizeBetween_Should_CollectError_Data (line 128) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
method CollectionSizeBetween_Should_CollectError (line 133) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MaxCollectionSizeIsNegative (line 146) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinCollectionSizeIsNegative (line 156) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinLargerThanMax (line 166) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Collections/BaseCollectionRulesTests.cs
class BaseCollectionRulesTests (line 13) | public class BaseCollectionRulesTests
method ExactCollectionSize_Should_CollectError_Data (line 17) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method ExactCollectionSize_Should_CollectError (line 22) | [Theory]
method ExactCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 34) | [Theory]
method NotEmptyCollection_Should_CollectError_Data (line 44) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method NotEmptyCollection_Should_CollectError (line 49) | [Theory]
method EmptyCollection_Should_CollectError_Data (line 60) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method EmptyCollection_Should_CollectError (line 65) | [Theory]
method MaxCollectionSize_Should_CollectError_Data (line 76) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MaxCollectionSize_Should_CollectError (line 81) | [Theory]
method MinCollectionSize_Should_CollectError_Data (line 93) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError (line 98) | [Theory]
method MinCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 110) | [Theory]
method MaxCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 120) | [Theory]
method CollectionSizeBetween_Should_CollectError_Data (line 130) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
method CollectionSizeBetween_Should_CollectError (line 135) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MaxCollectionSizeIsNegative (line 148) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinCollectionSizeIsNegative (line 158) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinLargerThanMax (line 168) | [Theory]
class CustomCollection (line 179) | public class CustomCollection : IEnumerable<int>
method CustomCollection (line 183) | public CustomCollection(IEnumerable<int> source)
method GetEnumerator (line 188) | public IEnumerator<int> GetEnumerator()
method GetEnumerator (line 193) | IEnumerator IEnumerable.GetEnumerator()
FILE: tests/Validot.Tests.Unit/Rules/Collections/CollectionsTestData.cs
class CollectionsTestData (line 6) | public static class CollectionsTestData
method ExactCollectionSize_Should_CollectError_Data (line 8) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method NotEmptyCollection_Should_CollectError_Data (line 19) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method EmptyCollection_Should_CollectError_Data (line 27) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method MaxCollectionSize_Should_CollectError_Data (line 35) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError_Data (line 47) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method CollectionSizeBetween_Should_CollectError_Data (line 59) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
FILE: tests/Validot.Tests.Unit/Rules/Collections/IEnumerableRulesTests.cs
class IEnumerableRulesTests (line 11) | public class IEnumerableRulesTests
method ExactCollectionSize_Should_CollectError_Data (line 15) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method ExactCollectionSize_Should_CollectError (line 20) | [Theory]
method ExactCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 32) | [Theory]
method NotEmptyCollection_Should_CollectError_Data (line 42) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method NotEmptyCollection_Should_CollectError (line 47) | [Theory]
method EmptyCollection_Should_CollectError_Data (line 58) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method EmptyCollection_Should_CollectError (line 63) | [Theory]
method MaxCollectionSize_Should_CollectError_Data (line 74) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MaxCollectionSize_Should_CollectError (line 79) | [Theory]
method MinCollectionSize_Should_CollectError_Data (line 91) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError (line 96) | [Theory]
method MinCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 108) | [Theory]
method MaxCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 118) | [Theory]
method CollectionSizeBetween_Should_CollectError_Data (line 128) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
method CollectionSizeBetween_Should_CollectError (line 133) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MaxCollectionSizeIsNegative (line 146) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinCollectionSizeIsNegative (line 156) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinLargerThanMax (line 166) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Collections/IListRulesTests.cs
class IListRulesTests (line 12) | public class IListRulesTests
method ExactCollectionSize_Should_CollectError_Data (line 16) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method ExactCollectionSize_Should_CollectError (line 21) | [Theory]
method ExactCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 33) | [Theory]
method NotEmptyCollection_Should_CollectError_Data (line 43) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method NotEmptyCollection_Should_CollectError (line 48) | [Theory]
method EmptyCollection_Should_CollectError_Data (line 59) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method EmptyCollection_Should_CollectError (line 64) | [Theory]
method MaxCollectionSize_Should_CollectError_Data (line 75) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MaxCollectionSize_Should_CollectError (line 80) | [Theory]
method MinCollectionSize_Should_CollectError_Data (line 92) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError (line 97) | [Theory]
method MinCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 109) | [Theory]
method MaxCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 119) | [Theory]
method CollectionSizeBetween_Should_CollectError_Data (line 129) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
method CollectionSizeBetween_Should_CollectError (line 134) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MaxCollectionSizeIsNegative (line 147) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinCollectionSizeIsNegative (line 157) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinLargerThanMax (line 167) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Collections/IReadOnlyCollectionRulesTests.cs
class IReadOnlyCollectionRulesTests (line 12) | public class IReadOnlyCollectionRulesTests
method ExactCollectionSize_Should_CollectError_Data (line 16) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method ExactCollectionSize_Should_CollectError (line 21) | [Theory]
method ExactCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 33) | [Theory]
method NotEmptyCollection_Should_CollectError_Data (line 43) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method NotEmptyCollection_Should_CollectError (line 48) | [Theory]
method EmptyCollection_Should_CollectError_Data (line 59) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method EmptyCollection_Should_CollectError (line 64) | [Theory]
method MaxCollectionSize_Should_CollectError_Data (line 75) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MaxCollectionSize_Should_CollectError (line 80) | [Theory]
method MinCollectionSize_Should_CollectError_Data (line 92) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError (line 97) | [Theory]
method MinCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 109) | [Theory]
method MaxCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 119) | [Theory]
method CollectionSizeBetween_Should_CollectError_Data (line 129) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
method CollectionSizeBetween_Should_CollectError (line 134) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MaxCollectionSizeIsNegative (line 147) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinCollectionSizeIsNegative (line 157) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinLargerThanMax (line 167) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Collections/IReadOnlyListRulesTests.cs
class IReadOnlyListRulesTests (line 12) | public class IReadOnlyListRulesTests
method ExactCollectionSize_Should_CollectError_Data (line 16) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method ExactCollectionSize_Should_CollectError (line 21) | [Theory]
method ExactCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 33) | [Theory]
method NotEmptyCollection_Should_CollectError_Data (line 43) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method NotEmptyCollection_Should_CollectError (line 48) | [Theory]
method EmptyCollection_Should_CollectError_Data (line 59) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method EmptyCollection_Should_CollectError (line 64) | [Theory]
method MaxCollectionSize_Should_CollectError_Data (line 75) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MaxCollectionSize_Should_CollectError (line 80) | [Theory]
method MinCollectionSize_Should_CollectError_Data (line 92) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError (line 97) | [Theory]
method MinCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 109) | [Theory]
method MaxCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 119) | [Theory]
method CollectionSizeBetween_Should_CollectError_Data (line 129) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
method CollectionSizeBetween_Should_CollectError (line 134) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MaxCollectionSizeIsNegative (line 147) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinCollectionSizeIsNegative (line 157) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinLargerThanMax (line 167) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Collections/ListRulesTests.cs
class ListRulesTests (line 12) | public class ListRulesTests
method ExactCollectionSize_Should_CollectError_Data (line 16) | public static IEnumerable<object[]> ExactCollectionSize_Should_Collect...
method ExactCollectionSize_Should_CollectError (line 21) | [Theory]
method ExactCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 33) | [Theory]
method NotEmptyCollection_Should_CollectError_Data (line 43) | public static IEnumerable<object[]> NotEmptyCollection_Should_CollectE...
method NotEmptyCollection_Should_CollectError (line 48) | [Theory]
method EmptyCollection_Should_CollectError_Data (line 59) | public static IEnumerable<object[]> EmptyCollection_Should_CollectErro...
method EmptyCollection_Should_CollectError (line 64) | [Theory]
method MaxCollectionSize_Should_CollectError_Data (line 75) | public static IEnumerable<object[]> MaxCollectionSize_Should_CollectEr...
method MaxCollectionSize_Should_CollectError (line 80) | [Theory]
method MinCollectionSize_Should_CollectError_Data (line 92) | public static IEnumerable<object[]> MinCollectionSize_Should_CollectEr...
method MinCollectionSize_Should_CollectError (line 97) | [Theory]
method MinCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 109) | [Theory]
method MaxCollectionSize_Should_ThrowException_When_NegativeCollectionSize (line 119) | [Theory]
method CollectionSizeBetween_Should_CollectError_Data (line 129) | public static IEnumerable<object[]> CollectionSizeBetween_Should_Colle...
method CollectionSizeBetween_Should_CollectError (line 134) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MaxCollectionSizeIsNegative (line 147) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinCollectionSizeIsNegative (line 157) | [Theory]
method CollectionSizeBetween_Should_ThrowException_When_MinLargerThanMax (line 167) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/GuidRulesTests.cs
class GuidRulesTests (line 12) | public class GuidRulesTests
method EqualTo_Should_CollectError_Data (line 14) | public static IEnumerable<object[]> EqualTo_Should_CollectError_Data()
method EqualTo_Should_CollectError (line 20) | [Theory]
method EqualTo_Should_CollectError_FromNullable (line 32) | [Theory]
method NotEqualTo_Should_CollectError_Data (line 44) | public static IEnumerable<object[]> NotEqualTo_Should_CollectError_Data()
method NotEqualTo_Should_CollectError (line 50) | [Theory]
method NotEqualTo_Should_CollectError_FromNullable (line 62) | [Theory]
method NotEmpty_Should_CollectError_Data (line 74) | public static IEnumerable<object[]> NotEmpty_Should_CollectError_Data()
method NotEmpty_Should_CollectError (line 81) | [Theory]
method NotEmpty_Should_CollectError_FromNullable (line 92) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Numbers/ByteRulesTests.cs
class ByteRulesTests (line 11) | public class ByteRulesTests
method EqualTo_Should_CollectError_Data (line 15) | public static IEnumerable<object[]> EqualTo_Should_CollectError_Data()
method EqualTo_Should_CollectError (line 22) | [Theory]
method EqualTo_Should_CollectError_FromNullable (line 34) | [Theory]
method NotEqualTo_Should_CollectError_Data (line 46) | public static IEnumerable<object[]> NotEqualTo_Should_CollectError_Data()
method NotEqualTo_Should_CollectError (line 53) | [Theory]
method NotEqualTo_Should_CollectError_FromNullable (line 65) | [Theory]
method GreaterThan_Should_CollectError_Data (line 77) | public static IEnumerable<object[]> GreaterThan_Should_CollectError_Da...
method GreaterThan_Should_CollectError (line 84) | [Theory]
method GreaterThan_Should_CollectError_FromNullable (line 96) | [Theory]
method GreaterThanOrEqualTo_Should_CollectError_Data (line 108) | public static IEnumerable<object[]> GreaterThanOrEqualTo_Should_Collec...
method GreaterThanOrEqualTo_Should_CollectError (line 115) | [Theory]
method GreaterThanOrEqualTo_Should_CollectError_FromNullable (line 127) | [Theory]
method LessThan_Should_CollectError_Data (line 139) | public static IEnumerable<object[]> LessThan_Should_CollectError_Data()
method LessThan_Should_CollectError (line 146) | [Theory]
method LessThan_Should_CollectError_FromNullable (line 158) | [Theory]
method LessThanOrEqualTo_Should_CollectError_Data (line 170) | public static IEnumerable<object[]> LessThanOrEqualTo_Should_CollectEr...
method LessThanOrEqualTo_Should_CollectError (line 177) | [Theory]
method LessThanOrEqualTo_Should_CollectError_FromNullable (line 189) | [Theory]
method Between_Should_CollectError_Data (line 201) | public static IEnumerable<object[]> Between_Should_CollectError_Data()
method Between_Should_CollectError (line 208) | [Theory]
method Between_Should_CollectError_FromNullable (line 221) | [Theory]
method Between_Should_ThrowException_When_MinLargerThanMax_Data (line 234) | public static IEnumerable<object[]> Between_Should_ThrowException_When...
method Between_Should_ThrowException_When_MinLargerThanMax (line 240) | [Theory]
method Between_Should_ThrowException_When_MinLargerThanMax_FromNullable (line 249) | [Theory]
method BetweenOrEqualTo_Should_CollectError_Data (line 258) | public static IEnumerable<object[]> BetweenOrEqualTo_Should_CollectErr...
method BetweenOrEqualTo_Should_CollectError (line 265) | [Theory]
method BetweenOrEqualTo_Should_CollectError_FromNullable (line 278) | [Theory]
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax_Data (line 291) | public static IEnumerable<object[]> BetweenOrEqualTo_Should_ThrowExcep...
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax (line 297) | [Theory]
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax_FromNullable (line 306) | [Theory]
method NonZero_Should_CollectError_Data (line 315) | public static IEnumerable<object[]> NonZero_Should_CollectError_Data()
method NonZero_Should_CollectError (line 322) | [Theory]
method NonZero_Should_CollectError_FromNullable (line 333) | [Theory]
method Positive_Should_CollectError_Data (line 344) | public static IEnumerable<object[]> Positive_Should_CollectError_Data()
method Positive_Should_CollectError (line 350) | [Theory]
method Positive_Should_CollectError_FromNullable (line 361) | [Theory]
method NonPositive_Should_CollectError_Data (line 372) | public static IEnumerable<object[]> NonPositive_Should_CollectError_Da...
method NonPositive_Should_CollectError (line 378) | [Theory]
method NonPositive_Should_CollectError_FromNullable (line 389) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Numbers/CharNumbersRulesTests.cs
class CharNumbersRulesTests (line 11) | public class CharNumbersRulesTests
method EqualTo_Should_CollectError_Data (line 15) | public static IEnumerable<object[]> EqualTo_Should_CollectError_Data()
method EqualTo_Should_CollectError (line 22) | [Theory]
method EqualTo_Should_CollectError_FromNullable (line 34) | [Theory]
method NotEqualTo_Should_CollectError_Data (line 46) | public static IEnumerable<object[]> NotEqualTo_Should_CollectError_Data()
method NotEqualTo_Should_CollectError (line 53) | [Theory]
method NotEqualTo_Should_CollectError_FromNullable (line 65) | [Theory]
method GreaterThan_Should_CollectError_Data (line 77) | public static IEnumerable<object[]> GreaterThan_Should_CollectError_Da...
method GreaterThan_Should_CollectError (line 84) | [Theory]
method GreaterThan_Should_CollectError_FromNullable (line 96) | [Theory]
method GreaterThanOrEqualTo_Should_CollectError_Data (line 108) | public static IEnumerable<object[]> GreaterThanOrEqualTo_Should_Collec...
method GreaterThanOrEqualTo_Should_CollectError (line 115) | [Theory]
method GreaterThanOrEqualTo_Should_CollectError_FromNullable (line 127) | [Theory]
method LessThan_Should_CollectError_Data (line 139) | public static IEnumerable<object[]> LessThan_Should_CollectError_Data()
method LessThan_Should_CollectError (line 146) | [Theory]
method LessThan_Should_CollectError_FromNullable (line 158) | [Theory]
method LessThanOrEqualTo_Should_CollectError_Data (line 170) | public static IEnumerable<object[]> LessThanOrEqualTo_Should_CollectEr...
method LessThanOrEqualTo_Should_CollectError (line 177) | [Theory]
method LessThanOrEqualTo_Should_CollectError_FromNullable (line 189) | [Theory]
method Between_Should_CollectError_Data (line 201) | public static IEnumerable<object[]> Between_Should_CollectError_Data()
method Between_Should_CollectError (line 208) | [Theory]
method Between_Should_CollectError_FromNullable (line 221) | [Theory]
method Between_Should_ThrowException_When_MinLargerThanMax_Data (line 234) | public static IEnumerable<object[]> Between_Should_ThrowException_When...
method Between_Should_ThrowException_When_MinLargerThanMax (line 240) | [Theory]
method Between_Should_ThrowException_When_MinLargerThanMax_FromNullable (line 249) | [Theory]
method BetweenOrEqualTo_Should_CollectError_Data (line 258) | public static IEnumerable<object[]> BetweenOrEqualTo_Should_CollectErr...
method BetweenOrEqualTo_Should_CollectError (line 265) | [Theory]
method BetweenOrEqualTo_Should_CollectError_FromNullable (line 278) | [Theory]
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax_Data (line 291) | public static IEnumerable<object[]> BetweenOrEqualTo_Should_ThrowExcep...
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax (line 297) | [Theory]
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax_FromNullable (line 306) | [Theory]
method NonZero_Should_CollectError_Data (line 315) | public static IEnumerable<object[]> NonZero_Should_CollectError_Data()
method NonZero_Should_CollectError (line 322) | [Theory]
method NonZero_Should_CollectError_FromNullable (line 333) | [Theory]
method Positive_Should_CollectError_Data (line 344) | public static IEnumerable<object[]> Positive_Should_CollectError_Data()
method Positive_Should_CollectError (line 350) | [Theory]
method Positive_Should_CollectError_FromNullable (line 361) | [Theory]
method NonPositive_Should_CollectError_Data (line 372) | public static IEnumerable<object[]> NonPositive_Should_CollectError_Da...
method NonPositive_Should_CollectError (line 378) | [Theory]
method NonPositive_Should_CollectError_FromNullable (line 389) | [Theory]
FILE: tests/Validot.Tests.Unit/Rules/Numbers/DecimalRulesTests.cs
class DecimalRulesTests (line 11) | public class DecimalRulesTests
method EqualTo_Should_CollectError_Data (line 15) | public static IEnumerable<object[]> EqualTo_Should_CollectError_Data()
method EqualTo_Should_CollectError (line 23) | [Theory]
method EqualTo_Should_CollectError_FromNullable (line 35) | [Theory]
method NotEqualTo_Should_CollectError_Data (line 47) | public static IEnumerable<object[]> NotEqualTo_Should_CollectError_Data()
method NotEqualTo_Should_CollectError (line 55) | [Theory]
method NotEqualTo_Should_CollectError_FromNullable (line 67) | [Theory]
method GreaterThan_Should_CollectError_Data (line 79) | public static IEnumerable<object[]> GreaterThan_Should_CollectError_Da...
method GreaterThan_Should_CollectError (line 87) | [Theory]
method GreaterThan_Should_CollectError_FromNullable (line 99) | [Theory]
method GreaterThanOrEqualTo_Should_CollectError_Data (line 111) | public static IEnumerable<object[]> GreaterThanOrEqualTo_Should_Collec...
method GreaterThanOrEqualTo_Should_CollectError (line 119) | [Theory]
method GreaterThanOrEqualTo_Should_CollectError_FromNullable (line 131) | [Theory]
method LessThan_Should_CollectError_Data (line 143) | public static IEnumerable<object[]> LessThan_Should_CollectError_Data()
method LessThan_Should_CollectError (line 151) | [Theory]
method LessThan_Should_CollectError_FromNullable (line 163) | [Theory]
method LessThanOrEqualTo_Should_CollectError_Data (line 175) | public static IEnumerable<object[]> LessThanOrEqualTo_Should_CollectEr...
method LessThanOrEqualTo_Should_CollectError (line 183) | [Theory]
method LessThanOrEqualTo_Should_CollectError_FromNullable (line 195) | [Theory]
method Between_Should_CollectError_Data (line 207) | public static IEnumerable<object[]> Between_Should_CollectError_Data()
method Between_Should_CollectError (line 215) | [Theory]
method Between_Should_CollectError_FromNullable (line 228) | [Theory]
method Between_Should_ThrowException_When_MinLargerThanMax_Data (line 241) | public static IEnumerable<object[]> Between_Should_ThrowException_When...
method Between_Should_ThrowException_When_MinLargerThanMax (line 247) | [Theory]
method Between_Should_ThrowException_When_MinLargerThanMax_FromNullable (line 256) | [Theory]
method BetweenOrEqualTo_Should_CollectError_Data (line 265) | public static IEnumerable<object[]> BetweenOrEqualTo_Should_CollectErr...
method BetweenOrEqualTo_Should_CollectError (line 273) | [Theory]
method BetweenOrEqualTo_Should_CollectError_FromNullable (line 286) | [Theory]
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax_Data (line 299) | public static IEnumerable<object[]> BetweenOrEqualTo_Should_ThrowExcep...
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMax (line 305) | [Theory]
method BetweenOrEqualTo_Should_ThrowException_When_MinLargerThanMa
Condensed preview — 389 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,004K chars).
[
{
"path": ".editorconfig",
"chars": 11463,
"preview": "# Remove the line below if you want to inherit .editorconfig settings from higher directories\nroot = true\n\n# C# files\n[*"
},
{
"path": ".github/CODEOWNERS",
"chars": 25,
"preview": "* bartosz@lenar.dev"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 1119,
"preview": "---\nname: Bug report\nabout: Create a report to help improve the the Validot project\ntitle: \"\"\nlabels: bug\nassignees: bar"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 205,
"preview": "blank_issues_enabled: false\ncontact_links:\n - name: Validot on StackOverflow\n url: https://stackoverflow.com/questio"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 900,
"preview": "---\nname: Feature request\nabout: Suggest an idea for the Validot project\ntitle: \"\"\nlabels: enhancement\nassignees: bartos"
},
{
"path": ".github/README.md",
"chars": 27409,
"preview": "<h1 align=\"center\">\n <br />\n <img src=\"../assets/logo/validot-logo.svg\" height=\"256px\" width=\"256px\" />\n <br />\n V"
},
{
"path": ".github/pull_request_template.md",
"chars": 1245,
"preview": "<!--\nPlease read the CONTRIBUTING document (url: https://github.com/bartoszlenar/Validot/blob/main/docs/CONTRIBUTING.md)"
},
{
"path": ".github/workflows/CI.yml",
"chars": 8177,
"preview": "name: CI\n\non:\n push:\n branches-ignore:\n - \"wip/**\"\n pull_request:\n branches-ignore:\n - \"wip/**\"\n rele"
},
{
"path": ".github/workflows/Init-WorkflowVariables.ps1",
"chars": 809,
"preview": "$commitShortSha = $env:GITHUB_SHA.Substring(0, 7)\n\nif ($env:GITHUB_EVENT_NAME.Equals(\"release\")) {\n\n $tag = $env:GITH"
},
{
"path": ".gitignore",
"chars": 6219,
"preview": "# Created by https://www.gitignore.io/api/csharp\n# Edit at https://www.gitignore.io/?templates=csharp\n\n### Csharp ###\n##"
},
{
"path": ".nuke/build.schema.json",
"chars": 5128,
"preview": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"$ref\": \"#/definitions/build\",\n \"title\": \"Build Schema\",\n "
},
{
"path": ".nuke/parameters.json",
"chars": 68,
"preview": "{\n \"$schema\": \"./build.schema.json\",\n \"Solution\": \"Validot.sln\"\n}\n"
},
{
"path": "LICENSE",
"chars": 1075,
"preview": "MIT License\n\nCopyright (c) 2020-2021 Bartosz Lenar\n\nPermission is hereby granted, free of charge, to any person obtainin"
},
{
"path": "Validot.sln",
"chars": 8475,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26124.0\nMini"
},
{
"path": "build/.editorconfig",
"chars": 837,
"preview": "[*.cs]\ndotnet_style_qualification_for_field = false:warning\ndotnet_style_qualification_for_property = false:warning\ndotn"
},
{
"path": "build/Build.cs",
"chars": 20205,
"preview": "#pragma warning disable SYSLIB1045 // Convert to 'GeneratedRegexAttribute'.\r\n#pragma warning disable IDE0057 // Use rang"
},
{
"path": "build/Configuration.cs",
"chars": 484,
"preview": "using System;\nusing System.ComponentModel;\nusing System.Linq;\nusing Nuke.Common.Tooling;\n\n[TypeConverter(typeof(TypeConv"
},
{
"path": "build/_build.csproj",
"chars": 474,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <OutputType>Exe</OutputType>\n <TargetFramework>net8.0</Targe"
},
{
"path": "build/_build.csproj.DotSettings",
"chars": 4767,
"preview": "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namesp"
},
{
"path": "build.cmd",
"chars": 207,
"preview": ":; set -eo pipefail\n:; SCRIPT_DIR=$(cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd)\n:; ${SCRIPT_DIR}/build.sh \"$@\"\n:; exit"
},
{
"path": "build.ps1",
"chars": 3298,
"preview": "[CmdletBinding()]\r\nParam(\r\n [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]\r\n [string[]"
},
{
"path": "build.sh",
"chars": 2627,
"preview": "#!/usr/bin/env bash\n\nbash --version 2>&1 | head -n 1\n\nset -eo pipefail\nSCRIPT_DIR=$(cd \"$( dirname \"${BASH_SOURCE[0]}\" )"
},
{
"path": "docs/CHANGELOG.md",
"chars": 5783,
"preview": "# Changelog\nAll notable changes to the [Validot project](https://github.com/bartoszlenar/Validot) will be documented in "
},
{
"path": "docs/CONTRIBUTING.md",
"chars": 3421,
"preview": "# Contributing\n\nIf you're reading this file, it means that you are - more or less - interested in contributing to the pr"
},
{
"path": "docs/DOCUMENTATION.md",
"chars": 221623,
"preview": "# Documentation\n\n## Table of contents\n\n- [Documentation](#documentation)\n - [Table of contents](#table-of-contents)\n -"
},
{
"path": "docs/articles/crafting-model-specifications-using-validot.md",
"chars": 28850,
"preview": "---\ntitle: Crafting model specifications using Validot\ndate: 2022-09-26 06:00:00\n---\n\nThe Validot project comes with com"
},
{
"path": "docs/articles/validots-performance-explained.md",
"chars": 16876,
"preview": "---\ntitle: Validot's performance explained\ndate: 2020-10-07 06:00:00\n---\n\n## A three-layer cake\n\nThe road to achieving t"
},
{
"path": "nuget.config",
"chars": 190,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n <packageSources>\n <add key=\"nuget.org\" value=\"https://"
},
{
"path": "src/Validot/CodeHelper.cs",
"chars": 327,
"preview": "namespace Validot\n{\n using System.Linq;\n\n internal static class CodeHelper\n {\n public static bool IsCode"
},
{
"path": "src/Validot/Errors/Args/ArgHelper.cs",
"chars": 4922,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n using System.Text;\r"
},
{
"path": "src/Validot/Errors/Args/ArgPlaceholder.cs",
"chars": 304,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System.Collections.Generic;\r\n\r\n public sealed class ArgPlaceholder\r\n {"
},
{
"path": "src/Validot/Errors/Args/EnumArg.cs",
"chars": 1526,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n public sealed class E"
},
{
"path": "src/Validot/Errors/Args/EnumArgFactory.cs",
"chars": 269,
"preview": "namespace Validot\r\n{\r\n using Validot.Errors.Args;\r\n\r\n public static partial class Arg\r\n {\r\n public stati"
},
{
"path": "src/Validot/Errors/Args/GuidArg.cs",
"chars": 2129,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Globalizati"
},
{
"path": "src/Validot/Errors/Args/GuidArgFactory.cs",
"chars": 262,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Errors.Args;\r\n\r\n public static partial class Arg\r\n {\r"
},
{
"path": "src/Validot/Errors/Args/IArg.cs",
"chars": 374,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System.Collections.Generic;\r\n\r\n public interface IArg\r\n {\r\n str"
},
{
"path": "src/Validot/Errors/Args/NameArg.cs",
"chars": 3487,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Globalizat"
},
{
"path": "src/Validot/Errors/Args/NumberArg.cs",
"chars": 2094,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Globalizati"
},
{
"path": "src/Validot/Errors/Args/NumberArgFactory.cs",
"chars": 2317,
"preview": "namespace Validot\r\n{\r\n using Validot.Errors.Args;\r\n\r\n public static partial class Arg\r\n {\r\n public stati"
},
{
"path": "src/Validot/Errors/Args/TextArg.cs",
"chars": 2039,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System.Collections.Generic;\r\n using System.Globalization;\r\n\r\n public "
},
{
"path": "src/Validot/Errors/Args/TextArgFactory.cs",
"chars": 366,
"preview": "namespace Validot\r\n{\r\n using Validot.Errors.Args;\r\n\r\n public static partial class Arg\r\n {\r\n public stati"
},
{
"path": "src/Validot/Errors/Args/TimeArg.cs",
"chars": 2094,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Globalizati"
},
{
"path": "src/Validot/Errors/Args/TimeArgFactory.cs",
"chars": 1038,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Errors.Args;\r\n\r\n public static partial class Arg\r\n {\r"
},
{
"path": "src/Validot/Errors/Args/TranslationArg.cs",
"chars": 1428,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System.Collections.Generic;\r\n\r\n public sealed class TranslationArg : IArg"
},
{
"path": "src/Validot/Errors/Args/TypeArg.cs",
"chars": 1867,
"preview": "namespace Validot.Errors.Args\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n public sealed class Ty"
},
{
"path": "src/Validot/Errors/Args/TypeArgFactory.cs",
"chars": 257,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Errors.Args;\r\n\r\n public static partial class Arg\r\n {\r"
},
{
"path": "src/Validot/Errors/CacheIntegrityException.cs",
"chars": 221,
"preview": "namespace Validot.Errors\r\n{\r\n public sealed class CacheIntegrityException : ValidotException\r\n {\r\n public C"
},
{
"path": "src/Validot/Errors/Error.cs",
"chars": 334,
"preview": "namespace Validot.Errors\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Errors.Args;\r\n\r\n internal cla"
},
{
"path": "src/Validot/Errors/IError.cs",
"chars": 292,
"preview": "namespace Validot.Errors\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Errors.Args;\r\n\r\n public inter"
},
{
"path": "src/Validot/Errors/IMessageService.cs",
"chars": 415,
"preview": "namespace Validot.Errors\r\n{\r\n using System.Collections.Generic;\r\n\r\n internal interface IMessageService\r\n {\r\n "
},
{
"path": "src/Validot/Errors/MessageCache.cs",
"chars": 9049,
"preview": "namespace Validot.Errors\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n\r\n usi"
},
{
"path": "src/Validot/Errors/MessageService.cs",
"chars": 5620,
"preview": "namespace Validot.Errors\r\n{\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n\r\n using Validot.Errors.T"
},
{
"path": "src/Validot/Errors/ReferenceLoopError.cs",
"chars": 709,
"preview": "namespace Validot.Errors\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using Validot.Errors.Args;\r"
},
{
"path": "src/Validot/Errors/Translator/MessageTranslator.cs",
"chars": 5890,
"preview": "namespace Validot.Errors.Translator\r\n{\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n\r\n using Valid"
},
{
"path": "src/Validot/Errors/Translator/TranslationResult.cs",
"chars": 459,
"preview": "namespace Validot.Errors.Translator\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Errors.Args;\r\n\r\n i"
},
{
"path": "src/Validot/Factory/HolderInfo.cs",
"chars": 4744,
"preview": "namespace Validot.Factory\r\n{\r\n using System;\r\n using System.Linq;\r\n\r\n using Validot.Settings;\r\n\r\n /// <summa"
},
{
"path": "src/Validot/Factory/ISettingsHolder.cs",
"chars": 205,
"preview": "namespace Validot.Factory\r\n{\r\n using System;\r\n\r\n using Validot.Settings;\r\n\r\n public interface ISettingsHolder\r\n"
},
{
"path": "src/Validot/Factory/ISpecificationHolder.cs",
"chars": 472,
"preview": "namespace Validot\r\n{\r\n /// <summary>\r\n /// Holds specification for the models of type <typeparamref name=\"T\"/>.\r\n "
},
{
"path": "src/Validot/Factory/ValidatorFactory.cs",
"chars": 9236,
"preview": "namespace Validot.Factory\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n usin"
},
{
"path": "src/Validot/IValidator.cs",
"chars": 2720,
"preview": "namespace Validot\r\n{\r\n using Validot.Results;\r\n using Validot.Settings;\r\n\r\n /// <summary>\r\n /// Validator va"
},
{
"path": "src/Validot/PathHelper.cs",
"chars": 6216,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Text;\r\n using System"
},
{
"path": "src/Validot/Properties/AssemblyInfo.cs",
"chars": 517,
"preview": "[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Validot.Tests.Unit\")]\n[assembly: System.Runtime.CompilerS"
},
{
"path": "src/Validot/Results/IValidationResult.cs",
"chars": 4304,
"preview": "namespace Validot.Results\r\n{\r\n using System.Collections.Generic;\r\n\r\n /// <summary>\r\n /// Object that contains f"
},
{
"path": "src/Validot/Results/ValidationResult.cs",
"chars": 9296,
"preview": "namespace Validot.Results\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n usin"
},
{
"path": "src/Validot/Rules/BoolRules.cs",
"chars": 831,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class BoolR"
},
{
"path": "src/Validot/Rules/CharRules.cs",
"chars": 1851,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Globalization;\r\n\r\n using Validot.Specification;\r\n using "
},
{
"path": "src/Validot/Rules/Collections/ArrayRules.cs",
"chars": 1273,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n\r\n public static class ArrayRules\r\n {\r\n public stat"
},
{
"path": "src/Validot/Rules/Collections/BaseCollectionRules.cs",
"chars": 2739,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n\r\n using Validot.Specification;\r"
},
{
"path": "src/Validot/Rules/Collections/IEnumerableRules.cs",
"chars": 1518,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n\r\n public static cla"
},
{
"path": "src/Validot/Rules/Collections/IListRules.cs",
"chars": 1404,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n\r\n public static cla"
},
{
"path": "src/Validot/Rules/Collections/IReadOnlyCollectionRules.cs",
"chars": 1670,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n\r\n public static cla"
},
{
"path": "src/Validot/Rules/Collections/IReadOnlyListRules.cs",
"chars": 1556,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n\r\n public static cla"
},
{
"path": "src/Validot/Rules/Collections/ListRules.cs",
"chars": 1385,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n\r\n public static cla"
},
{
"path": "src/Validot/Rules/GuidRules.cs",
"chars": 1506,
"preview": "namespace Validot.Rules\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n "
},
{
"path": "src/Validot/Rules/Numbers/ByteRules.cs",
"chars": 5525,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class ByteR"
},
{
"path": "src/Validot/Rules/Numbers/CharNumbersRules.cs",
"chars": 5532,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class CharN"
},
{
"path": "src/Validot/Rules/Numbers/DecimalRules.cs",
"chars": 6486,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class Decim"
},
{
"path": "src/Validot/Rules/Numbers/DoubleRules.cs",
"chars": 5757,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n publ"
},
{
"path": "src/Validot/Rules/Numbers/FloatRules.cs",
"chars": 5689,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n publ"
},
{
"path": "src/Validot/Rules/Numbers/IntRules.cs",
"chars": 6194,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class IntRu"
},
{
"path": "src/Validot/Rules/Numbers/LongRules.cs",
"chars": 6267,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class LongR"
},
{
"path": "src/Validot/Rules/Numbers/SByteRules.cs",
"chars": 6340,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class SByte"
},
{
"path": "src/Validot/Rules/Numbers/ShortRules.cs",
"chars": 6340,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class Short"
},
{
"path": "src/Validot/Rules/Numbers/UIntRules.cs",
"chars": 5525,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class UIntR"
},
{
"path": "src/Validot/Rules/Numbers/ULongRules.cs",
"chars": 5590,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class ULong"
},
{
"path": "src/Validot/Rules/Numbers/UShortRules.cs",
"chars": 5655,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n public static class UShor"
},
{
"path": "src/Validot/Rules/Text/EmailRules.cs",
"chars": 3214,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Globalization;\r\n using System.Text.RegularExpressions;\r\n\r\n "
},
{
"path": "src/Validot/Rules/Text/EmailValidationMode.cs",
"chars": 135,
"preview": "namespace Validot\n{\n public enum EmailValidationMode\n {\n ComplexRegex = 0,\n DataAnnotationsCompatibl"
},
{
"path": "src/Validot/Rules/Text/StringRules.cs",
"chars": 5838,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Text.RegularExpressions;\r\n\r\n using Validot.Specification;\r\n"
},
{
"path": "src/Validot/Rules/TimeSpanRules.cs",
"chars": 6778,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n publ"
},
{
"path": "src/Validot/Rules/Times/DateTimeFormats.cs",
"chars": 374,
"preview": "namespace Validot\r\n{\r\n public static class DateTimeFormats\r\n {\r\n public static string DateFormat { get; } ="
},
{
"path": "src/Validot/Rules/Times/DateTimeOffsetRules.cs",
"chars": 6980,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n publ"
},
{
"path": "src/Validot/Rules/Times/DateTimeRules.cs",
"chars": 6662,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Translations;\r\n\r\n publ"
},
{
"path": "src/Validot/Rules/Times/TimeComparer.cs",
"chars": 1148,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n internal static class TimeComparer\r\n {\r\n public static int Comp"
},
{
"path": "src/Validot/Rules/Times/TimeComparison.cs",
"chars": 138,
"preview": "namespace Validot\r\n{\r\n public enum TimeComparison\r\n {\r\n All = 0,\r\n\r\n JustDate = 1,\r\n\r\n JustTi"
},
{
"path": "src/Validot/Settings/IValidatorSettings.cs",
"chars": 958,
"preview": "namespace Validot.Settings\r\n{\r\n using System.Collections.Generic;\r\n\r\n public interface IValidatorSettings\r\n {\r\n"
},
{
"path": "src/Validot/Settings/ValidatorSettings.cs",
"chars": 3872,
"preview": "namespace Validot.Settings\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using Validot.Translation"
},
{
"path": "src/Validot/Settings/ValidatorSettingsExtensions.cs",
"chars": 2147,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Settings;\r\n\r\n public static class Va"
},
{
"path": "src/Validot/Specification/AndExtension.cs",
"chars": 947,
"preview": "namespace Validot\n{\n using Validot.Specification;\n\n public static class AndExtension\n {\n /// <summary>\n"
},
{
"path": "src/Validot/Specification/AsCollectionExtension.cs",
"chars": 3510,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n using Validot.Speci"
},
{
"path": "src/Validot/Specification/AsConvertedExtension.cs",
"chars": 1540,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n"
},
{
"path": "src/Validot/Specification/AsDictionaryExtension.cs",
"chars": 3501,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n "
},
{
"path": "src/Validot/Specification/AsDictionaryWithStringKeyExtension.cs",
"chars": 2874,
"preview": "namespace Validot\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification;\r\n using Validot.Speci"
},
{
"path": "src/Validot/Specification/AsModelExtension.cs",
"chars": 1102,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/AsNullableExtension.cs",
"chars": 1185,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/AsTypeExtension.cs",
"chars": 1326,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/Commands/AsCollectionCommand.cs",
"chars": 1217,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Validation.Scope"
},
{
"path": "src/Validot/Specification/Commands/AsConvertedCommand.cs",
"chars": 1409,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n using Validot.Validation.Scopes;\r\n using Valido"
},
{
"path": "src/Validot/Specification/Commands/AsDictionaryCommand.cs",
"chars": 1481,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using Valid"
},
{
"path": "src/Validot/Specification/Commands/AsModelCommand.cs",
"chars": 1079,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using Validot.Validation.Scopes;\r\n using Validot.Validation.Scopes.B"
},
{
"path": "src/Validot/Specification/Commands/AsNullableCommand.cs",
"chars": 1124,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using Validot.Validation.Scopes;\r\n using Validot.Validation.Scopes.B"
},
{
"path": "src/Validot/Specification/Commands/AsTypeCommand.cs",
"chars": 1105,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using Validot.Validation.Scopes;\r\n using Validot.Validation.Scopes.B"
},
{
"path": "src/Validot/Specification/Commands/ForbiddenCommand.cs",
"chars": 340,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n internal class ForbiddenCommand : ICommand\r\n {\r"
},
{
"path": "src/Validot/Specification/Commands/ICommand.cs",
"chars": 95,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n internal interface ICommand\r\n {\r\n }\r\n}\r\n"
},
{
"path": "src/Validot/Specification/Commands/IScopeCommand.cs",
"chars": 209,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using Validot.Validation.Scopes.Builders;\r\n\r\n internal interface ISc"
},
{
"path": "src/Validot/Specification/Commands/MemberCommand.cs",
"chars": 2407,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n using System.Linq;\r\n using System.Linq.Expression"
},
{
"path": "src/Validot/Specification/Commands/OptionalCommand.cs",
"chars": 335,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n internal class OptionalCommand : ICommand\r\n {\r\n"
},
{
"path": "src/Validot/Specification/Commands/RequiredCommand.cs",
"chars": 335,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n internal class RequiredCommand : ICommand\r\n {\r\n"
},
{
"path": "src/Validot/Specification/Commands/RuleCommand.cs",
"chars": 1274,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using Valid"
},
{
"path": "src/Validot/Specification/Commands/WithCodeCommand.cs",
"chars": 488,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n internal class WithCodeCommand : ICommand\r\n {\r\n"
},
{
"path": "src/Validot/Specification/Commands/WithConditionCommand.cs",
"chars": 521,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n internal abstract class WithConditionCommand : ICo"
},
{
"path": "src/Validot/Specification/Commands/WithExtraCodeCommand.cs",
"chars": 498,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n internal class WithExtraCodeCommand : ICommand\r\n "
},
{
"path": "src/Validot/Specification/Commands/WithExtraMessageCommand.cs",
"chars": 336,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n internal class WithExtraMessageCommand : ICommand\r\n {\r\n publi"
},
{
"path": "src/Validot/Specification/Commands/WithMessageCommand.cs",
"chars": 326,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n internal class WithMessageCommand : ICommand\r\n {\r\n public Wit"
},
{
"path": "src/Validot/Specification/Commands/WithPathCommand.cs",
"chars": 481,
"preview": "namespace Validot.Specification.Commands\r\n{\r\n using System;\r\n\r\n internal class WithPathCommand : ICommand\r\n {\r\n"
},
{
"path": "src/Validot/Specification/ForbiddenExtension.cs",
"chars": 1991,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/MemberExtension.cs",
"chars": 1519,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Linq.Expressions;\r\n\r\n using Validot.Specification;\r\n usi"
},
{
"path": "src/Validot/Specification/OptionalExtension.cs",
"chars": 1689,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/RequiredExtension.cs",
"chars": 2080,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/RuleExtension.cs",
"chars": 3244,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Errors.Args;\r\n using Validot.Specification;\r\n using V"
},
{
"path": "src/Validot/Specification/Specification.cs",
"chars": 461,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n\r\n /// <summary>\r\n /// Specification describes the valid s"
},
{
"path": "src/Validot/Specification/SpecificationApi.cs",
"chars": 718,
"preview": "namespace Validot.Specification\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specification.Commands;\r\n"
},
{
"path": "src/Validot/Specification/WithCodeExtension.cs",
"chars": 2132,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/WithConditionExtension.cs",
"chars": 1913,
"preview": "namespace Validot\r\n{\r\n using System;\r\n\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n"
},
{
"path": "src/Validot/Specification/WithExtraCodeExtension.cs",
"chars": 2206,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/WithExtraMessageExtension.cs",
"chars": 2466,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/WithMessageExtension.cs",
"chars": 2392,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Specification/WithPathExtension.cs",
"chars": 1680,
"preview": "namespace Validot\r\n{\r\n using Validot.Specification;\r\n using Validot.Specification.Commands;\r\n\r\n public static c"
},
{
"path": "src/Validot/Testing/TestFailedException.cs",
"chars": 214,
"preview": "namespace Validot.Testing\r\n{\r\n public sealed class TestFailedException : ValidotException\r\n {\r\n public Test"
},
{
"path": "src/Validot/Testing/TestResult.cs",
"chars": 770,
"preview": "namespace Validot.Testing\r\n{\r\n public sealed class TestResult\r\n {\r\n private static readonly TestResult Succ"
},
{
"path": "src/Validot/Testing/Tester.cs",
"chars": 14950,
"preview": "namespace Validot.Testing\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Globalization;\r"
},
{
"path": "src/Validot/Testing/ToStringContentType.cs",
"chars": 148,
"preview": "namespace Validot.Testing\n{\n public enum ToStringContentType\n {\n Messages = 0,\n Codes = 1,\n M"
},
{
"path": "src/Validot/ThrowHelper.cs",
"chars": 3226,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n\r\n internal s"
},
{
"path": "src/Validot/Translations/Chinese/ChineseTranslation.cs",
"chars": 4498,
"preview": "namespace Validot.Translations\n{\n using System.Collections.Generic;\n\n public static partial class Translation\n "
},
{
"path": "src/Validot/Translations/Chinese/ChineseTranslationsExtensions.cs",
"chars": 704,
"preview": "namespace Validot\n{\n using Validot.Settings;\n using Validot.Translations;\n\n public static partial class Transla"
},
{
"path": "src/Validot/Translations/English/EnglishTranslation.cs",
"chars": 5632,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public static partial class Translation\r"
},
{
"path": "src/Validot/Translations/English/EnglishTranslationsExtensions.cs",
"chars": 814,
"preview": "namespace Validot\r\n{\r\n using Validot.Settings;\r\n using Validot.Translations;\r\n\r\n public static partial class Tr"
},
{
"path": "src/Validot/Translations/German/GermanTranslation.cs",
"chars": 5951,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public static partial class Translation\r"
},
{
"path": "src/Validot/Translations/German/GermanTranslationsExtensions.cs",
"chars": 700,
"preview": "namespace Validot\n{\n using Validot.Settings;\n using Validot.Translations;\n\n public static partial class Transla"
},
{
"path": "src/Validot/Translations/ITranslationCompiler.cs",
"chars": 305,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public interface ITranslationCompiler\r\n "
},
{
"path": "src/Validot/Translations/MessageKey.cs",
"chars": 7018,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n using System.Reflection;\r\n\r\n public sta"
},
{
"path": "src/Validot/Translations/Polish/PolishTranslation.cs",
"chars": 5716,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public static partial class Translation\r"
},
{
"path": "src/Validot/Translations/Polish/PolishTranslationsExtensions.cs",
"chars": 721,
"preview": "namespace Validot\r\n{\r\n using Validot.Settings;\r\n using Validot.Translations;\r\n\r\n public static partial class Tr"
},
{
"path": "src/Validot/Translations/Portuguese/PortugueseTranslation.cs",
"chars": 5704,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public static partial class Translation\r"
},
{
"path": "src/Validot/Translations/Portuguese/PortugueseTranslationsExtensions.cs",
"chars": 716,
"preview": "namespace Validot\n{\n using Validot.Settings;\n using Validot.Translations;\n\n public static partial class Transla"
},
{
"path": "src/Validot/Translations/Russian/RussianTranslation.cs",
"chars": 5846,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public static partial class Translation\r"
},
{
"path": "src/Validot/Translations/Russian/RussianTranslationsExtensions.cs",
"chars": 725,
"preview": "namespace Validot\r\n{\r\n using Validot.Settings;\r\n using Validot.Translations;\r\n\r\n public static partial class Tr"
},
{
"path": "src/Validot/Translations/Spanish/SpanishTranslation.cs",
"chars": 5623,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public static partial class Translation\r"
},
{
"path": "src/Validot/Translations/Spanish/SpanishTranslationsExtensions.cs",
"chars": 725,
"preview": "namespace Validot\r\n{\r\n using Validot.Settings;\r\n using Validot.Translations;\r\n\r\n public static partial class Tr"
},
{
"path": "src/Validot/Translations/TranslationCompiler.cs",
"chars": 1576,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n\r\n internal class T"
},
{
"path": "src/Validot/Translations/_Template/_TemplateTranslation.cs.txt",
"chars": 5634,
"preview": "namespace Validot.Translations\r\n{\r\n using System.Collections.Generic;\r\n\r\n public static partial class Translation\r"
},
{
"path": "src/Validot/Translations/_Template/_TemplateTranslationsExtensions.cs.txt",
"chars": 731,
"preview": "namespace Validot\r\n{\r\n using Validot.Settings;\r\n using Validot.Translations;\r\n\r\n public static partial class Tr"
},
{
"path": "src/Validot/TypeStringifier.cs",
"chars": 767,
"preview": "namespace Validot\r\n{\r\n using System;\r\n using System.Linq;\r\n\r\n internal static class TypeStringifier\r\n {\r\n "
},
{
"path": "src/Validot/Validation/DiscoveryContext.cs",
"chars": 2941,
"preview": "namespace Validot.Validation\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Errors;\r\n using Validot.V"
},
{
"path": "src/Validot/Validation/ErrorFlag.cs",
"chars": 1998,
"preview": "namespace Validot.Validation\r\n{\r\n using System.Collections.Generic;\r\n\r\n internal class ErrorFlag\r\n {\r\n p"
},
{
"path": "src/Validot/Validation/IDiscoveryContext.cs",
"chars": 316,
"preview": "namespace Validot.Validation\r\n{\r\n internal interface IDiscoveryContext\r\n {\r\n void AddError(int errorId, boo"
},
{
"path": "src/Validot/Validation/IDiscoveryContextActions.cs",
"chars": 276,
"preview": "namespace Validot.Validation\r\n{\r\n using Validot.Errors;\r\n using Validot.Validation.Scopes;\r\n\r\n internal interfa"
},
{
"path": "src/Validot/Validation/IErrorsHolder.cs",
"chars": 182,
"preview": "namespace Validot.Validation\r\n{\r\n using System.Collections.Generic;\r\n\r\n public interface IErrorsHolder\r\n {\r\n "
},
{
"path": "src/Validot/Validation/IValidationContext.cs",
"chars": 501,
"preview": "namespace Validot.Validation\r\n{\r\n using Validot.Validation.Scopes.Builders;\r\n\r\n internal interface IValidationCont"
},
{
"path": "src/Validot/Validation/IsValidValidationContext.cs",
"chars": 2891,
"preview": "namespace Validot.Validation\r\n{\r\n using System;\r\n\r\n using Validot.Validation.Scheme;\r\n using Validot.Validatio"
},
{
"path": "src/Validot/Validation/Scheme/IModelScheme.cs",
"chars": 883,
"preview": "namespace Validot.Validation.Scheme\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using Validot.Er"
},
{
"path": "src/Validot/Validation/Scheme/ModelScheme.cs",
"chars": 4243,
"preview": "namespace Validot.Validation.Scheme\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using Validot.Er"
},
{
"path": "src/Validot/Validation/Scheme/ModelSchemeFactory.cs",
"chars": 1369,
"preview": "namespace Validot.Validation.Scheme\r\n{\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n\r\n using Valid"
},
{
"path": "src/Validot/Validation/Scopes/Builders/CommandScopeBuilder.cs",
"chars": 2589,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n using System;\r\n\r\n using Validot.Specification.Commands;\r\n\r\n i"
},
{
"path": "src/Validot/Validation/Scopes/Builders/ErrorBuilder.cs",
"chars": 2249,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n using Sys"
},
{
"path": "src/Validot/Validation/Scopes/Builders/ErrorMode.cs",
"chars": 140,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n internal enum ErrorMode\r\n {\r\n Append = 0,\r\n\r\n Over"
},
{
"path": "src/Validot/Validation/Scopes/Builders/ICommandScopeBuilder.cs",
"chars": 258,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n using Validot.Specification.Commands;\r\n\r\n internal interface ICo"
},
{
"path": "src/Validot/Validation/Scopes/Builders/IScopeBuilderContext.cs",
"chars": 385,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n using Validot.Errors;\r\n\r\n internal interface IScopeBuilderContex"
},
{
"path": "src/Validot/Validation/Scopes/Builders/RuleCommandScopeBuilder.cs",
"chars": 2109,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n using System;\r\n\r\n using Validot.Specification.Commands;\r\n\r\n i"
},
{
"path": "src/Validot/Validation/Scopes/Builders/ScopeBuilder.cs",
"chars": 4751,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n using System.Collections.Generic;\r\n\r\n using Validot.Specificatio"
},
{
"path": "src/Validot/Validation/Scopes/Builders/ScopeBuilderContext.cs",
"chars": 3138,
"preview": "namespace Validot.Validation.Scopes.Builders\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n using V"
},
{
"path": "src/Validot/Validation/Scopes/CollectionCommandScope.cs",
"chars": 970,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System.Collections.Generic;\r\n\r\n internal class CollectionCommandSco"
},
{
"path": "src/Validot/Validation/Scopes/CommandScope.cs",
"chars": 1513,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System;\r\n\r\n using Validot.Validation.Scopes.Builders;\r\n\r\n intern"
},
{
"path": "src/Validot/Validation/Scopes/ConvertedCommandScope.cs",
"chars": 622,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System;\r\n\r\n internal class ConvertedCommandScope<T, TTarget> : Comm"
},
{
"path": "src/Validot/Validation/Scopes/DictionaryCommandScope.cs",
"chars": 1213,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System;\r\n using System.Collections.Generic;\r\n\r\n internal class D"
},
{
"path": "src/Validot/Validation/Scopes/ICommandScope.cs",
"chars": 424,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System;\r\n\r\n using Validot.Validation.Scopes.Builders;\r\n\r\n intern"
},
{
"path": "src/Validot/Validation/Scopes/IDiscoverable.cs",
"chars": 146,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n internal interface IDiscoverable\r\n {\r\n void Discover(IDiscoveryCon"
},
{
"path": "src/Validot/Validation/Scopes/IScope.cs",
"chars": 127,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n internal interface IScope<in T> : IValidatable<T>, IDiscoverable\r\n {\r\n "
},
{
"path": "src/Validot/Validation/Scopes/ISpecificationScope.cs",
"chars": 381,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System.Collections.Generic;\r\n\r\n internal interface ISpecificationSc"
},
{
"path": "src/Validot/Validation/Scopes/IValidatable.cs",
"chars": 161,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n internal interface IValidatable<in T>\r\n {\r\n void Validate(T model,"
},
{
"path": "src/Validot/Validation/Scopes/MemberCommandScope.cs",
"chars": 620,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System;\r\n\r\n internal class MemberCommandScope<T, TMember> : Command"
},
{
"path": "src/Validot/Validation/Scopes/ModelCommandScope.cs",
"chars": 457,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n internal class ModelCommandScope<T> : CommandScope<T>\r\n {\r\n public"
},
{
"path": "src/Validot/Validation/Scopes/NullableCommandScope.cs",
"chars": 561,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n internal class NullableCommandScope<T> : CommandScope<T?>\r\n where T :"
},
{
"path": "src/Validot/Validation/Scopes/Presence.cs",
"chars": 158,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n internal enum Presence\r\n {\r\n Required = 0,\r\n\r\n Optional = 1"
},
{
"path": "src/Validot/Validation/Scopes/RuleCommandScope.cs",
"chars": 1489,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System;\r\n\r\n using Validot.Validation.Scopes.Builders;\r\n\r\n intern"
},
{
"path": "src/Validot/Validation/Scopes/SpecificationScope.cs",
"chars": 1967,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n using System.Collections.Generic;\r\n\r\n internal class SpecificationScope<T"
},
{
"path": "src/Validot/Validation/Scopes/TypeCommandScope.cs",
"chars": 550,
"preview": "namespace Validot.Validation.Scopes\r\n{\r\n internal class TypeCommandScope<T, TType> : CommandScope<T>\r\n {\r\n "
},
{
"path": "src/Validot/Validation/Stacks/PathStack.cs",
"chars": 2261,
"preview": "namespace Validot.Validation.Stacks\r\n{\r\n using System.Collections.Generic;\r\n using System.Globalization;\r\n usin"
},
{
"path": "src/Validot/Validation/Stacks/ReferenceLoopException.cs",
"chars": 1742,
"preview": "namespace Validot.Validation.Stacks\r\n{\r\n using System;\r\n\r\n public sealed class ReferenceLoopException : ValidotExc"
},
{
"path": "src/Validot/Validation/Stacks/ReferenceLoopProtectionSettings.cs",
"chars": 308,
"preview": "namespace Validot.Validation.Stacks\n{\n internal class ReferenceLoopProtectionSettings\n {\n public ReferenceL"
}
]
// ... and 189 more files (download for full content)
About this extraction
This page contains the full source code of the bartoszlenar/Validot GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 389 files (2.7 MB), approximately 725.0k tokens, and a symbol index with 3625 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.