├── .editorconfig ├── .gitattributes ├── .gitignore ├── Directory.Build.props ├── Directory.Build.targets ├── LICENSE.txt ├── NuGet.Config ├── README.md ├── analyzers.vs2019 ├── .editorconfig ├── analyzers.vs2019.sln ├── v2-full │ └── v2-full.csproj └── v3-full │ └── v3-full.csproj ├── analyzers ├── .editorconfig ├── analyzers.sln ├── common │ ├── 1xxx_Usage │ │ ├── xUnit1000.cs │ │ ├── xUnit1001.cs │ │ ├── xUnit1002.cs │ │ ├── xUnit1003.cs │ │ ├── xUnit1004.cs │ │ ├── xUnit1005.cs │ │ ├── xUnit1006.cs │ │ ├── xUnit1007.cs │ │ ├── xUnit1008.cs │ │ ├── xUnit1009.cs │ │ ├── xUnit1010.cs │ │ ├── xUnit1011.cs │ │ ├── xUnit1012.cs │ │ ├── xUnit1013.cs │ │ ├── xUnit1014.cs │ │ ├── xUnit1015.cs │ │ ├── xUnit1016.cs │ │ ├── xUnit1017.cs │ │ ├── xUnit1018.cs │ │ ├── xUnit1019.cs │ │ ├── xUnit1020.cs │ │ ├── xUnit1021.cs │ │ ├── xUnit1024.cs │ │ ├── xUnit1025.cs │ │ ├── xUnit1026.cs │ │ ├── xUnit1027.cs │ │ ├── xUnit1029.cs │ │ ├── xUnit1030.cs │ │ ├── xUnit1031.cs │ │ ├── xUnit1032.cs │ │ ├── xUnit1033.cs │ │ ├── xUnit1034.cs │ │ ├── xUnit1035.cs │ │ ├── xUnit1036.cs │ │ ├── xUnit1037.cs │ │ ├── xUnit1038.cs │ │ ├── xUnit1039.cs │ │ ├── xUnit1040.cs │ │ ├── xUnit1041.cs │ │ ├── xUnit1042.cs │ │ ├── xUnit1043.cs │ │ ├── xUnit1044.cs │ │ └── xUnit1045.cs │ └── 2xxx_Assertions │ │ ├── xUnit2000.cs │ │ ├── xUnit2001.cs │ │ ├── xUnit2002.cs │ │ ├── xUnit2003.cs │ │ ├── xUnit2004.cs │ │ ├── xUnit2005.cs │ │ ├── xUnit2006.cs │ │ ├── xUnit2007.cs │ │ ├── xUnit2008.cs │ │ ├── xUnit2009.cs │ │ ├── xUnit2010.cs │ │ ├── xUnit2011.cs │ │ ├── xUnit2012.cs │ │ ├── xUnit2013.cs │ │ ├── xUnit2014.cs │ │ ├── xUnit2015.cs │ │ ├── xUnit2016.cs │ │ ├── xUnit2017.cs │ │ ├── xUnit2018.cs │ │ ├── xUnit2020.cs │ │ ├── xUnit2021.cs │ │ ├── xUnit2022.cs │ │ ├── xUnit2023.cs │ │ ├── xUnit2024.cs │ │ ├── xUnit2025.cs │ │ ├── xUnit2026.cs │ │ ├── xUnit2027.cs │ │ ├── xUnit2028.cs │ │ ├── xUnit2029.cs │ │ ├── xUnit2030.cs │ │ ├── xUnit2031.cs │ │ └── xUnit2032.cs ├── v2-abstractions │ └── v2-abstractions.csproj ├── v2-core │ └── v2-core.csproj ├── v2-execution │ └── v2-execution.csproj ├── v2-full │ ├── 1xxx_Usage │ │ ├── xUnit1028.cs │ │ └── xUnit1048.cs │ ├── 3xxx_Extensibility │ │ ├── xUnit3000.cs │ │ └── xUnit3001.cs │ └── v2-full.csproj └── v3-full │ ├── 1xxx_Usage │ ├── xUnit1028.cs │ ├── xUnit1046.cs │ ├── xUnit1047.cs │ ├── xUnit1049.cs │ ├── xUnit1050.cs │ └── xUnit1051.cs │ ├── 3xxx_Extensibility │ ├── xUnit3001.cs │ └── xUnit3002.cs │ └── v3-full.csproj ├── console ├── build ├── build.ps1 ├── console.sln ├── v2x_net472 │ ├── BasicTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── v2x_net472.csproj ├── v2x_net472_Sdk │ ├── BasicTests.cs │ └── v2x_net472_Sdk.csproj ├── v3x_net472 │ ├── BasicTests.cs │ └── v3x_net472.csproj ├── v3x_net80 │ ├── BasicTests.cs │ └── v3x_net80.csproj └── xunit.runner.json ├── global.json ├── msbuild ├── build ├── build.ps1 ├── msbuild.sln ├── v2x_net472 │ ├── BasicTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── v2x_net472.csproj ├── v2x_net472_Sdk │ ├── BasicTests.cs │ └── v2x_net472_Sdk.csproj ├── v3x_net472 │ ├── BasicTests.cs │ └── v3x_net472.csproj ├── v3x_net80 │ ├── BasicTests.cs │ └── v3x_net80.csproj └── xunit.runner.json └── test-explorer ├── Directory.Build.props ├── MSTest_and_v2x ├── BasicTests_MSTest.cs ├── BasicTests_xUnit.cs └── MSTest_and_v2x.csproj ├── test-explorer.sln ├── v1x_net472 ├── BasicTests.cs ├── RunWithTests.cs └── v1x_net472.csproj ├── v2x_net472 ├── AbstractTestClass.cs ├── BasicTests.cs ├── DeserializationFailureTests.cs ├── DuplicateUniqueIDs.cs ├── FixtureFailureTests.cs ├── FixtureWithMixedFactAndTheory.cs └── v2x_net472.csproj ├── v2x_net472_FSharp ├── BasicTests.fs └── v2x_net472_FSharp.fsproj ├── v2x_net472_OldProject ├── BasicTests.cs └── v2x_net472_OldProject.csproj ├── v2x_net472_ReferencingProject ├── ConcreteTestClass.cs ├── Properties │ └── AssemblyInfo.cs └── v2x_net472_ReferencingProject.csproj ├── v2x_net80 ├── BasicTests.cs └── v2x_net80.csproj ├── v3x_net472 ├── BasicTests.cs └── v3x_net472.csproj ├── v3x_net80 ├── BasicTests.cs └── v3x_net80.csproj └── xunit.runner.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | # We differ from xunit/xunit .editorconfig by using spaces, because it makes example code easier to copy 9 | indent_style = space 10 | 11 | [*.sln] 12 | end_of_line = crlf 13 | 14 | # Visual Studio demands 2-spaced project files 15 | # Tabs are not legal whitespace for YAML files 16 | [*.{csproj,json,props,targets,xslt,yaml,yml}] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.cs] 21 | # Organize usings 22 | dotnet_separate_import_directive_groups = false 23 | dotnet_sort_system_directives_first = true 24 | file_header_template = unset 25 | 26 | # this. and Me. preferences 27 | dotnet_style_qualification_for_event = false 28 | dotnet_style_qualification_for_field = false 29 | dotnet_style_qualification_for_method = false 30 | dotnet_style_qualification_for_property = false 31 | 32 | # Language keywords vs BCL types preferences 33 | dotnet_style_predefined_type_for_locals_parameters_members = true 34 | dotnet_style_predefined_type_for_member_access = true 35 | 36 | # Parentheses preferences 37 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity 38 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity 39 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary 40 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity 41 | 42 | # Modifier preferences 43 | dotnet_style_require_accessibility_modifiers = for_non_interface_members 44 | 45 | # Expression-level preferences 46 | dotnet_style_coalesce_expression = true 47 | dotnet_style_collection_initializer = true 48 | dotnet_style_explicit_tuple_names = true 49 | dotnet_style_namespace_match_folder = false 50 | dotnet_style_null_propagation = true 51 | dotnet_style_object_initializer = true 52 | dotnet_style_operator_placement_when_wrapping = beginning_of_line 53 | dotnet_style_prefer_auto_properties = true 54 | dotnet_style_prefer_compound_assignment = true 55 | dotnet_style_prefer_conditional_expression_over_assignment = true 56 | dotnet_style_prefer_conditional_expression_over_return = true 57 | dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed 58 | dotnet_style_prefer_inferred_anonymous_type_member_names = true 59 | dotnet_style_prefer_inferred_tuple_names = true 60 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true 61 | dotnet_style_prefer_simplified_boolean_expressions = true 62 | dotnet_style_prefer_simplified_interpolation = true 63 | 64 | # Field preferences 65 | dotnet_style_readonly_field = true 66 | 67 | # Parameter preferences 68 | dotnet_code_quality_unused_parameters = all 69 | 70 | # Suppression preferences 71 | dotnet_remove_unnecessary_suppression_exclusions = none 72 | 73 | # New line preferences 74 | dotnet_style_allow_multiple_blank_lines_experimental = true 75 | dotnet_style_allow_statement_immediately_after_block_experimental = true 76 | 77 | #### C# Coding Conventions #### 78 | 79 | # var preferences 80 | csharp_style_var_elsewhere = true 81 | csharp_style_var_for_built_in_types = true 82 | csharp_style_var_when_type_is_apparent = true 83 | 84 | # Expression-bodied members 85 | csharp_style_expression_bodied_accessors = true 86 | csharp_style_expression_bodied_constructors = false 87 | csharp_style_expression_bodied_indexers = true 88 | csharp_style_expression_bodied_lambdas = true 89 | csharp_style_expression_bodied_local_functions = false 90 | csharp_style_expression_bodied_methods = when_on_single_line 91 | csharp_style_expression_bodied_operators = false 92 | csharp_style_expression_bodied_properties = true 93 | 94 | # Pattern matching preferences 95 | csharp_style_pattern_matching_over_as_with_null_check = true 96 | csharp_style_pattern_matching_over_is_with_cast_check = true 97 | csharp_style_prefer_extended_property_pattern = true 98 | csharp_style_prefer_not_pattern = true 99 | csharp_style_prefer_pattern_matching = true 100 | csharp_style_prefer_switch_expression = true 101 | 102 | # Null-checking preferences 103 | csharp_style_conditional_delegate_call = true 104 | 105 | # Modifier preferences 106 | csharp_prefer_static_local_function = true 107 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async 108 | 109 | # Code-block preferences 110 | csharp_prefer_braces = false 111 | csharp_prefer_simple_using_statement = true 112 | csharp_style_namespace_declarations = file_scoped 113 | 114 | # Expression-level preferences 115 | csharp_prefer_simple_default_expression = true 116 | csharp_style_deconstructed_variable_declaration = true 117 | csharp_style_implicit_object_creation_when_type_is_apparent = true 118 | csharp_style_inlined_variable_declaration = true 119 | csharp_style_pattern_local_over_anonymous_function = true 120 | csharp_style_prefer_index_operator = true 121 | csharp_style_prefer_null_check_over_type_check = true 122 | csharp_style_prefer_range_operator = true 123 | csharp_style_throw_expression = true 124 | csharp_style_unused_value_assignment_preference = discard_variable 125 | csharp_style_unused_value_expression_statement_preference = discard_variable 126 | 127 | # 'using' directive preferences 128 | csharp_using_directive_placement = outside_namespace:warning 129 | 130 | # New line preferences 131 | csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true 132 | csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true 133 | csharp_style_allow_embedded_statements_on_same_line_experimental = true 134 | 135 | #### C# Formatting Rules #### 136 | 137 | # New line preferences 138 | csharp_new_line_before_catch = true 139 | csharp_new_line_before_else = true 140 | csharp_new_line_before_finally = true 141 | csharp_new_line_before_members_in_anonymous_types = true 142 | csharp_new_line_before_members_in_object_initializers = true 143 | csharp_new_line_before_open_brace = all 144 | csharp_new_line_between_query_expression_clauses = true 145 | 146 | # Indentation preferences 147 | csharp_indent_block_contents = true 148 | csharp_indent_braces = false 149 | csharp_indent_case_contents = true 150 | csharp_indent_case_contents_when_block = true 151 | csharp_indent_labels = one_less_than_current 152 | csharp_indent_switch_labels = true 153 | 154 | # Space preferences 155 | csharp_space_after_cast = false 156 | csharp_space_after_colon_in_inheritance_clause = true 157 | csharp_space_after_comma = true 158 | csharp_space_after_dot = false 159 | csharp_space_after_keywords_in_control_flow_statements = true 160 | csharp_space_after_semicolon_in_for_statement = true 161 | csharp_space_around_binary_operators = before_and_after 162 | csharp_space_around_declaration_statements = false 163 | csharp_space_before_colon_in_inheritance_clause = true 164 | csharp_space_before_comma = false 165 | csharp_space_before_dot = false 166 | csharp_space_before_open_square_brackets = false 167 | csharp_space_before_semicolon_in_for_statement = false 168 | csharp_space_between_empty_square_brackets = false 169 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 170 | csharp_space_between_method_call_name_and_opening_parenthesis = false 171 | csharp_space_between_method_call_parameter_list_parentheses = false 172 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 173 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 174 | csharp_space_between_method_declaration_parameter_list_parentheses = false 175 | csharp_space_between_parentheses = false 176 | csharp_space_between_square_brackets = false 177 | 178 | # Wrapping preferences 179 | csharp_preserve_single_line_blocks = true 180 | csharp_preserve_single_line_statements = true 181 | 182 | #### Naming styles #### 183 | 184 | # Naming rules 185 | 186 | dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion 187 | dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface 188 | dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i 189 | 190 | dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion 191 | dotnet_naming_rule.types_should_be_pascal_case.symbols = types 192 | dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case 193 | 194 | dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion 195 | dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members 196 | dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case 197 | 198 | # Symbol specifications 199 | 200 | dotnet_naming_symbols.interface.applicable_kinds = interface 201 | dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 202 | dotnet_naming_symbols.interface.required_modifiers = 203 | 204 | dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum 205 | dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 206 | dotnet_naming_symbols.types.required_modifiers = 207 | 208 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method 209 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 210 | dotnet_naming_symbols.non_field_members.required_modifiers = 211 | 212 | # Naming styles 213 | 214 | dotnet_naming_style.pascal_case.required_prefix = 215 | dotnet_naming_style.pascal_case.required_suffix = 216 | dotnet_naming_style.pascal_case.word_separator = 217 | dotnet_naming_style.pascal_case.capitalization = pascal_case 218 | 219 | dotnet_naming_style.begins_with_i.required_prefix = I 220 | dotnet_naming_style.begins_with_i.required_suffix = 221 | dotnet_naming_style.begins_with_i.word_separator = 222 | dotnet_naming_style.begins_with_i.capitalization = pascal_case 223 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.cs text diff=csharp 4 | *.csproj text merge=union 5 | *.ico binary 6 | *.resx text merge=union 7 | *.sln text eol=crlf merge=union 8 | *.snk binary 9 | *.vbproj text merge=union 10 | *.xls binary 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio 2 | launchSettings.json 3 | 4 | # NCrunch 5 | *.ncrunchsolution 6 | *.ncrunchsolution.user 7 | *.ncrunchproject 8 | 9 | # Mono's local registry 10 | .mono 11 | 12 | ##### Copied from https://github.com/github/gitignore/blob/7b22f8ab6c85b4ef1469d72a8ba96462e2a44853/VisualStudio.gitignore 13 | 14 | ## Ignore Visual Studio temporary files, build results, and 15 | ## files generated by popular Visual Studio add-ons. 16 | ## 17 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 18 | 19 | # User-specific files 20 | *.rsuser 21 | *.suo 22 | *.user 23 | *.userosscache 24 | *.sln.docstates 25 | 26 | # User-specific files (MonoDevelop/Xamarin Studio) 27 | *.userprefs 28 | 29 | # Mono auto generated files 30 | mono_crash.* 31 | 32 | # Build results 33 | [Dd]ebug/ 34 | [Dd]ebugPublic/ 35 | [Rr]elease/ 36 | [Rr]eleases/ 37 | x64/ 38 | x86/ 39 | [Ww][Ii][Nn]32/ 40 | [Aa][Rr][Mm]/ 41 | [Aa][Rr][Mm]64/ 42 | bld/ 43 | [Bb]in/ 44 | [Oo]bj/ 45 | [Ll]og/ 46 | [Ll]ogs/ 47 | 48 | # Visual Studio 2015/2017 cache/options directory 49 | .vs/ 50 | # Uncomment if you have tasks that create the project's static files in wwwroot 51 | #wwwroot/ 52 | 53 | # Visual Studio 2017 auto generated files 54 | Generated\ Files/ 55 | 56 | # MSTest test Results 57 | [Tt]est[Rr]esult*/ 58 | [Bb]uild[Ll]og.* 59 | 60 | # NUnit 61 | *.VisualState.xml 62 | TestResult.xml 63 | nunit-*.xml 64 | 65 | # Build Results of an ATL Project 66 | [Dd]ebugPS/ 67 | [Rr]eleasePS/ 68 | dlldata.c 69 | 70 | # Benchmark Results 71 | BenchmarkDotNet.Artifacts/ 72 | 73 | # .NET Core 74 | project.lock.json 75 | project.fragment.lock.json 76 | artifacts/ 77 | 78 | # ASP.NET Scaffolding 79 | ScaffoldingReadMe.txt 80 | 81 | # StyleCop 82 | StyleCopReport.xml 83 | 84 | # Files built by Visual Studio 85 | *_i.c 86 | *_p.c 87 | *_h.h 88 | *.ilk 89 | *.meta 90 | *.obj 91 | *.iobj 92 | *.pch 93 | *.pdb 94 | *.ipdb 95 | *.pgc 96 | *.pgd 97 | *.rsp 98 | *.sbr 99 | *.tlb 100 | *.tli 101 | *.tlh 102 | *.tmp 103 | *.tmp_proj 104 | *_wpftmp.csproj 105 | *.log 106 | *.tlog 107 | *.vspscc 108 | *.vssscc 109 | .builds 110 | *.pidb 111 | *.svclog 112 | *.scc 113 | 114 | # Chutzpah Test files 115 | _Chutzpah* 116 | 117 | # Visual C++ cache files 118 | ipch/ 119 | *.aps 120 | *.ncb 121 | *.opendb 122 | *.opensdf 123 | *.sdf 124 | *.cachefile 125 | *.VC.db 126 | *.VC.VC.opendb 127 | 128 | # Visual Studio profiler 129 | *.psess 130 | *.vsp 131 | *.vspx 132 | *.sap 133 | 134 | # Visual Studio Trace Files 135 | *.e2e 136 | 137 | # TFS 2012 Local Workspace 138 | $tf/ 139 | 140 | # Guidance Automation Toolkit 141 | *.gpState 142 | 143 | # ReSharper is a .NET coding add-in 144 | _ReSharper*/ 145 | *.[Rr]e[Ss]harper 146 | *.DotSettings.user 147 | 148 | # TeamCity is a build add-in 149 | _TeamCity* 150 | 151 | # DotCover is a Code Coverage Tool 152 | *.dotCover 153 | 154 | # AxoCover is a Code Coverage Tool 155 | .axoCover/* 156 | !.axoCover/settings.json 157 | 158 | # Coverlet is a free, cross platform Code Coverage Tool 159 | coverage*.json 160 | coverage*.xml 161 | coverage*.info 162 | 163 | # Visual Studio code coverage results 164 | *.coverage 165 | *.coveragexml 166 | 167 | # NCrunch 168 | _NCrunch_* 169 | .*crunch*.local.xml 170 | nCrunchTemp_* 171 | 172 | # MightyMoose 173 | *.mm.* 174 | AutoTest.Net/ 175 | 176 | # Web workbench (sass) 177 | .sass-cache/ 178 | 179 | # Installshield output folder 180 | [Ee]xpress/ 181 | 182 | # DocProject is a documentation generator add-in 183 | DocProject/buildhelp/ 184 | DocProject/Help/*.HxT 185 | DocProject/Help/*.HxC 186 | DocProject/Help/*.hhc 187 | DocProject/Help/*.hhk 188 | DocProject/Help/*.hhp 189 | DocProject/Help/Html2 190 | DocProject/Help/html 191 | 192 | # Click-Once directory 193 | publish/ 194 | 195 | # Publish Web Output 196 | *.[Pp]ublish.xml 197 | *.azurePubxml 198 | # Note: Comment the next line if you want to checkin your web deploy settings, 199 | # but database connection strings (with potential passwords) will be unencrypted 200 | *.pubxml 201 | *.publishproj 202 | 203 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 204 | # checkin your Azure Web App publish settings, but sensitive information contained 205 | # in these scripts will be unencrypted 206 | PublishScripts/ 207 | 208 | # NuGet Packages 209 | *.nupkg 210 | # NuGet Symbol Packages 211 | *.snupkg 212 | # The packages folder can be ignored because of Package Restore 213 | **/[Pp]ackages/* 214 | # except build/, which is used as an MSBuild target. 215 | !**/[Pp]ackages/build/ 216 | # Uncomment if necessary however generally it will be regenerated when needed 217 | #!**/[Pp]ackages/repositories.config 218 | # NuGet v3's project.json files produces more ignorable files 219 | *.nuget.props 220 | *.nuget.targets 221 | 222 | # Microsoft Azure Build Output 223 | csx/ 224 | *.build.csdef 225 | 226 | # Microsoft Azure Emulator 227 | ecf/ 228 | rcf/ 229 | 230 | # Windows Store app package directories and files 231 | AppPackages/ 232 | BundleArtifacts/ 233 | Package.StoreAssociation.xml 234 | _pkginfo.txt 235 | *.appx 236 | *.appxbundle 237 | *.appxupload 238 | 239 | # Visual Studio cache files 240 | # files ending in .cache can be ignored 241 | *.[Cc]ache 242 | # but keep track of directories ending in .cache 243 | !?*.[Cc]ache/ 244 | 245 | # Others 246 | ClientBin/ 247 | ~$* 248 | *~ 249 | *.dbmdl 250 | *.dbproj.schemaview 251 | *.jfm 252 | *.pfx 253 | *.publishsettings 254 | orleans.codegen.cs 255 | 256 | # Including strong name files can present a security risk 257 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 258 | #*.snk 259 | 260 | # Since there are multiple workflows, uncomment next line to ignore bower_components 261 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 262 | #bower_components/ 263 | 264 | # RIA/Silverlight projects 265 | Generated_Code/ 266 | 267 | # Backup & report files from converting an old project file 268 | # to a newer Visual Studio version. Backup files are not needed, 269 | # because we have git ;-) 270 | _UpgradeReport_Files/ 271 | Backup*/ 272 | UpgradeLog*.XML 273 | UpgradeLog*.htm 274 | ServiceFabricBackup/ 275 | *.rptproj.bak 276 | 277 | # SQL Server files 278 | *.mdf 279 | *.ldf 280 | *.ndf 281 | 282 | # Business Intelligence projects 283 | *.rdl.data 284 | *.bim.layout 285 | *.bim_*.settings 286 | *.rptproj.rsuser 287 | *- [Bb]ackup.rdl 288 | *- [Bb]ackup ([0-9]).rdl 289 | *- [Bb]ackup ([0-9][0-9]).rdl 290 | 291 | # Microsoft Fakes 292 | FakesAssemblies/ 293 | 294 | # GhostDoc plugin setting file 295 | *.GhostDoc.xml 296 | 297 | # Node.js Tools for Visual Studio 298 | .ntvs_analysis.dat 299 | node_modules/ 300 | 301 | # Visual Studio 6 build log 302 | *.plg 303 | 304 | # Visual Studio 6 workspace options file 305 | *.opt 306 | 307 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 308 | *.vbw 309 | 310 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 311 | *.vbp 312 | 313 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 314 | *.dsw 315 | *.dsp 316 | 317 | # Visual Studio 6 technical files 318 | *.ncb 319 | *.aps 320 | 321 | # Visual Studio LightSwitch build output 322 | **/*.HTMLClient/GeneratedArtifacts 323 | **/*.DesktopClient/GeneratedArtifacts 324 | **/*.DesktopClient/ModelManifest.xml 325 | **/*.Server/GeneratedArtifacts 326 | **/*.Server/ModelManifest.xml 327 | _Pvt_Extensions 328 | 329 | # Paket dependency manager 330 | .paket/paket.exe 331 | paket-files/ 332 | 333 | # FAKE - F# Make 334 | .fake/ 335 | 336 | # CodeRush personal settings 337 | .cr/personal 338 | 339 | # Python Tools for Visual Studio (PTVS) 340 | __pycache__/ 341 | *.pyc 342 | 343 | # Cake - Uncomment if you are using it 344 | # tools/** 345 | # !tools/packages.config 346 | 347 | # Tabs Studio 348 | *.tss 349 | 350 | # Telerik's JustMock configuration file 351 | *.jmconfig 352 | 353 | # BizTalk build output 354 | *.btp.cs 355 | *.btm.cs 356 | *.odx.cs 357 | *.xsd.cs 358 | 359 | # OpenCover UI analysis results 360 | OpenCover/ 361 | 362 | # Azure Stream Analytics local run output 363 | ASALocalRun/ 364 | 365 | # MSBuild Binary and Structured Log 366 | *.binlog 367 | 368 | # NVidia Nsight GPU debugger configuration file 369 | *.nvuser 370 | 371 | # MFractors (Xamarin productivity tool) working folder 372 | .mfractor/ 373 | 374 | # Local History for Visual Studio 375 | .localhistory/ 376 | 377 | # Visual Studio History (VSHistory) files 378 | .vshistory/ 379 | 380 | # BeatPulse healthcheck temp database 381 | healthchecksdb 382 | 383 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 384 | MigrationBackup/ 385 | 386 | # Ionide (cross platform F# VS Code tools) working folder 387 | .ionide/ 388 | 389 | # Fody - auto-generated XML schema 390 | FodyWeavers.xsd 391 | 392 | # VS Code files for those working on multiple tools 393 | .vscode/* 394 | !.vscode/settings.json 395 | !.vscode/tasks.json 396 | !.vscode/launch.json 397 | !.vscode/extensions.json 398 | *.code-workspace 399 | 400 | # Local History for Visual Studio Code 401 | .history/ 402 | 403 | # Windows Installer files from build outputs 404 | *.cab 405 | *.msi 406 | *.msix 407 | *.msm 408 | *.msp 409 | 410 | # JetBrains Rider 411 | *.sln.iml 412 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17.14.1 5 | 1.22.0 6 | 2.9.3 7 | 2.0.3 8 | 3.1.1 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | runtime; build; native; contentfiles; analyzers; buildtransitive 6 | all 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation and Contributors 2 | All Rights Reserved 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## About This Project 2 | 3 | This project contains integration tests for: 4 | 5 | - [xunit/xunit](https://github.com/xunit/xunit) in [`console`](console) and [`msbuild`](msbuild) 6 | - [xunit/xunit.analyzers](https://github.com/xunit/xunit.analyzers) in [`analyzers`](analyzers) and [`analyzers.vs2019`](analyzers.vs2019) 7 | - [xunit/visualstudio.xunit](https://github.com/xunit/visualstudio.xunit) in [`test-explorer`](test-explorer) 8 | 9 | To open an issue for this project, please visit the [core xUnit.net project issue tracker](https://github.com/xunit/xunit/issues). 10 | 11 | ## About xUnit.net 12 | 13 | [](https://dotnetfoundation.org/projects/project-detail/xunit) 14 | 15 | xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other .NET languages. xUnit.net works with ReSharper, CodeRush, TestDriven.NET and Xamarin. It is part of the [.NET Foundation](https://www.dotnetfoundation.org/), and operates under their [code of conduct](https://www.dotnetfoundation.org/code-of-conduct). It is licensed under [Apache 2](https://opensource.org/licenses/Apache-2.0) (an OSI approved license). 16 | 17 | For project documentation, please visit the [xUnit.net project home](https://xunit.net/). 18 | -------------------------------------------------------------------------------- /analyzers.vs2019/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | dotnet_diagnostic.xUnit1000.severity = warning 3 | dotnet_diagnostic.xUnit1001.severity = warning 4 | dotnet_diagnostic.xUnit1002.severity = warning 5 | dotnet_diagnostic.xUnit1003.severity = warning 6 | dotnet_diagnostic.xUnit1004.severity = warning 7 | dotnet_diagnostic.xUnit1005.severity = warning 8 | dotnet_diagnostic.xUnit1006.severity = warning 9 | dotnet_diagnostic.xUnit1007.severity = warning 10 | dotnet_diagnostic.xUnit1008.severity = warning 11 | dotnet_diagnostic.xUnit1009.severity = warning 12 | dotnet_diagnostic.xUnit1010.severity = warning 13 | dotnet_diagnostic.xUnit1011.severity = warning 14 | dotnet_diagnostic.xUnit1012.severity = warning 15 | dotnet_diagnostic.xUnit1013.severity = warning 16 | dotnet_diagnostic.xUnit1014.severity = warning 17 | dotnet_diagnostic.xUnit1015.severity = warning 18 | dotnet_diagnostic.xUnit1016.severity = warning 19 | dotnet_diagnostic.xUnit1017.severity = warning 20 | dotnet_diagnostic.xUnit1018.severity = warning 21 | dotnet_diagnostic.xUnit1019.severity = warning 22 | dotnet_diagnostic.xUnit1020.severity = warning 23 | dotnet_diagnostic.xUnit1021.severity = warning 24 | dotnet_diagnostic.xUnit1022.severity = warning 25 | dotnet_diagnostic.xUnit1023.severity = warning 26 | dotnet_diagnostic.xUnit1024.severity = warning 27 | dotnet_diagnostic.xUnit1025.severity = warning 28 | dotnet_diagnostic.xUnit1026.severity = warning 29 | dotnet_diagnostic.xUnit1027.severity = warning 30 | dotnet_diagnostic.xUnit1028.severity = warning 31 | dotnet_diagnostic.xUnit1029.severity = warning 32 | dotnet_diagnostic.xUnit1030.severity = warning 33 | dotnet_diagnostic.xUnit1031.severity = warning 34 | dotnet_diagnostic.xUnit1032.severity = warning 35 | dotnet_diagnostic.xUnit1033.severity = warning 36 | dotnet_diagnostic.xUnit1034.severity = warning 37 | dotnet_diagnostic.xUnit1035.severity = warning 38 | dotnet_diagnostic.xUnit1036.severity = warning 39 | dotnet_diagnostic.xUnit1037.severity = warning 40 | dotnet_diagnostic.xUnit1038.severity = warning 41 | dotnet_diagnostic.xUnit1039.severity = warning 42 | dotnet_diagnostic.xUnit1040.severity = warning 43 | dotnet_diagnostic.xUnit1041.severity = warning 44 | dotnet_diagnostic.xUnit1042.severity = warning 45 | dotnet_diagnostic.xUnit1043.severity = warning 46 | dotnet_diagnostic.xUnit1044.severity = warning 47 | dotnet_diagnostic.xUnit1045.severity = warning 48 | dotnet_diagnostic.xUnit1046.severity = warning 49 | dotnet_diagnostic.xUnit1047.severity = warning 50 | dotnet_diagnostic.xUnit1048.severity = warning 51 | dotnet_diagnostic.xUnit1049.severity = warning 52 | dotnet_diagnostic.xUnit1050.severity = warning 53 | dotnet_diagnostic.xUnit1051.severity = warning 54 | 55 | dotnet_diagnostic.xUnit2000.severity = warning 56 | dotnet_diagnostic.xUnit2001.severity = warning 57 | dotnet_diagnostic.xUnit2002.severity = warning 58 | dotnet_diagnostic.xUnit2003.severity = warning 59 | dotnet_diagnostic.xUnit2004.severity = warning 60 | dotnet_diagnostic.xUnit2005.severity = warning 61 | dotnet_diagnostic.xUnit2006.severity = warning 62 | dotnet_diagnostic.xUnit2007.severity = warning 63 | dotnet_diagnostic.xUnit2008.severity = warning 64 | dotnet_diagnostic.xUnit2009.severity = warning 65 | dotnet_diagnostic.xUnit2010.severity = warning 66 | dotnet_diagnostic.xUnit2011.severity = warning 67 | dotnet_diagnostic.xUnit2012.severity = warning 68 | dotnet_diagnostic.xUnit2013.severity = warning 69 | dotnet_diagnostic.xUnit2014.severity = warning 70 | dotnet_diagnostic.xUnit2015.severity = warning 71 | dotnet_diagnostic.xUnit2016.severity = warning 72 | dotnet_diagnostic.xUnit2017.severity = warning 73 | dotnet_diagnostic.xUnit2018.severity = warning 74 | dotnet_diagnostic.xUnit2020.severity = warning 75 | dotnet_diagnostic.xUnit2021.severity = warning 76 | dotnet_diagnostic.xUnit2022.severity = warning 77 | dotnet_diagnostic.xUnit2023.severity = warning 78 | dotnet_diagnostic.xUnit2024.severity = warning 79 | dotnet_diagnostic.xUnit2025.severity = warning 80 | dotnet_diagnostic.xUnit2026.severity = warning 81 | dotnet_diagnostic.xUnit2027.severity = warning 82 | dotnet_diagnostic.xUnit2028.severity = warning 83 | dotnet_diagnostic.xUnit2029.severity = warning 84 | dotnet_diagnostic.xUnit2030.severity = warning 85 | 86 | dotnet_diagnostic.xUnit3000.severity = warning 87 | dotnet_diagnostic.xUnit3001.severity = warning 88 | dotnet_diagnostic.xUnit3002.severity = warning 89 | 90 | dotnet_diagnostic.CA1050.severity = none 91 | dotnet_diagnostic.CA2211.severity = none 92 | 93 | dotnet_diagnostic.CS0067.severity = none 94 | dotnet_diagnostic.CS1998.severity = none 95 | dotnet_diagnostic.CS8321.severity = none 96 | dotnet_diagnostic.CS8604.severity = none 97 | dotnet_diagnostic.CS8625.severity = none 98 | 99 | dotnet_diagnostic.IDE0039.severity = none 100 | dotnet_diagnostic.IDE0040.severity = none 101 | dotnet_diagnostic.IDE0051.severity = none 102 | dotnet_diagnostic.IDE0052.severity = none 103 | dotnet_diagnostic.IDE0060.severity = none 104 | dotnet_diagnostic.IDE0062.severity = none 105 | dotnet_diagnostic.IDE1006.severity = none 106 | -------------------------------------------------------------------------------- /analyzers.vs2019/analyzers.vs2019.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.34729.46 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v2-full", "v2-full\v2-full.csproj", "{366C2869-7CB6-455A-8F9F-CD75259CAC51}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v3-full", "v3-full\v3-full.csproj", "{B5FD6A8B-8C9F-4D0F-B27E-874E519949B1}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {366C2869-7CB6-455A-8F9F-CD75259CAC51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {366C2869-7CB6-455A-8F9F-CD75259CAC51}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {366C2869-7CB6-455A-8F9F-CD75259CAC51}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {366C2869-7CB6-455A-8F9F-CD75259CAC51}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {B5FD6A8B-8C9F-4D0F-B27E-874E519949B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {B5FD6A8B-8C9F-4D0F-B27E-874E519949B1}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {B5FD6A8B-8C9F-4D0F-B27E-874E519949B1}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {B5FD6A8B-8C9F-4D0F-B27E-874E519949B1}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {A7E64E86-C051-48BE-A2F5-75A8D179EE16} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /analyzers.vs2019/v2-full/v2-full.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {366C2869-7CB6-455A-8F9F-CD75259CAC51} 8 | Library 9 | Properties 10 | v2-full 11 | v4.7.2 12 | 512 13 | true 14 | 9.0 15 | enable 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | %(RecursiveDir)%(Filename)%(Extension) 37 | 38 | 39 | %(RecursiveDir)%(Filename)%(Extension) 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | $(XunitAnalyzersVersion) 49 | analyzers 50 | all 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /analyzers.vs2019/v3-full/v3-full.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B5FD6A8B-8C9F-4D0F-B27E-874E519949B1} 8 | Library 9 | Properties 10 | v2-full 11 | v4.7.2 12 | 512 13 | true 14 | 9.0 15 | enable 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | %(RecursiveDir)%(Filename)%(Extension) 37 | 38 | 39 | %(RecursiveDir)%(Filename)%(Extension) 40 | 41 | 42 | 43 | 44 | 45 | 46 | $(XunitAnalyzersVersion) 47 | analyzers 48 | all 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /analyzers/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | dotnet_diagnostic.xUnit1000.severity = warning 3 | dotnet_diagnostic.xUnit1001.severity = warning 4 | dotnet_diagnostic.xUnit1002.severity = warning 5 | dotnet_diagnostic.xUnit1003.severity = warning 6 | dotnet_diagnostic.xUnit1004.severity = warning 7 | dotnet_diagnostic.xUnit1005.severity = warning 8 | dotnet_diagnostic.xUnit1006.severity = warning 9 | dotnet_diagnostic.xUnit1007.severity = warning 10 | dotnet_diagnostic.xUnit1008.severity = warning 11 | dotnet_diagnostic.xUnit1009.severity = warning 12 | dotnet_diagnostic.xUnit1010.severity = warning 13 | dotnet_diagnostic.xUnit1011.severity = warning 14 | dotnet_diagnostic.xUnit1012.severity = warning 15 | dotnet_diagnostic.xUnit1013.severity = warning 16 | dotnet_diagnostic.xUnit1014.severity = warning 17 | dotnet_diagnostic.xUnit1015.severity = warning 18 | dotnet_diagnostic.xUnit1016.severity = warning 19 | dotnet_diagnostic.xUnit1017.severity = warning 20 | dotnet_diagnostic.xUnit1018.severity = warning 21 | dotnet_diagnostic.xUnit1019.severity = warning 22 | dotnet_diagnostic.xUnit1020.severity = warning 23 | dotnet_diagnostic.xUnit1021.severity = warning 24 | dotnet_diagnostic.xUnit1022.severity = warning 25 | dotnet_diagnostic.xUnit1023.severity = warning 26 | dotnet_diagnostic.xUnit1024.severity = warning 27 | dotnet_diagnostic.xUnit1025.severity = warning 28 | dotnet_diagnostic.xUnit1026.severity = warning 29 | dotnet_diagnostic.xUnit1027.severity = warning 30 | dotnet_diagnostic.xUnit1028.severity = warning 31 | dotnet_diagnostic.xUnit1029.severity = warning 32 | dotnet_diagnostic.xUnit1030.severity = warning 33 | dotnet_diagnostic.xUnit1031.severity = warning 34 | dotnet_diagnostic.xUnit1032.severity = warning 35 | dotnet_diagnostic.xUnit1033.severity = warning 36 | dotnet_diagnostic.xUnit1034.severity = warning 37 | dotnet_diagnostic.xUnit1035.severity = warning 38 | dotnet_diagnostic.xUnit1036.severity = warning 39 | dotnet_diagnostic.xUnit1037.severity = warning 40 | dotnet_diagnostic.xUnit1038.severity = warning 41 | dotnet_diagnostic.xUnit1039.severity = warning 42 | dotnet_diagnostic.xUnit1040.severity = warning 43 | dotnet_diagnostic.xUnit1041.severity = warning 44 | dotnet_diagnostic.xUnit1042.severity = warning 45 | dotnet_diagnostic.xUnit1043.severity = warning 46 | dotnet_diagnostic.xUnit1044.severity = warning 47 | dotnet_diagnostic.xUnit1045.severity = warning 48 | dotnet_diagnostic.xUnit1046.severity = warning 49 | dotnet_diagnostic.xUnit1047.severity = warning 50 | dotnet_diagnostic.xUnit1048.severity = warning 51 | dotnet_diagnostic.xUnit1049.severity = warning 52 | dotnet_diagnostic.xUnit1050.severity = warning 53 | dotnet_diagnostic.xUnit1051.severity = warning 54 | 55 | dotnet_diagnostic.xUnit2000.severity = warning 56 | dotnet_diagnostic.xUnit2001.severity = warning 57 | dotnet_diagnostic.xUnit2002.severity = warning 58 | dotnet_diagnostic.xUnit2003.severity = warning 59 | dotnet_diagnostic.xUnit2004.severity = warning 60 | dotnet_diagnostic.xUnit2005.severity = warning 61 | dotnet_diagnostic.xUnit2006.severity = warning 62 | dotnet_diagnostic.xUnit2007.severity = warning 63 | dotnet_diagnostic.xUnit2008.severity = warning 64 | dotnet_diagnostic.xUnit2009.severity = warning 65 | dotnet_diagnostic.xUnit2010.severity = warning 66 | dotnet_diagnostic.xUnit2011.severity = warning 67 | dotnet_diagnostic.xUnit2012.severity = warning 68 | dotnet_diagnostic.xUnit2013.severity = warning 69 | dotnet_diagnostic.xUnit2014.severity = warning 70 | dotnet_diagnostic.xUnit2015.severity = warning 71 | dotnet_diagnostic.xUnit2016.severity = warning 72 | dotnet_diagnostic.xUnit2017.severity = warning 73 | dotnet_diagnostic.xUnit2018.severity = warning 74 | dotnet_diagnostic.xUnit2020.severity = warning 75 | dotnet_diagnostic.xUnit2021.severity = warning 76 | dotnet_diagnostic.xUnit2022.severity = warning 77 | dotnet_diagnostic.xUnit2023.severity = warning 78 | dotnet_diagnostic.xUnit2024.severity = warning 79 | dotnet_diagnostic.xUnit2025.severity = warning 80 | dotnet_diagnostic.xUnit2026.severity = warning 81 | dotnet_diagnostic.xUnit2027.severity = warning 82 | dotnet_diagnostic.xUnit2028.severity = warning 83 | dotnet_diagnostic.xUnit2029.severity = warning 84 | dotnet_diagnostic.xUnit2030.severity = warning 85 | dotnet_diagnostic.xUnit2031.severity = warning 86 | dotnet_diagnostic.xUnit2032.severity = warning 87 | 88 | dotnet_diagnostic.xUnit3000.severity = warning 89 | dotnet_diagnostic.xUnit3001.severity = warning 90 | dotnet_diagnostic.xUnit3002.severity = warning 91 | 92 | dotnet_diagnostic.CA1050.severity = none 93 | dotnet_diagnostic.CA2211.severity = none 94 | 95 | dotnet_diagnostic.CS0067.severity = none 96 | dotnet_diagnostic.CS1998.severity = none 97 | dotnet_diagnostic.CS8321.severity = none 98 | dotnet_diagnostic.CS8604.severity = none 99 | dotnet_diagnostic.CS8625.severity = none 100 | 101 | dotnet_diagnostic.IDE0039.severity = none 102 | dotnet_diagnostic.IDE0040.severity = none 103 | dotnet_diagnostic.IDE0051.severity = none 104 | dotnet_diagnostic.IDE0052.severity = none 105 | dotnet_diagnostic.IDE0060.severity = none 106 | dotnet_diagnostic.IDE0062.severity = none 107 | dotnet_diagnostic.IDE0290.severity = none 108 | dotnet_diagnostic.IDE1006.severity = none 109 | -------------------------------------------------------------------------------- /analyzers/analyzers.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31710.8 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2-abstractions", "v2-abstractions\v2-abstractions.csproj", "{5C705559-DCE1-41B4-939F-C8F826C816AE}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2-core", "v2-core\v2-core.csproj", "{593DA203-624A-408C-821C-488FB23A9F85}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2-execution", "v2-execution\v2-execution.csproj", "{224BC22A-E272-4A64-86B4-B439B98E79C1}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2-full", "v2-full\v2-full.csproj", "{2FDBD2A5-8EB3-4CC3-922F-78F96F68B636}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v3-full", "v3-full\v3-full.csproj", "{6EBE9509-9BCD-47A8-B17B-1C24DE0F3FD7}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{E9BADC05-3257-4E54-AB86-1B9C63D84C69}" 17 | ProjectSection(SolutionItems) = preProject 18 | .editorconfig = .editorconfig 19 | ..\Directory.Build.props = ..\Directory.Build.props 20 | EndProjectSection 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Any CPU = Debug|Any CPU 25 | Release|Any CPU = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {5C705559-DCE1-41B4-939F-C8F826C816AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {5C705559-DCE1-41B4-939F-C8F826C816AE}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {5C705559-DCE1-41B4-939F-C8F826C816AE}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {5C705559-DCE1-41B4-939F-C8F826C816AE}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {593DA203-624A-408C-821C-488FB23A9F85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {593DA203-624A-408C-821C-488FB23A9F85}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {593DA203-624A-408C-821C-488FB23A9F85}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {593DA203-624A-408C-821C-488FB23A9F85}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {224BC22A-E272-4A64-86B4-B439B98E79C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {224BC22A-E272-4A64-86B4-B439B98E79C1}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {224BC22A-E272-4A64-86B4-B439B98E79C1}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {224BC22A-E272-4A64-86B4-B439B98E79C1}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {2FDBD2A5-8EB3-4CC3-922F-78F96F68B636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {2FDBD2A5-8EB3-4CC3-922F-78F96F68B636}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {2FDBD2A5-8EB3-4CC3-922F-78F96F68B636}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {2FDBD2A5-8EB3-4CC3-922F-78F96F68B636}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {6EBE9509-9BCD-47A8-B17B-1C24DE0F3FD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {6EBE9509-9BCD-47A8-B17B-1C24DE0F3FD7}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {6EBE9509-9BCD-47A8-B17B-1C24DE0F3FD7}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {6EBE9509-9BCD-47A8-B17B-1C24DE0F3FD7}.Release|Any CPU.Build.0 = Release|Any CPU 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {B09F2014-50A6-45E2-B26C-CAA329081FA2} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1000.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | class xUnit1000 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { } 8 | } 9 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1001.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1001 4 | { 5 | [Fact] 6 | public void TestMethod(int _) 7 | { } 8 | } 9 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1002.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1003 // Theory methods must have test data 2 | #pragma warning disable xUnit1006 // Theory methods should have parameters 3 | 4 | using Xunit; 5 | 6 | public class xUnit1002 7 | { 8 | [Fact, Theory] 9 | public void TestMethod() 10 | { } 11 | } 12 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1003.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1003 4 | { 5 | [Theory] 6 | public void TestMethod(int _) { } 7 | } 8 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1004.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1004 4 | { 5 | [Fact(Skip = "This is a flaky test")] 6 | public void TestMethod() { } 7 | 8 | #if XUNIT_V3 && NETCOREAPP 9 | 10 | [Fact(Skip = "Requires Windows", 11 | SkipUnless = nameof(System.OperatingSystem.IsWindows), 12 | SkipType = typeof(System.OperatingSystem))] 13 | public void WindowsTest() { } 14 | 15 | #endif 16 | } 17 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1005.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1005 4 | { 5 | [Fact, InlineData(1)] 6 | public void TestMethod() 7 | { } 8 | } 9 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1006.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1011 // There is no matching method parameter 2 | 3 | using Xunit; 4 | 5 | public class xUnit1006 6 | { 7 | [Theory] 8 | [InlineData(12, "book")] 9 | public void TestMethod() 10 | { } 11 | } 12 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1007.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1050 // The class referenced by the ClassData attribute returns untyped data rows 2 | 3 | using System.Collections.Generic; 4 | using System.Threading; 5 | using Xunit; 6 | 7 | class PlainClass { } 8 | 9 | class ClassWithAsyncObjectArray : IAsyncEnumerable 10 | { 11 | public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default) => throw new System.NotImplementedException(); 12 | } 13 | 14 | #if XUNIT_V3 15 | 16 | class ClassWithTheoryData : IEnumerable 17 | { 18 | public IEnumerator GetEnumerator() => throw new System.NotImplementedException(); 19 | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => throw new System.NotImplementedException(); 20 | } 21 | 22 | class ClassWithAsyncTheoryData : IAsyncEnumerable 23 | { 24 | public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default) => throw new System.NotImplementedException(); 25 | } 26 | 27 | #endif 28 | 29 | public class xUnit1007 30 | { 31 | [Theory] 32 | [ClassData(typeof(PlainClass))] 33 | // This should trigger in v2, but not in v3 34 | [ClassData(typeof(ClassWithAsyncObjectArray))] 35 | #if XUNIT_V3 36 | // These should not trigger in V3 37 | [ClassData(typeof(ClassWithTheoryData))] 38 | [ClassData(typeof(ClassWithAsyncTheoryData))] 39 | #endif 40 | public void TestMethod(int _1, string _2) 41 | { } 42 | } 43 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1008.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1008 4 | { 5 | [InlineData(42)] 6 | public void TestMethod(int _) { } 7 | } 8 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1009.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1009 4 | { 5 | [Theory] 6 | [InlineData("Hello world")] 7 | public void TestMethod(string _1, int _2) { } 8 | } 9 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1010.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1010 4 | { 5 | [Theory] 6 | [InlineData("42")] 7 | public void TestMethod(int _) { } 8 | } 9 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1011.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1011 4 | { 5 | [Theory] 6 | [InlineData("Hello world", 42)] 7 | public void TestMethod(string _) { } 8 | } 9 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1012.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1012 4 | { 5 | // nullable struct 6 | [Theory] 7 | [InlineData(null)] 8 | public void TestMethod1a(int _) { } 9 | 10 | // nullable reference type 11 | [Theory] 12 | [InlineData(null)] 13 | public void TestMethod1b(string _) { } 14 | 15 | #nullable disable 16 | 17 | // nullable struct unaffected by disabling nullable reference types 18 | [Theory] 19 | [InlineData(null)] 20 | public void TestMethod2a(int _) { } 21 | 22 | // reference type won't trigger with nullable reference types disabled 23 | [Theory] 24 | [InlineData(null)] 25 | public void TestMethod2b(string _) { } 26 | } 27 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1013.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | public sealed class IgnoreXunitAnalyzersRule1013Attribute : Attribute { } 5 | 6 | [IgnoreXunitAnalyzersRule1013] 7 | public class CustomTestTypeAttribute : Attribute { } 8 | 9 | public abstract class xUnit1013_Base 10 | { 11 | [Fact] 12 | public abstract void TestMethod4(); 13 | } 14 | 15 | public class xUnit1013 : xUnit1013_Base 16 | { 17 | [Fact] 18 | public void TestMethod1() { } 19 | 20 | // The fixer should offer to convert this to a Fact, because it has no parameters 21 | public void TestMethod2() { } 22 | 23 | // The fixer should offer to convert this to a Theory, because it has parameters 24 | public void TestMethod3(int _) { } 25 | 26 | // This should not trigger because the [Fact] comes from the base class 27 | public override void TestMethod4() { } 28 | 29 | // This should not trigger because [CustomTestType] is decorated with an attribute which 30 | // should suppress this rule 31 | [CustomTestType] 32 | public void TestMethod5() { } 33 | } 34 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1014.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | 3 | using Xunit; 4 | 5 | public class xUnit1014 6 | { 7 | public static TheoryData TestData; 8 | 9 | [Theory] 10 | [MemberData("TestData")] 11 | public void TestMethod(string _1, int _2) { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1015.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | 3 | using Xunit; 4 | 5 | public class xUnit1015 6 | { 7 | public static TheoryData TestData; 8 | 9 | [Theory] 10 | [MemberData("MyTestData")] 11 | public void TestMethod(string _1, int _2) { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1016.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | 3 | using Xunit; 4 | 5 | public class xUnit1016 6 | { 7 | protected static TheoryData TestData; 8 | 9 | [Theory] 10 | [MemberData(nameof(TestData))] 11 | public void TestMethod(string _1, int _2) { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1017.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | 3 | using Xunit; 4 | 5 | public class xUnit1017 6 | { 7 | public TheoryData TestData; 8 | 9 | [Theory] 10 | [MemberData(nameof(TestData))] 11 | public void TestMethod(string _1, int _2) { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1018.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS0067 // The event 'xUnit1018.TestData' is never used 2 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 3 | 4 | using System; 5 | using Xunit; 6 | 7 | public class xUnit1018 8 | { 9 | public static event EventHandler TestData; 10 | 11 | [Theory] 12 | [MemberData(nameof(TestData))] 13 | public void TestMethod(string _1, int _2) { } 14 | } 15 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1019.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | #pragma warning disable xUnit1042 // object[]/ITheoryDataRow isn't type safe, but it is still legal and shouldn't trigger xUnit1019. 3 | 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | using Xunit; 7 | 8 | public class xUnit1019 9 | { 10 | public static IEnumerable TestData; 11 | public static Task> TaskTestData; 12 | public static Task> AsyncTaskTestData; 13 | public static ValueTask> ValueTaskTestData; 14 | public static ValueTask> AsyncValueTaskTestData; 15 | 16 | [Theory] 17 | // For v2, the only fixer offered should be to convert to IEnumerable 18 | // For v3, it should also offer a fixer to convert to IEnumerable 19 | [MemberData(nameof(TestData))] 20 | // These four should trigger for v2, but not for v3 (since it supports async data members) 21 | [MemberData(nameof(TaskTestData))] 22 | [MemberData(nameof(AsyncTaskTestData))] 23 | [MemberData(nameof(ValueTaskTestData))] 24 | [MemberData(nameof(AsyncValueTaskTestData))] 25 | public void TestMethod(string _1, int _2) { } 26 | 27 | #if XUNIT_V3 28 | 29 | public static List TheoryDataRowData; 30 | 31 | // These should not trigger for v3 32 | [Theory] 33 | [MemberData(nameof(TheoryDataRowData))] 34 | public void SkippedDataRow(int _1, string _2) { } 35 | 36 | #endif 37 | } 38 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1020.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | 3 | using Xunit; 4 | 5 | public class xUnit1020 6 | { 7 | public static TheoryData TestData { private get; set; } 8 | 9 | [Theory] 10 | [MemberData(nameof(TestData))] 11 | public void TestMethod(string _1, int _2) { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1021.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | 3 | using Xunit; 4 | 5 | public class xUnit1021 6 | { 7 | public static TheoryData TestData { get; set; } 8 | 9 | [Theory] 10 | [MemberData(nameof(TestData), "Hello world", 123)] 11 | public void TestMethod(int _) { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1024.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1013 // Public method should be marked as test 2 | 3 | using Xunit; 4 | 5 | public class xUnit1024 6 | { 7 | [Fact] 8 | public void TestMethod() { } 9 | 10 | public void TestMethod(int age) { } 11 | } 12 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1025.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1025 4 | { 5 | [Theory] 6 | [InlineData(2)] 7 | [InlineData(2)] 8 | public void TestMethod(int _) 9 | { } 10 | 11 | [Theory] 12 | [InlineData(2, 0)] 13 | [InlineData(2)] 14 | public void TestMethod2(int _1, int _2 = 0) 15 | { } 16 | 17 | [Theory] 18 | [InlineData(1, 2, 3)] 19 | [InlineData(new object[] { 1, 2, 3 })] 20 | public void TestMethod3(params int[] _) 21 | { } 22 | } 23 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1026.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | static class MyGreetingService 4 | { 5 | public static string Greet(string name) => 6 | $"Hello, {name}!"; 7 | } 8 | 9 | public class xUnit1026 10 | { 11 | [Theory] 12 | [InlineData("Joe", 42)] 13 | public void ValidateGreeting(string name, int age) 14 | { 15 | var result = MyGreetingService.Greet(name); 16 | 17 | Assert.Equal("Hello, Joe!", result); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1027.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1027 4 | { 5 | [CollectionDefinition("CollectionName")] 6 | class CollectionDefinitionClass 7 | { } 8 | } 9 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1029.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8321 // Local function is declared but never used 2 | 3 | using Xunit; 4 | 5 | public class xUnit1029 6 | { 7 | public void NonTestMethod() 8 | { 9 | [Fact] 10 | void LocalTestMethod() 11 | { } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1030.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1013 // Public method should be marked as test 2 | #pragma warning disable xUnit1031 // Do not use blocking task operations in test method 3 | #pragma warning disable xUnit1051 // Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken 4 | 5 | using System; 6 | using System.Threading.Tasks; 7 | using Xunit; 8 | 9 | public class xUnit1030 10 | { 11 | [Fact] 12 | public async Task TestMethod_Async() 13 | { 14 | var trueValue = true; 15 | 16 | await Task.Delay(1).ConfigureAwait(false); 17 | await Task.Delay(1).ConfigureAwait(1 == 0); 18 | await Task.Delay(1).ConfigureAwait(1 == 1); 19 | await Task.Delay(1).ConfigureAwait(trueValue); 20 | 21 | // Shouldn't trigger in lambda or local function 22 | Action _ = async () => await Task.Delay(1).ConfigureAwait(false); 23 | async void LocalFunction() => await Task.Delay(1).ConfigureAwait(false); 24 | } 25 | 26 | [Theory] 27 | [InlineData(42)] 28 | public void TestMethod_NonAsync(int delay) 29 | { 30 | var trueValue = true; 31 | 32 | Task.Delay(delay).ConfigureAwait(false).GetAwaiter().GetResult(); 33 | Task.Delay(delay).ConfigureAwait(1 == 0).GetAwaiter().GetResult(); 34 | Task.Delay(delay).ConfigureAwait(1 == 1).GetAwaiter().GetResult(); 35 | Task.Delay(delay).ConfigureAwait(trueValue).GetAwaiter().GetResult(); 36 | 37 | // Shouldn't trigger in lambda or local function 38 | Action _ = () => Task.Delay(delay).ConfigureAwait(false).GetAwaiter().GetResult(); 39 | void LocalFunction() => Task.Delay(1).ConfigureAwait(false).GetAwaiter().GetResult(); 40 | } 41 | 42 | public class MyFactAttribute : FactAttribute { } 43 | 44 | [MyFact] 45 | public async Task TestMethod_Ignored() 46 | { 47 | await Task.Delay(1).ConfigureAwait(false); 48 | } 49 | 50 | public async Task NonTestMethod() 51 | { 52 | await Task.Delay(1).ConfigureAwait(false); 53 | } 54 | 55 | #if NET80_OR_GREATER 56 | 57 | [Fact] 58 | public async Task TestMethodWithOptionsEnum() 59 | { 60 | await Task.Delay(1).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing); 61 | } 62 | 63 | #endif 64 | } 65 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1031.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1013 // Public method should be marked as test 2 | #pragma warning disable xUnit1051 // Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | using Xunit; 7 | 8 | public class xUnit1031 9 | { 10 | [Fact] 11 | public void TestMethod_Task() 12 | { 13 | Task task = Task.FromResult(0); 14 | 15 | task.GetAwaiter().GetResult(); 16 | task.Wait(); 17 | Task.WaitAny(task); 18 | Task.WaitAll(task); 19 | 20 | // Shouldn't trigger in lambda or local function 21 | Action _ = () => task.Wait(); 22 | void LocalFunction() => task.Wait(); 23 | } 24 | 25 | [Fact] 26 | public void TestMethod_TaskOfT() 27 | { 28 | Task task = Task.FromResult(0); 29 | 30 | task.GetAwaiter().GetResult(); 31 | task.Wait(); 32 | Task.WaitAny(task); 33 | Task.WaitAll(task); 34 | 35 | // Shouldn't trigger in lambda or local function 36 | Action _ = () => task.Wait(); 37 | void LocalFunction() => task.Wait(); 38 | } 39 | 40 | [Fact] 41 | public void TestMethod_ValueTask() 42 | { 43 | ValueTask task = default; 44 | 45 | task.GetAwaiter().GetResult(); 46 | 47 | // Shouldn't trigger in lambda or local function 48 | Action _ = () => task.GetAwaiter().GetResult(); 49 | void LocalFunction() => task.GetAwaiter().GetResult(); 50 | } 51 | 52 | [Fact] 53 | public void TestMethod_ValueTaskOfT() 54 | { 55 | ValueTask task = new(0); 56 | 57 | task.GetAwaiter().GetResult(); 58 | 59 | // Shouldn't trigger in lambda or local function 60 | Action _ = () => task.GetAwaiter().GetResult(); 61 | void LocalFunction() => task.GetAwaiter().GetResult(); 62 | } 63 | 64 | // Ignore test methods which aren't directly Fact/Theory 65 | 66 | public class MyFactAttribute : FactAttribute { } 67 | 68 | [MyFact] 69 | public void TestMethod_Ignored() 70 | { 71 | var _ = Task.FromResult(0).GetAwaiter().GetResult(); 72 | } 73 | 74 | // Ignore non-test methods 75 | 76 | public void NonTestMethod() 77 | { 78 | var _ = Task.FromResult(0).GetAwaiter().GetResult(); 79 | } 80 | 81 | // ContinueWith allows you to get access to the task result 82 | 83 | [Fact] 84 | public async Task ContinueWith_DoesNotTrigger() 85 | { 86 | var result = await Task.FromResult(1).ContinueWith(x => x.Result + 2); 87 | 88 | Assert.Equal(3, result); 89 | } 90 | 91 | // WhenAll allows you to assume all the tasks are safe 92 | 93 | [Fact] 94 | public async Task WhenAll_DoesNotTrigger() 95 | { 96 | var task1 = Task.FromResult(1); 97 | var task2 = Task.FromResult(2); 98 | await Task.WhenAll(task1, task2); 99 | 100 | Assert.Equal(3, task1.Result + task2.Result); 101 | } 102 | 103 | // WhenAny allows you to assume the resulting task is safe 104 | 105 | [Fact] 106 | public async Task WhenAny_ReturnedTaskDoesNotTrigger() 107 | { 108 | var task1 = Task.FromResult(1); 109 | var task2 = Task.FromResult(2); 110 | 111 | var resultTask = await Task.WhenAny(task1, task2); 112 | 113 | Assert.Equal(42, resultTask.Result); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1032.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class TestClass 4 | { 5 | public class NestedTestClass 6 | { 7 | [Fact] 8 | public void TestMethod() { } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1033.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class MyFixture { } 4 | 5 | public class xUnit1033 : IClassFixture 6 | { 7 | [Fact] 8 | public void TestMethod() { } 9 | } 10 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1034.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1034 4 | { 5 | public static TheoryData TestData(int n, string s) => 6 | new() { $"Hello {s}! x {n}" }; 7 | 8 | [Theory] 9 | [MemberData(nameof(TestData), 2112, null)] 10 | public void TestMethod(string _) 11 | { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1035.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1035 4 | { 5 | public static TheoryData TestData(string s) => 6 | new() { s }; 7 | 8 | [Theory] 9 | [MemberData(nameof(TestData), new object[] { 2112 })] 10 | public void TestMethod(string _) 11 | { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1036.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1036 4 | { 5 | public static TheoryData TestData(int n) => 6 | new() { n }; 7 | 8 | [Theory] 9 | [MemberData(nameof(TestData), 42, 2112)] 10 | public void TestMethod(int _) 11 | { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1037.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | #if XUNIT_V3 4 | using System.Collections.Generic; 5 | using System.Threading; 6 | #endif 7 | 8 | public class xUnit1037 9 | { 10 | public static TheoryData FieldData = 11 | new() { 1, 2, 3 }; 12 | 13 | public static TheoryData PropertyData => 14 | new() { 1, 2, 3 }; 15 | 16 | public static TheoryData MethodDataNoArgs() => 17 | new() { 1, 2, 3 }; 18 | 19 | public static TheoryData MethodDataWithArgs(int n) => 20 | new() { 1, 2, 3, n }; 21 | 22 | #if XUNIT_V3 23 | 24 | public class ClassRowData : IAsyncEnumerable> 25 | { 26 | public IAsyncEnumerator> GetAsyncEnumerator(CancellationToken cancellationToken = default) => throw new System.NotImplementedException(); 27 | } 28 | 29 | public static IEnumerable> FieldRowData = 30 | [new(1), new(2), new(3), new(4)]; 31 | 32 | public static IEnumerable> PropertyRowData => 33 | [new(1), new(2), new(3), new(4)]; 34 | 35 | public static IEnumerable> MethodRowDataNoArgs() => 36 | [new(1), new(2), new(3), new(4)]; 37 | 38 | public static IEnumerable> MethodRowDataWithArgs(int n) => 39 | [new(1), new(2), new(3), new(4)]; 40 | 41 | #endif 42 | 43 | [Theory] 44 | [MemberData(nameof(FieldData))] 45 | [MemberData(nameof(PropertyData))] 46 | [MemberData(nameof(MethodDataNoArgs))] 47 | [MemberData(nameof(MethodDataWithArgs), 42)] 48 | #if XUNIT_V3 49 | [ClassData(typeof(ClassRowData))] 50 | [MemberData(nameof(FieldRowData))] 51 | [MemberData(nameof(PropertyRowData))] 52 | [MemberData(nameof(MethodRowDataNoArgs))] 53 | [MemberData(nameof(MethodRowDataWithArgs), 42)] 54 | #endif 55 | public void TestMethod(int _1, string _2) { } 56 | } 57 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1038.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | #if XUNIT_V3 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | #endif 7 | 8 | public class xUnit1038 9 | { 10 | public static TheoryData FieldData = 11 | new() { { 1, "Hello" }, { 2, "World" } }; 12 | 13 | public static TheoryData PropertyData => 14 | new() { { 1, "Hello" }, { 2, "World" } }; 15 | 16 | public static TheoryData MethodDataNoArgs() => 17 | new() { { 1, "Hello" }, { 2, "World" } }; 18 | 19 | public static TheoryData MethodDataWithArgs(int _) => 20 | new() { { 1, "Hello" }, { 2, "World" } }; 21 | 22 | #if XUNIT_V3 23 | 24 | public class ClassRowData : IEnumerable> 25 | { 26 | public IEnumerator> GetEnumerator() => throw new System.NotImplementedException(); 27 | IEnumerator IEnumerable.GetEnumerator() => throw new System.NotImplementedException(); 28 | } 29 | 30 | public static IEnumerable> FieldRowData = 31 | [new(1, "Hello"), new(2, "World")]; 32 | 33 | public static IEnumerable> PropertyRowData => 34 | [new(1, "Hello"), new(2, "World")]; 35 | 36 | public static IEnumerable> MethodRowDataNoArgs() => 37 | [new(1, "Hello"), new(2, "World")]; 38 | 39 | public static IEnumerable> MethodRowDataWithArgs(int _) => 40 | [new(1, "Hello"), new(2, "World")]; 41 | 42 | #endif 43 | 44 | [Theory] 45 | [MemberData(nameof(FieldData))] 46 | [MemberData(nameof(PropertyData))] 47 | [MemberData(nameof(MethodDataNoArgs))] 48 | [MemberData(nameof(MethodDataWithArgs), 42)] 49 | #if XUNIT_V3 50 | [ClassData(typeof(ClassRowData))] 51 | [MemberData(nameof(FieldRowData))] 52 | [MemberData(nameof(PropertyRowData))] 53 | [MemberData(nameof(MethodRowDataNoArgs))] 54 | [MemberData(nameof(MethodRowDataWithArgs), 42)] 55 | #endif 56 | public void TestMethod(int _) { } 57 | } 58 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1039.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1044 // Tuples are not serializable 2 | #pragma warning disable xUnit1046 // Tuples are not serializable 3 | 4 | using Xunit; 5 | 6 | #if XUNIT_V3 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | #endif 10 | 11 | public class xUnit1039 12 | { 13 | public static TheoryData FieldData = 14 | new() { 1, 2, 3 }; 15 | 16 | public static TheoryData PropertyData => 17 | new() { 1, 2, 3 }; 18 | 19 | public static TheoryData MethodDataNoArgs() => 20 | new() { 1, 2, 3 }; 21 | 22 | public static TheoryData MethodDataWithArgs(int n) => 23 | new() { 1, 2, 3, n }; 24 | 25 | #if XUNIT_V3 26 | 27 | public class ClassRowData : IEnumerable> 28 | { 29 | public IEnumerator> GetEnumerator() => throw new System.NotImplementedException(); 30 | IEnumerator IEnumerable.GetEnumerator() => throw new System.NotImplementedException(); 31 | } 32 | 33 | public static IEnumerable> FieldRowData = 34 | [new(1), new(2), new(3)]; 35 | 36 | public static IEnumerable> PropertyRowData => 37 | [new(1), new(2), new(3)]; 38 | 39 | public static IEnumerable> MethodRowDataNoArgs() => 40 | [new(1), new(2), new(3)]; 41 | 42 | public static IEnumerable> MethodRowDataWithArgs(int n) => 43 | [new(1), new(2), new(3)]; 44 | 45 | #endif 46 | 47 | [Theory] 48 | [MemberData(nameof(FieldData))] 49 | [MemberData(nameof(PropertyData))] 50 | [MemberData(nameof(MethodDataNoArgs))] 51 | [MemberData(nameof(MethodDataWithArgs), 42)] 52 | #if XUNIT_V3 53 | [ClassData(typeof(ClassRowData))] 54 | [MemberData(nameof(FieldRowData))] 55 | [MemberData(nameof(PropertyRowData))] 56 | [MemberData(nameof(MethodRowDataNoArgs))] 57 | [MemberData(nameof(MethodRowDataWithArgs), 42)] 58 | #endif 59 | public void TestMethod(string _) { } 60 | 61 | // Should not be reported despite tuple member names mismatching 62 | 63 | public static TheoryData<(string, string)> UnnamedTupleData => 64 | new() { ("Hello", "world") }; 65 | 66 | public static TheoryData<(string baz, string biff)> MisnamedTupleData => 67 | new() { ("Hello", "world") }; 68 | 69 | #if XUNIT_V3 70 | 71 | public static IEnumerable> UnnamedTupleDataRow => 72 | [new(("Hello", "world"))]; 73 | 74 | public static IEnumerable> MisnamedTupleDataRow => 75 | [new(("Hello", "world"))]; 76 | 77 | #endif 78 | 79 | [Theory] 80 | [MemberData(nameof(UnnamedTupleData))] 81 | [MemberData(nameof(MisnamedTupleData))] 82 | #if XUNIT_V3 83 | [MemberData(nameof(UnnamedTupleDataRow))] 84 | [MemberData(nameof(MisnamedTupleDataRow))] 85 | #endif 86 | public void TupleTestMethod((string foo, string bar) _) { } 87 | } 88 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1040.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | #if XUNIT_V3 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | #endif 7 | 8 | public class xUnit1040 9 | { 10 | public static TheoryData FieldData = 11 | new() { "Hello", "World", default(string) }; 12 | 13 | public static TheoryData PropertyData => 14 | new() { "Hello", "World", default(string) }; 15 | 16 | public static TheoryData MethodDataNoArgs() => 17 | new() { "Hello", "World", default(string) }; 18 | 19 | public static TheoryData MethodDataWithArgs(int _) => 20 | new() { "Hello", "World", default(string) }; 21 | 22 | #if XUNIT_V3 23 | 24 | public class ClassRowData : IEnumerable> 25 | { 26 | public IEnumerator> GetEnumerator() => throw new System.NotImplementedException(); 27 | IEnumerator IEnumerable.GetEnumerator() => throw new System.NotImplementedException(); 28 | } 29 | 30 | public static IEnumerable> FieldRowData = 31 | [new("Hello"), new("World"), new(null)]; 32 | 33 | public static IEnumerable> PropertyRowData => 34 | [new("Hello"), new("World"), new(null)]; 35 | 36 | public static IEnumerable> MethodRowDataNoArgs() => 37 | [new("Hello"), new("World"), new(null)]; 38 | 39 | public static IEnumerable> MethodRowDataWithArgs(int _) => 40 | [new("Hello"), new("World"), new(null)]; 41 | 42 | #endif 43 | 44 | [Theory] 45 | [MemberData(nameof(FieldData))] 46 | [MemberData(nameof(PropertyData))] 47 | [MemberData(nameof(MethodDataNoArgs))] 48 | [MemberData(nameof(MethodDataWithArgs), 42)] 49 | #if XUNIT_V3 50 | [ClassData(typeof(ClassRowData))] 51 | [MemberData(nameof(FieldRowData))] 52 | [MemberData(nameof(PropertyRowData))] 53 | [MemberData(nameof(MethodRowDataNoArgs))] 54 | [MemberData(nameof(MethodRowDataWithArgs), 42)] 55 | #endif 56 | public void TestMethod(string _) { } 57 | } 58 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1041.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class Fixture { } 4 | 5 | public class xUnit1041 6 | { 7 | public xUnit1041(Fixture fixture) 8 | { } 9 | 10 | [Fact] 11 | public void TestMethod() 12 | { } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1042.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. 2 | 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using Xunit; 6 | 7 | public class xUnit1042 8 | { 9 | public static IEnumerable TestData; 10 | #if XUNIT_V3 11 | public static IEnumerable TestDataRows; 12 | public static Task> TestDataRowsViaTask; 13 | public static ValueTask> TestDataRowsViaValueTask; 14 | #endif 15 | 16 | [Theory] 17 | [MemberData(nameof(TestData))] 18 | #if XUNIT_V3 19 | [MemberData(nameof(TestDataRows))] 20 | [MemberData(nameof(TestDataRowsViaTask))] 21 | [MemberData(nameof(TestDataRowsViaValueTask))] 22 | #endif 23 | public static void TestMethod(int _) 24 | { } 25 | } 26 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1043.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] 5 | public class CustomFactAttribute : FactAttribute 6 | { 7 | internal CustomFactAttribute() { } 8 | } 9 | 10 | public class xUnit1043 11 | { 12 | [CustomFact] 13 | public void TestMethod() { } 14 | } 15 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1044.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1044 4 | { 5 | public sealed class NonSerializable { } 6 | 7 | public static TheoryData DataSource = new TheoryData(); 8 | 9 | [Theory] 10 | [MemberData(nameof(DataSource))] 11 | public void TestMethod(NonSerializable _) { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/1xxx_Usage/xUnit1045.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | public class xUnit1045 5 | { 6 | public static TheoryData DataSource = new TheoryData(); 7 | 8 | [Theory] 9 | [MemberData(nameof(DataSource))] 10 | public void TestMethod(IDisposable _) { } 11 | } 12 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2000.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2000 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = 2 + 3; 9 | 10 | Assert.Equal(result, 5); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2001.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2001 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = 21 * 2; 9 | 10 | // This will always also show CS0619 because we use [Obsolete(..., error: true)] 11 | Assert.Equals(42, result); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2002.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2002 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = 2 + 3; 9 | 10 | Assert.NotNull(result); 11 | Assert.True(result > 4); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2003.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2003 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = "Hello world!"; 9 | 10 | Assert.Equal(null, result); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2004.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2004 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = 2 + 2; 9 | 10 | Assert.Equal(true, result > 3); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2005.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | public class xUnit2005 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var result = DateTime.Now; 10 | 11 | Assert.Same(new DateTime(2017, 1, 1), result); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2006.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2006 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = "foo"; 9 | 10 | Assert.Equal("foo", result); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2007.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2007 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = "foo"; 9 | 10 | Assert.IsType(typeof(string), result); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2008.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | using Xunit; 3 | 4 | public class xUnit2008 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var result = "foo bar baz"; 10 | 11 | Assert.True(Regex.IsMatch(result, "foo (.*?) baz")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2009.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2009 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = "foo bar baz"; 9 | 10 | Assert.True(result.Contains("bar")); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2010.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2010 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = "foo bar baz"; 9 | 10 | Assert.True(string.Equals("foo bar baz", result)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2011.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2011 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var result = new[] { 1 }; 9 | 10 | Assert.Collection(result); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2012.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Xunit; 3 | 4 | public class xUnit2012 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var result = new[] { "Hello" }; 10 | 11 | Assert.True(result.Any(value => value == "Hello")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2013.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Xunit; 3 | 4 | public class xUnit2013 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var result = new[] { "Hello" }; 10 | 11 | Assert.Equal(1, result.Count()); 12 | Assert.Equal(1, result.Length); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2014.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | public class xUnit2014 6 | { 7 | class MyMath 8 | { 9 | public static Task Divide(params int[] values) => Task.FromResult(42); 10 | } 11 | 12 | [Fact] 13 | public void TestMethod() 14 | { 15 | // This will always also show CS0619 because we use [Obsolete(..., error: true)] 16 | Assert.Throws(() => MyMath.Divide(1, 0)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2015.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | public class xUnit2015 5 | { 6 | void FunctionThatThrows() { } 7 | 8 | [Fact] 9 | public void TestMethod() 10 | { 11 | Assert.Throws(typeof(InvalidOperationException), () => FunctionThatThrows()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2016.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2016 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var actual = 1.1; 9 | 10 | Assert.Equal(1.1, actual, 16); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2017.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Xunit; 3 | 4 | public class xUnit2017 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var result = new[] { "foo", "bar" }; 10 | 11 | Assert.True(result.Contains("foo")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2018.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | public class xUnit2018 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var result = new object(); 10 | 11 | Assert.IsType(result); 12 | Assert.IsNotType(result); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2020.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2020 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | Assert.True(false, "Failure message"); 9 | Assert.False(true, "Failure message"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2021.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit2015 2 | 3 | using System; 4 | using System.ComponentModel; 5 | using Xunit; 6 | 7 | public class xUnit2021 : INotifyPropertyChanged 8 | { 9 | public int Property { get; set; } 10 | 11 | public event PropertyChangedEventHandler? PropertyChanged; 12 | public event EventHandler? SimpleEvent; 13 | public event EventHandler? SimpleIntEvent; 14 | 15 | [Fact] 16 | public void TestMethod() 17 | { 18 | Assert.PropertyChangedAsync(this, nameof(Property), async () => throw new DivideByZeroException()); 19 | 20 | Assert.RaisesAnyAsync(eh => SimpleEvent += eh, eh => SimpleEvent -= eh, async () => throw new DivideByZeroException()); 21 | Assert.RaisesAnyAsync(eh => SimpleIntEvent += eh, eh => SimpleIntEvent -= eh, async () => throw new DivideByZeroException()); 22 | Assert.RaisesAsync(eh => SimpleIntEvent += eh, eh => SimpleIntEvent -= eh, async () => throw new DivideByZeroException()); 23 | 24 | Assert.ThrowsAnyAsync(async () => throw new DivideByZeroException()); 25 | Assert.ThrowsAsync(typeof(DivideByZeroException), async () => throw new DivideByZeroException()); 26 | Assert.ThrowsAsync(async () => throw new DivideByZeroException()); 27 | Assert.ThrowsAsync("argName", async () => throw new DivideByZeroException()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2022.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2022 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var condition = true; 9 | 10 | Assert.False(!condition); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2023.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2023 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var collection = new[] { 1 }; 9 | 10 | Assert.Collection( 11 | collection, 12 | item => Assert.Equal(1, item) 13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2024.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2024 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var x = 42; 9 | 10 | Assert.True(x == 2112); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2025.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2025 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | var x = true; 9 | 10 | Assert.True(x == true); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2026.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Xunit; 4 | 5 | public class Person 6 | { 7 | public Person(string firstName, string lastName) 8 | { 9 | FirstName = firstName; 10 | LastName = lastName; 11 | } 12 | 13 | public string FirstName { get; } 14 | public string LastName { get; } 15 | } 16 | 17 | public class xUnit2026 18 | { 19 | [Fact] 20 | public void TestMethod() 21 | { 22 | var set1 = new HashSet { new("Brad", "Wilson") }; 23 | var set2 = new HashSet { new("BRAD", "WILSON") }; 24 | 25 | Assert.Equal(set1, set2, 26 | (Person x, Person y) => 27 | x.FirstName.Equals(y.FirstName, StringComparison.CurrentCultureIgnoreCase) && 28 | x.LastName.Equals(y.LastName, StringComparison.CurrentCultureIgnoreCase) 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2027.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xunit; 3 | 4 | public class xUnit2027 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var expected = new List { 2112, 42 }; 10 | var actual = new HashSet { 42, 2112 }; 11 | 12 | Assert.Equal(expected, actual); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2028.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | #if NETCOREAPP || NET462_OR_GREATER 5 | using Microsoft.Extensions.Primitives; 6 | #endif 7 | 8 | public class xUnit2028 9 | { 10 | [Fact] 11 | public void TestMethod() 12 | { 13 | Assert.Empty(new ArraySegment()); 14 | Assert.NotEmpty(new ArraySegment()); 15 | 16 | #if NETCOREAPP || NET462_OR_GREATER 17 | Assert.Empty(StringValues.Empty); 18 | Assert.NotEmpty(StringValues.Empty); 19 | #endif 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2029.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Xunit; 3 | 4 | public class xUnit2029 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var collection = new[] { 1, 2, 3 }; 10 | 11 | Assert.Empty(collection.Where(i => i % 2 == 0)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2030.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Xunit; 3 | 4 | public class xUnit2030 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | var collection = new[] { 1, 2, 3 }; 10 | 11 | Assert.NotEmpty(collection.Where(i => i % 2 == 0)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2031.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Xunit; 3 | 4 | public class xUnit2031 5 | { 6 | [Fact] 7 | public void TestMethod() 8 | { 9 | int[] collection = [1, 3, 5, 6, 9]; 10 | 11 | Assert.Single(collection.Where(i => i % 2 == 0)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /analyzers/common/2xxx_Assertions/xUnit2032.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit2032 4 | { 5 | [Fact] 6 | public void TestMethod() 7 | { 8 | Assert.IsAssignableFrom("Hello world"); 9 | Assert.IsNotAssignableFrom("Hello world"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /analyzers/v2-abstractions/v2-abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(DefineConstants);XUNIT_V2 5 | 12.0 6 | enable 7 | net452;net8.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /analyzers/v2-core/v2-core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(DefineConstants);XUNIT_V2;XUNIT_EXTENSIBILITY 5 | 12.0 6 | enable 7 | net452;net8.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /analyzers/v2-execution/v2-execution.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(DefineConstants);XUNIT_V2;XUNIT_EXTENSIBILITY 5 | 12.0 6 | enable 7 | net452;net8.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /analyzers/v2-full/1xxx_Usage/xUnit1028.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | public class xUnit1028 5 | { 6 | [Fact] 7 | public int InvalidReturnType() 8 | { 9 | return 42; 10 | } 11 | 12 | [Fact] 13 | public Task InvalidGenericTaskReturnType() 14 | { 15 | return Task.FromResult(42); 16 | } 17 | 18 | // This should trigger, because ValueTask is not supported by v2 (only Task) 19 | [Fact] 20 | public ValueTask ValueTaskUnsupportedInV2() 21 | { 22 | return default; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /analyzers/v2-full/1xxx_Usage/xUnit1048.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1048 4 | { 5 | // async void is not allowed 6 | [Fact] 7 | public async void TestMethod1() { } 8 | 9 | // non-async void is fine 10 | [Fact] 11 | public void TestMethod2() { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/v2-full/3xxx_Extensibility/xUnit3000.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Xunit.Abstractions; 4 | 5 | // This can only be auto-fixed in v2-execution or v2-full because it needs the reference to xunit.execution.{platform} 6 | public class xUnit3000 : ITestCase 7 | { 8 | public string DisplayName => 9 | throw new NotImplementedException(); 10 | 11 | public string SkipReason => 12 | throw new NotImplementedException(); 13 | 14 | public ISourceInformation SourceInformation 15 | { 16 | get => throw new NotImplementedException(); 17 | set => throw new NotImplementedException(); 18 | } 19 | 20 | public ITestMethod TestMethod => 21 | throw new NotImplementedException(); 22 | 23 | public object[] TestMethodArguments => 24 | throw new NotImplementedException(); 25 | 26 | public Dictionary> Traits => 27 | throw new NotImplementedException(); 28 | 29 | public string UniqueID => 30 | throw new NotImplementedException(); 31 | 32 | public void Deserialize(IXunitSerializationInfo info) => 33 | throw new NotImplementedException(); 34 | 35 | public void Serialize(IXunitSerializationInfo info) => 36 | throw new NotImplementedException(); 37 | } 38 | -------------------------------------------------------------------------------- /analyzers/v2-full/3xxx_Extensibility/xUnit3001.cs: -------------------------------------------------------------------------------- 1 | using Xunit.Abstractions; 2 | 3 | public class xUnit3001 : IXunitSerializable 4 | { 5 | // Need at least one ctor so the auto-generated ctor doesn't satisfy the rule 6 | public xUnit3001(int _) { } 7 | 8 | public void Deserialize(IXunitSerializationInfo info) { } 9 | 10 | public void Serialize(IXunitSerializationInfo info) { } 11 | } 12 | -------------------------------------------------------------------------------- /analyzers/v2-full/v2-full.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(DefineConstants);XUNIT_V2;XUNIT_EXTENSIBILITY 5 | 12.0 6 | enable 7 | net462;net8.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /analyzers/v3-full/1xxx_Usage/xUnit1028.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Xunit; 3 | 4 | public class xUnit1028 5 | { 6 | [Fact] 7 | public int InvalidReturnType() 8 | { 9 | return 42; 10 | } 11 | 12 | [Fact] 13 | public Task InvalidGenericTaskReturnType() 14 | { 15 | return Task.FromResult(42); 16 | } 17 | 18 | // This shouldn't trigger, because v3 supports ValueTask 19 | [Fact] 20 | public ValueTask ValueTaskSupportedInV3() 21 | { 22 | return default; 23 | } 24 | 25 | [Fact] 26 | public ValueTask InvalidGenericValueTaskReturnType() 27 | { 28 | return new(42); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /analyzers/v3-full/1xxx_Usage/xUnit1046.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xunit; 3 | 4 | public class xUnit1046 5 | { 6 | public sealed class NonSerializable { } 7 | 8 | public IEnumerable Method() 9 | { 10 | yield return new TheoryDataRow(new NonSerializable()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/v3-full/1xxx_Usage/xUnit1047.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xunit; 3 | 4 | public class xUnit1047 5 | { 6 | public class MaybeSerializable { } 7 | 8 | public IEnumerable Method() 9 | { 10 | yield return new TheoryDataRow(default(MaybeSerializable)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/v3-full/1xxx_Usage/xUnit1049.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class xUnit1049 4 | { 5 | // async void is not allowed 6 | [Fact] 7 | public async void TestMethod1() { } 8 | 9 | // non-async void is fine 10 | [Fact] 11 | public void TestMethod2() { } 12 | } 13 | -------------------------------------------------------------------------------- /analyzers/v3-full/1xxx_Usage/xUnit1050.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Threading; 5 | using Xunit; 6 | 7 | public class xUnit1050 8 | { 9 | [Theory] 10 | [ClassData(typeof(EnumerableData))] 11 | [ClassData(typeof(AsyncEnumerableData))] 12 | public void TestMethod(int _) { } 13 | 14 | public class EnumerableData : IEnumerable 15 | { 16 | public IEnumerator GetEnumerator() => throw new NotImplementedException(); 17 | IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedException(); 18 | } 19 | 20 | public class AsyncEnumerableData : IAsyncEnumerable 21 | { 22 | public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default) => throw new NotImplementedException(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /analyzers/v3-full/1xxx_Usage/xUnit1051.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | public class xUnit1051 6 | { 7 | [Fact] 8 | public async ValueTask TestMethod() 9 | { 10 | await Task.Delay(1); 11 | await Record.ExceptionAsync(() => Task.Delay(1)); 12 | await Assert.ThrowsAsync(() => Task.Delay(1)); 13 | Assert.Collection( 14 | Array.Empty(), 15 | x => Task.Delay(1), 16 | x => Task.Delay(2) 17 | ); 18 | 19 | var _ = async () => await Task.Delay(1); 20 | Task LocalMethod() => Task.Delay(1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /analyzers/v3-full/3xxx_Extensibility/xUnit3001.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Threading.Tasks; 5 | using Xunit.Runner.Common; 6 | using Xunit.Sdk; 7 | 8 | public class xUnit3001 : IXunitSerializable 9 | { 10 | // Need at least one ctor so the auto-generated ctor doesn't satisfy the rule 11 | public xUnit3001(int _) { } 12 | 13 | public void Deserialize(IXunitSerializationInfo info) { } 14 | 15 | public void Serialize(IXunitSerializationInfo info) { } 16 | } 17 | 18 | [JsonTypeID("json-type")] 19 | public class xUnit3001Json : IJsonSerializable, IJsonDeserializable 20 | { 21 | // Need at least one ctor so the auto-generated ctor doesn't satisfy the rule 22 | public xUnit3001Json(int _) { } 23 | 24 | public void FromJson(IReadOnlyDictionary root) { } 25 | 26 | public string? ToJson() => "{}"; 27 | } 28 | 29 | public class xUnit3001Serializer : IXunitSerializer 30 | { 31 | // Need at least one ctor so the auto-generated ctor doesn't satisfy the rule 32 | public xUnit3001Serializer(int _) { } 33 | 34 | public object Deserialize(Type type, string serializedValue) => new(); 35 | 36 | public bool IsSerializable(Type type, object? value, [NotNullWhen(false)] out string? failureReason) 37 | { 38 | failureReason = null; 39 | return true; 40 | } 41 | 42 | public string Serialize(object value) => string.Empty; 43 | } 44 | 45 | public class xUnit3001Reporter : IRunnerReporter 46 | { 47 | // Need at least one ctor so the auto-generated ctor doesn't satisfy the rule 48 | protected xUnit3001Reporter(int _) { } 49 | 50 | public bool CanBeEnvironmentallyEnabled => false; 51 | 52 | public string Description => string.Empty; 53 | 54 | public bool ForceNoLogo => false; 55 | 56 | public bool IsEnvironmentallyEnabled => false; 57 | 58 | public string? RunnerSwitch => "custom"; 59 | 60 | public ValueTask CreateMessageHandler( 61 | IRunnerLogger logger, 62 | IMessageSink? diagnosticMessageSink) => 63 | throw new NotImplementedException(); 64 | } 65 | -------------------------------------------------------------------------------- /analyzers/v3-full/3xxx_Extensibility/xUnit3002.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit2007 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using Xunit; 7 | using Xunit.Sdk; 8 | using Xunit.v3; 9 | 10 | public class Xunit3002 : IMessageSink 11 | { 12 | public class GenericClass { } 13 | 14 | public static DiscoveryComplete Factory1() => 15 | new() { AssemblyUniqueID = "id", TestCasesToRun = 42 }; 16 | 17 | public static DiscoveryComplete Factory2() => 18 | new DiscoveryComplete() { AssemblyUniqueID = "id", TestCasesToRun = 42 }; 19 | 20 | public bool OnMessage(IMessageSinkMessage message) 21 | { 22 | if (message is DiscoveryComplete) 23 | Console.WriteLine("Discovery is finished!"); 24 | if (message is not DiscoveryComplete) 25 | Console.WriteLine("Discovery is not finished!"); 26 | if (message is GenericClass) 27 | Console.WriteLine("Discovery is finished!"); 28 | if (message is IEnumerable) 29 | Console.WriteLine("Discovery is finished!"); 30 | 31 | Console.WriteLine(message as DiscoveryComplete); 32 | Console.WriteLine((DiscoveryComplete)message); 33 | 34 | Assert.Empty(Array.Empty().OfType()); 35 | Assert.IsType(message); 36 | Assert.IsType(typeof(DiscoveryComplete), message); 37 | 38 | return true; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /analyzers/v3-full/v3-full.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(DefineConstants);XUNIT_V3;XUNIT_EXTENSIBILITY 5 | 12.0 6 | enable 7 | Exe 8 | net472;net8.0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /console/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | msbuild /t:Restore /v:minimal /nologo 4 | 5 | # On non-Windows, use Mono to run all .NET Framework projects 6 | 7 | msbuild /v:minimal /nologo v2x_net472/v2x_net472.csproj 8 | 9 | # We can use .NET SDK for any SDK style project 10 | 11 | dotnet build -v:minimal --nologo v2x_net472_Sdk/v2x_net472_Sdk.csproj -tl:off 12 | dotnet build -v:minimal --nologo v3x_net472/v3x_net472.csproj -tl:off 13 | dotnet build -v:minimal --nologo v3x_net80/v3x_net80.csproj -tl:off 14 | -------------------------------------------------------------------------------- /console/build.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | #Requires -Version 5.1 3 | 4 | msbuild /t:Restore /v:minimal /nologo 5 | 6 | # Have to use .NET Framework MSBuild for non-SDK style projects 7 | msbuild /v:minimal /nologo v2x_net472/v2x_net472.csproj 8 | 9 | # We can use .NET MSBuild for any SDK style project 10 | write-host "" 11 | dotnet msbuild /v:minimal /nologo v2x_net472_Sdk/v2x_net472_Sdk.csproj -tl:off 12 | write-host "" 13 | dotnet msbuild /v:minimal /nologo v3x_net472/v3x_net472.csproj -tl:off 14 | write-host "" 15 | dotnet msbuild /v:minimal /nologo v3x_net80/v3x_net80.csproj -tl:off 16 | -------------------------------------------------------------------------------- /console/console.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.16 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v2x_net472", "v2x_net472\v2x_net472.csproj", "{A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2x_net472_Sdk", "v2x_net472_Sdk\v2x_net472_Sdk.csproj", "{71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v3x_net472", "v3x_net472\v3x_net472.csproj", "{D4856917-B8C2-483B-AD67-6E02E44C9B3A}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v3x_net80", "v3x_net80\v3x_net80.csproj", "{B40E40BB-25F5-416B-A951-54FD8DE411B9}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {D4856917-B8C2-483B-AD67-6E02E44C9B3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {D4856917-B8C2-483B-AD67-6E02E44C9B3A}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {D4856917-B8C2-483B-AD67-6E02E44C9B3A}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {D4856917-B8C2-483B-AD67-6E02E44C9B3A}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {B40E40BB-25F5-416B-A951-54FD8DE411B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {B40E40BB-25F5-416B-A951-54FD8DE411B9}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {B40E40BB-25F5-416B-A951-54FD8DE411B9}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {B40E40BB-25F5-416B-A951-54FD8DE411B9}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {E28997FD-9098-4508-8091-8F1C3B952324} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /console/v2x_net472/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v2x_net472")] 20 | [InlineData(null)] 21 | public void Theory(object value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /console/v2x_net472/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("v2x_net452")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("v2x_net452")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a701aff7-15d4-4320-8ffc-ee5622dc9db4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /console/v2x_net472/v2x_net472.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4} 7 | Library 8 | Properties 9 | v2x_net472 10 | v2x_net472 11 | v4.7.2 12 | 512 13 | 14 | 15 | true 16 | full 17 | false 18 | bin\Debug\ 19 | DEBUG;TRACE 20 | prompt 21 | 4 22 | 23 | 24 | pdbonly 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | 31 | 32 | 33 | 34 | runtime; build; native; contentfiles; analyzers 35 | all 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /console/v2x_net472_Sdk/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v2x_net472_Sdk")] 20 | [InlineData(null)] 21 | public void Theory(object value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /console/v2x_net472_Sdk/v2x_net472_Sdk.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net472 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /console/v3x_net472/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v3x_net472")] 20 | [InlineData(new object?[] { null })] 21 | public void Theory(object? value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /console/v3x_net472/v3x_net472.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | 10.0 6 | enable 7 | Exe 8 | net472 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /console/v3x_net80/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v3x_net80")] 20 | [InlineData(new object?[] { null })] 21 | public void Theory(object? value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /console/v3x_net80/v3x_net80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | 10.0 6 | enable 7 | Exe 8 | net8.0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /console/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnosticMessages": true, 3 | "internalDiagnosticMessages": true 4 | } -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.100", 4 | "rollForward": "latestMinor" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /msbuild/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Restore and build first so the xunit MSBuild task can be found 4 | 5 | msbuild /t:"Restore;Build" /v:minimal /nologo 6 | 7 | # v2 projects require the .NET Framework version of MSBuild 8 | 9 | msbuild /t:XunitTest /v:minimal /nologo v2x_net472/v2x_net472.csproj 10 | msbuild /t:XunitTest /v:minimal /nologo v2x_net472_Sdk/v2x_net472_Sdk.csproj 11 | 12 | # v3 projects can use the .NET version of MSBuild, even for .NET Framework projects 13 | 14 | dotnet build -t:XunitTest -v:minimal --nologo v3x_net472/v3x_net472.csproj -tl:off 15 | dotnet build -t:XunitTest -v:minimal --nologo v3x_net80/v3x_net80.csproj -tl:off 16 | -------------------------------------------------------------------------------- /msbuild/build.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | #Requires -Version 5.1 3 | 4 | # Restore and build first so the xunit MSBuild task can be found 5 | 6 | msbuild /t:"Restore;Build" /v:minimal /nologo 7 | 8 | # v2 projects require the .NET Framework version of MSBuild 9 | 10 | msbuild /t:XunitTest /v:minimal /nologo v2x_net472\v2x_net472.csproj 11 | msbuild /t:XunitTest /v:minimal /nologo v2x_net472_Sdk\v2x_net472_Sdk.csproj 12 | 13 | # v3 projects can use the .NET version of MSBuild, even for .NET Framework projects 14 | 15 | write-host "" 16 | dotnet msbuild /t:XunitTest /v:minimal /nologo v3x_net472\v3x_net472.csproj -tl:off 17 | write-host "" 18 | dotnet msbuild /t:XunitTest /v:minimal /nologo v3x_net80\v3x_net80.csproj -tl:off 19 | -------------------------------------------------------------------------------- /msbuild/msbuild.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.16 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v2x_net472", "v2x_net472\v2x_net472.csproj", "{A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2x_net472_Sdk", "v2x_net472_Sdk\v2x_net472_Sdk.csproj", "{71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v3x_net472", "v3x_net472\v3x_net472.csproj", "{4FCDB11E-9A3D-4C18-9BC1-AB548A55D28F}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v3x_net80", "v3x_net80\v3x_net80.csproj", "{96A6FEAE-E66E-4AA2-BC16-FD51DD5C543C}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {71A5D7DB-8178-40B9-B884-BE3BE1BC4A39}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {4FCDB11E-9A3D-4C18-9BC1-AB548A55D28F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {4FCDB11E-9A3D-4C18-9BC1-AB548A55D28F}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {4FCDB11E-9A3D-4C18-9BC1-AB548A55D28F}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {4FCDB11E-9A3D-4C18-9BC1-AB548A55D28F}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {96A6FEAE-E66E-4AA2-BC16-FD51DD5C543C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {96A6FEAE-E66E-4AA2-BC16-FD51DD5C543C}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {96A6FEAE-E66E-4AA2-BC16-FD51DD5C543C}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {96A6FEAE-E66E-4AA2-BC16-FD51DD5C543C}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {1B008A7A-E483-4DE9-905D-0531245A9E82} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /msbuild/v2x_net472/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v2x_net472")] 20 | [InlineData(null)] 21 | public void Theory(object value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /msbuild/v2x_net472/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("v2x_net452")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("v2x_net452")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a701aff7-15d4-4320-8ffc-ee5622dc9db4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /msbuild/v2x_net472/v2x_net472.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {A701AFF7-15D4-4320-8FFC-EE5622DC9DB4} 7 | Library 8 | Properties 9 | v2x_net472 10 | v2x_net472 11 | v4.7.2 12 | 512 13 | 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | all 37 | runtime; build; native; contentfiles; analyzers 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /msbuild/v2x_net472_Sdk/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v2x_net472_Sdk")] 20 | [InlineData(null)] 21 | public void Theory(object value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /msbuild/v2x_net472_Sdk/v2x_net472_Sdk.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net472 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /msbuild/v3x_net472/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v3x_net472")] 20 | [InlineData(new object?[] { null })] 21 | public void Theory(object? value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /msbuild/v3x_net472/v3x_net472.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | 10.0 6 | enable 7 | Exe 8 | net472 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /msbuild/v3x_net80/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v3x_net80")] 20 | [InlineData(new object?[] { null })] 21 | public void Theory(object? value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /msbuild/v3x_net80/v3x_net80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | 10.0 6 | enable 7 | Exe 8 | net8.0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /msbuild/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnosticMessages": true, 3 | "internalDiagnosticMessages": true 4 | } -------------------------------------------------------------------------------- /test-explorer/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | false 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test-explorer/MSTest_and_v2x/BasicTests_MSTest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | [TestClass] 4 | public class BasicTests_MSTest 5 | { 6 | [TestMethod] 7 | public void Passing() 8 | { 9 | Assert.IsTrue(true); 10 | } 11 | 12 | [TestMethod] 13 | public void Failing() 14 | { 15 | Assert.IsTrue(false); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test-explorer/MSTest_and_v2x/BasicTests_xUnit.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests_xUnit 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from MSTest_and_v2x")] 20 | [InlineData(null)] 21 | public void Theory(object value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-explorer/MSTest_and_v2x/MSTest_and_v2x.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net472 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | all 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test-explorer/test-explorer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31903.59 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v1.x", "v1.x", "{1CB9E83A-632D-455F-8F54-337825D93B98}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v1x_net472", "v1x_net472\v1x_net472.csproj", "{151EA37B-8961-4AAD-96E2-F76A197FB758}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v2.x", "v2.x", "{ECC72FCC-0DA7-4918-9BF6-C2EF44153686}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSTest_and_v2x", "MSTest_and_v2x\MSTest_and_v2x.csproj", "{D2C2411E-EC2D-4D03-A612-18464E3D3575}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2x_net472", "v2x_net472\v2x_net472.csproj", "{80C94E18-4A68-4A9B-9411-2746D2DA1671}" 15 | EndProject 16 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "v2x_net472_FSharp", "v2x_net472_FSharp\v2x_net472_FSharp.fsproj", "{399C35BA-A635-4888-A869-7B89FED41D68}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "v2x_net472_OldProject", "v2x_net472_OldProject\v2x_net472_OldProject.csproj", "{06D874BC-29FE-4B68-AA7F-B4654AA4520A}" 19 | EndProject 20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2x_net472_ReferencingProject", "v2x_net472_ReferencingProject\v2x_net472_ReferencingProject.csproj", "{B15AFC6F-D6DA-4F24-B120-0757651C68D4}" 21 | EndProject 22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2x_net80", "v2x_net80\v2x_net80.csproj", "{AD22995C-97BD-4D5E-87F8-3B640D4D4B62}" 23 | EndProject 24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v3.x", "v3.x", "{84DBDE1A-6BE7-485A-819A-95042D690461}" 25 | EndProject 26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v3x_net472", "v3x_net472\v3x_net472.csproj", "{572D3DF1-9AFA-4955-B48B-B31856526240}" 27 | EndProject 28 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v3x_net80", "v3x_net80\v3x_net80.csproj", "{E684A394-4EAF-475B-8EE6-7CDDDEBF0ECE}" 29 | EndProject 30 | Global 31 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 32 | Debug|Any CPU = Debug|Any CPU 33 | Release|Any CPU = Release|Any CPU 34 | EndGlobalSection 35 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 36 | {151EA37B-8961-4AAD-96E2-F76A197FB758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {151EA37B-8961-4AAD-96E2-F76A197FB758}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {151EA37B-8961-4AAD-96E2-F76A197FB758}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {151EA37B-8961-4AAD-96E2-F76A197FB758}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {D2C2411E-EC2D-4D03-A612-18464E3D3575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {D2C2411E-EC2D-4D03-A612-18464E3D3575}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {D2C2411E-EC2D-4D03-A612-18464E3D3575}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {D2C2411E-EC2D-4D03-A612-18464E3D3575}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {80C94E18-4A68-4A9B-9411-2746D2DA1671}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {80C94E18-4A68-4A9B-9411-2746D2DA1671}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {80C94E18-4A68-4A9B-9411-2746D2DA1671}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {80C94E18-4A68-4A9B-9411-2746D2DA1671}.Release|Any CPU.Build.0 = Release|Any CPU 48 | {399C35BA-A635-4888-A869-7B89FED41D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {399C35BA-A635-4888-A869-7B89FED41D68}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {399C35BA-A635-4888-A869-7B89FED41D68}.Release|Any CPU.ActiveCfg = Release|Any CPU 51 | {399C35BA-A635-4888-A869-7B89FED41D68}.Release|Any CPU.Build.0 = Release|Any CPU 52 | {06D874BC-29FE-4B68-AA7F-B4654AA4520A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 53 | {06D874BC-29FE-4B68-AA7F-B4654AA4520A}.Debug|Any CPU.Build.0 = Debug|Any CPU 54 | {06D874BC-29FE-4B68-AA7F-B4654AA4520A}.Release|Any CPU.ActiveCfg = Release|Any CPU 55 | {06D874BC-29FE-4B68-AA7F-B4654AA4520A}.Release|Any CPU.Build.0 = Release|Any CPU 56 | {B15AFC6F-D6DA-4F24-B120-0757651C68D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 57 | {B15AFC6F-D6DA-4F24-B120-0757651C68D4}.Debug|Any CPU.Build.0 = Debug|Any CPU 58 | {B15AFC6F-D6DA-4F24-B120-0757651C68D4}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {B15AFC6F-D6DA-4F24-B120-0757651C68D4}.Release|Any CPU.Build.0 = Release|Any CPU 60 | {AD22995C-97BD-4D5E-87F8-3B640D4D4B62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 61 | {AD22995C-97BD-4D5E-87F8-3B640D4D4B62}.Debug|Any CPU.Build.0 = Debug|Any CPU 62 | {AD22995C-97BD-4D5E-87F8-3B640D4D4B62}.Release|Any CPU.ActiveCfg = Release|Any CPU 63 | {AD22995C-97BD-4D5E-87F8-3B640D4D4B62}.Release|Any CPU.Build.0 = Release|Any CPU 64 | {572D3DF1-9AFA-4955-B48B-B31856526240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 65 | {572D3DF1-9AFA-4955-B48B-B31856526240}.Debug|Any CPU.Build.0 = Debug|Any CPU 66 | {572D3DF1-9AFA-4955-B48B-B31856526240}.Release|Any CPU.ActiveCfg = Release|Any CPU 67 | {572D3DF1-9AFA-4955-B48B-B31856526240}.Release|Any CPU.Build.0 = Release|Any CPU 68 | {E684A394-4EAF-475B-8EE6-7CDDDEBF0ECE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 69 | {E684A394-4EAF-475B-8EE6-7CDDDEBF0ECE}.Debug|Any CPU.Build.0 = Debug|Any CPU 70 | {E684A394-4EAF-475B-8EE6-7CDDDEBF0ECE}.Release|Any CPU.ActiveCfg = Release|Any CPU 71 | {E684A394-4EAF-475B-8EE6-7CDDDEBF0ECE}.Release|Any CPU.Build.0 = Release|Any CPU 72 | EndGlobalSection 73 | GlobalSection(SolutionProperties) = preSolution 74 | HideSolutionNode = FALSE 75 | EndGlobalSection 76 | GlobalSection(NestedProjects) = preSolution 77 | {151EA37B-8961-4AAD-96E2-F76A197FB758} = {1CB9E83A-632D-455F-8F54-337825D93B98} 78 | {D2C2411E-EC2D-4D03-A612-18464E3D3575} = {ECC72FCC-0DA7-4918-9BF6-C2EF44153686} 79 | {80C94E18-4A68-4A9B-9411-2746D2DA1671} = {ECC72FCC-0DA7-4918-9BF6-C2EF44153686} 80 | {399C35BA-A635-4888-A869-7B89FED41D68} = {ECC72FCC-0DA7-4918-9BF6-C2EF44153686} 81 | {06D874BC-29FE-4B68-AA7F-B4654AA4520A} = {ECC72FCC-0DA7-4918-9BF6-C2EF44153686} 82 | {B15AFC6F-D6DA-4F24-B120-0757651C68D4} = {ECC72FCC-0DA7-4918-9BF6-C2EF44153686} 83 | {AD22995C-97BD-4D5E-87F8-3B640D4D4B62} = {ECC72FCC-0DA7-4918-9BF6-C2EF44153686} 84 | {572D3DF1-9AFA-4955-B48B-B31856526240} = {84DBDE1A-6BE7-485A-819A-95042D690461} 85 | {E684A394-4EAF-475B-8EE6-7CDDDEBF0ECE} = {84DBDE1A-6BE7-485A-819A-95042D690461} 86 | EndGlobalSection 87 | EndGlobal 88 | -------------------------------------------------------------------------------- /test-explorer/v1x_net472/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | using Xunit.Extensions; 3 | 4 | public class BasicTests 5 | { 6 | [Fact] 7 | public void Passing() 8 | { 9 | Assert.True(true); 10 | } 11 | 12 | [Fact] 13 | public void Failing() 14 | { 15 | Assert.True(false); 16 | } 17 | 18 | [Theory] 19 | [InlineData(2112)] 20 | [InlineData("hello")] 21 | [InlineData(null)] 22 | public void Theory(object value) 23 | { 24 | Assert.NotNull(value); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test-explorer/v1x_net472/RunWithTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Xunit; 5 | using Xunit.Sdk; 6 | 7 | [RunWith(typeof(MyTestClassCommand))] 8 | public class RunWithTests 9 | { 10 | [MyFact] 11 | public void Passing() { } 12 | } 13 | 14 | public class MyFactAttribute : Attribute { } 15 | 16 | public class MyTestCommand : TestCommand 17 | { 18 | private readonly IMethodInfo method; 19 | 20 | public MyTestCommand(IMethodInfo method, string displayName, int timeout) 21 | : base(method, displayName, timeout) 22 | { 23 | this.method = method; 24 | } 25 | 26 | public override MethodResult Execute(object testClass) 27 | { 28 | try 29 | { 30 | throw new DivideByZeroException(); 31 | } 32 | catch (Exception ex) 33 | { 34 | return new FailedResult(method, ex, "Let's do something different here"); 35 | } 36 | } 37 | } 38 | 39 | public class MyTestClassCommand : ITestClassCommand 40 | { 41 | public int ChooseNextTest(ICollection testsLeftToRun) 42 | { 43 | return 0; 44 | } 45 | 46 | public Exception ClassFinish() 47 | { 48 | return null; 49 | } 50 | 51 | public Exception ClassStart() 52 | { 53 | return null; 54 | } 55 | 56 | public IEnumerable EnumerateTestCommands(IMethodInfo testMethod) 57 | { 58 | var myFact = testMethod.GetCustomAttributes(typeof(MyFactAttribute)).FirstOrDefault(); 59 | if (myFact != null) 60 | yield return new MyTestCommand(testMethod, "Hello from MyTestClassCommand!", 0); 61 | } 62 | 63 | public IEnumerable EnumerateTestMethods() 64 | { 65 | foreach (var method in TypeUnderTest.GetMethods()) 66 | if (IsTestMethod(method)) 67 | yield return method; 68 | } 69 | 70 | public bool IsTestMethod(IMethodInfo testMethod) 71 | { 72 | var myFact = testMethod.GetCustomAttributes(typeof(MyFactAttribute)).FirstOrDefault(); 73 | return (myFact != null); 74 | } 75 | 76 | public object ObjectUnderTest 77 | { 78 | get { return null; } 79 | } 80 | 81 | public ITypeInfo TypeUnderTest { get; set; } 82 | } 83 | -------------------------------------------------------------------------------- /test-explorer/v1x_net472/v1x_net472.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net472 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472/AbstractTestClass.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public abstract class AbstractTestClass 4 | { 5 | [Fact] 6 | public void TestHasSourceInfo() { } // made concrete by v2x_net462_ReferencingProject; should not show under v2x_net462, not in the External category 7 | } 8 | 9 | public abstract class GenericAbstractTestClass 10 | { 11 | [Fact] 12 | public void TestHasSourceInfo() { } // made concrete by v2x_net462_ReferencingProject; should not show under v2x_net462, not in the External category 13 | } 14 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472/BasicTests.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1001 2 | #pragma warning disable xUnit1009 3 | #pragma warning disable xUnit1011 4 | #pragma warning disable xUnit1026 5 | 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | using Xunit; 9 | 10 | public class TestClass 11 | { 12 | public static IEnumerable GetData(int[] data1, int[] data2) 13 | { 14 | for (int i = 0; i < data1.Length; i++) 15 | { 16 | yield return new object[] { data1[i], data2[i] }; 17 | } 18 | } 19 | 20 | [Theory] 21 | [MemberData(nameof(GetData), new int[] { 4, 5, 7 }, new int[] { 8, 10, 12 })] 22 | public void RunTest(int data1, int data2) 23 | { 24 | Assert.Equal(data1 * 2, data2); 25 | } 26 | } 27 | 28 | public class BasicTests 29 | { 30 | [Fact] 31 | public void Passing() 32 | { 33 | Assert.True(true); 34 | } 35 | 36 | [Fact] 37 | public void Failing() 38 | { 39 | Assert.True(false); 40 | } 41 | 42 | [Theory] 43 | [InlineData(2112)] 44 | [InlineData("hello from v2x_net472")] 45 | [InlineData(null)] 46 | public void Theory(object value) 47 | { 48 | Assert.NotNull(value); 49 | } 50 | 51 | [Fact] 52 | public void InvalidFact(object x) { } // Facts can't have parameters 53 | 54 | [Theory] 55 | [InlineData(42, "Hello World", 21.12)] // Too much data 56 | [InlineData(2600)] // Not enough data 57 | public void InvalidTheory(int x, string y) { } 58 | 59 | #pragma warning disable xUnit1048 // Avoid using 'async void' for test methods as it is deprecated in xUnit.net v3 60 | 61 | [Fact] 62 | public async void FailingAsyncVoidTest() 63 | { 64 | await Task.Delay(0); 65 | Assert.True(false); 66 | } 67 | 68 | #pragma warning restore xUnit1048 // Avoid using 'async void' for test methods as it is deprecated in xUnit.net v3 69 | 70 | [Fact] 71 | public async Task FailingAsyncTaskTest() 72 | { 73 | await Task.Delay(0); 74 | Assert.True(false); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472/DeserializationFailureTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Xunit; 4 | using Xunit.Abstractions; 5 | using Xunit.Sdk; 6 | 7 | public class DeserializationFailureTests 8 | { 9 | [CustomFact] 10 | public void TestCaseSerializerIsBroken() { } 11 | 12 | [Theory] 13 | [MemberData(nameof(BadTheoryData))] 14 | #pragma warning disable xUnit1026 // Don't need to use the bad data 15 | public void TheoryDataSerializerIsBroken(BadTheoryItem item) { } 16 | #pragma warning restore xUnit1026 17 | 18 | public static TheoryData BadTheoryData = new TheoryData { new BadTheoryItem(42) }; 19 | } 20 | 21 | [XunitTestCaseDiscoverer("CustomFactDiscoverer", "v2x_net452")] 22 | class CustomFactAttribute : FactAttribute { } 23 | 24 | class CustomFactDiscoverer : IXunitTestCaseDiscoverer 25 | { 26 | readonly IMessageSink diagnosticMessageSink; 27 | 28 | public CustomFactDiscoverer(IMessageSink diagnosticMessageSink) 29 | { 30 | this.diagnosticMessageSink = diagnosticMessageSink; 31 | } 32 | 33 | public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) 34 | { 35 | yield return new CustomTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod); 36 | } 37 | } 38 | 39 | class CustomTestCase : XunitTestCase 40 | { 41 | // To make xUnit 3001 go away until fixed 42 | [Obsolete] 43 | public CustomTestCase() { } 44 | 45 | // Configuration problem: failed to provide an empty constructor 46 | 47 | public CustomTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod, object[] testMethodArguments = null) 48 | : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) 49 | { } 50 | } 51 | 52 | public class BadTheoryItem : IXunitSerializable 53 | { 54 | // To make xUnit 3001 go away until fixed 55 | public BadTheoryItem() 56 | { 57 | 58 | } 59 | // Configuration problem: failed to provide an empty constructor 60 | 61 | public BadTheoryItem(int value) 62 | { 63 | Value = value; 64 | } 65 | 66 | public int Value { get; private set; } 67 | 68 | public void Deserialize(IXunitSerializationInfo info) 69 | { 70 | Value = info.GetValue(nameof(Value)); 71 | } 72 | 73 | public void Serialize(IXunitSerializationInfo info) 74 | { 75 | info.AddValue(nameof(Value), Value); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472/DuplicateUniqueIDs.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class DuplicateUniqueIDs 4 | { 5 | [Theory] 6 | [InlineData(2)] 7 | #pragma warning disable xUnit1025 // The purpose is to illustrate duplicates 8 | [InlineData(2)] 9 | #pragma warning restore xUnit1025 10 | #pragma warning disable xUnit1026 // Don't need to use the bad data 11 | public void OneWillBeSkipped(int x) { } 12 | #pragma warning restore xUnit1026 13 | } 14 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472/FixtureFailureTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | public class FailingFixture : IDisposable 5 | { 6 | public void Dispose() 7 | { 8 | throw new NotImplementedException(); 9 | } 10 | } 11 | 12 | public class ClassFixtureFailure : IClassFixture 13 | { 14 | [Fact] 15 | public void Passing() 16 | { 17 | Assert.True(true); 18 | } 19 | 20 | [Fact] 21 | public void Failing() 22 | { 23 | Assert.True(false); 24 | } 25 | } 26 | 27 | [CollectionDefinition("MyCollection")] 28 | public class MyCollection : ICollectionFixture 29 | { 30 | } 31 | 32 | [Collection("MyCollection")] 33 | public class CollectionFixtureFailure 34 | { 35 | [Fact] 36 | public void Passing() 37 | { 38 | Assert.True(true); 39 | } 40 | 41 | [Fact] 42 | public void Failing() 43 | { 44 | Assert.True(false); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472/FixtureWithMixedFactAndTheory.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable xUnit1026 2 | 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using System.Threading; 6 | using Xunit; 7 | 8 | public class FixtureWithMixedFactAndTheory : IClassFixture 9 | { 10 | Fixture fixture; 11 | 12 | public FixtureWithMixedFactAndTheory(Fixture fixture) 13 | { 14 | this.fixture = fixture; 15 | } 16 | 17 | [Theory] 18 | [ClassData(typeof(InlineConfigurations))] 19 | public void Theory1(ClassConf conf) 20 | { 21 | Assert.Equal(1, fixture.ConstructorIteration); 22 | } 23 | 24 | [Theory] 25 | [InlineData(42)] 26 | [InlineData(2112)] 27 | public void Theory2(int data) 28 | { 29 | Assert.Equal(1, fixture.ConstructorIteration); 30 | } 31 | 32 | [Fact] 33 | public void Fact1() 34 | { 35 | Assert.Equal(1, fixture.ConstructorIteration); 36 | } 37 | 38 | [Fact] 39 | public void Fact2() 40 | { 41 | Assert.Equal(1, fixture.ConstructorIteration); 42 | } 43 | 44 | public class ClassConf 45 | { 46 | public int Id { get; set; } 47 | 48 | public string Title { get; set; } 49 | 50 | } 51 | 52 | public class Fixture 53 | { 54 | public static long StaticConstructorCount = 0L; 55 | 56 | public readonly long ConstructorIteration; 57 | 58 | public Fixture() 59 | { 60 | ConstructorIteration = Interlocked.Increment(ref StaticConstructorCount); 61 | } 62 | } 63 | 64 | public class InlineConfigurations : IEnumerable 65 | { 66 | private readonly List confs = new List(); 67 | 68 | public InlineConfigurations() 69 | { 70 | confs.Add(new object[] { new ClassConf{ 71 | Id = 100, 72 | Title = "Title 1" 73 | } }); 74 | 75 | confs.Add(new object[] { new ClassConf{ 76 | Id = 200, 77 | Title = "Title 2" 78 | } }); 79 | 80 | confs.Add(new object[] { new ClassConf{ 81 | Id = 300, 82 | Title = "Title 3" 83 | } }); 84 | } 85 | 86 | public IEnumerator GetEnumerator() => confs.GetEnumerator(); 87 | 88 | IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472/v2x_net472.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net472 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | all 16 | runtime; build; native; contentfiles; analyzers 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472_FSharp/BasicTests.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp 2 | 3 | open Xunit 4 | 5 | type BasicTests() = 6 | [] 7 | member _.Passing() = 8 | Assert.True true 9 | 10 | [] 11 | member _.Failing() = 12 | Assert.True false 13 | 14 | [] 15 | [] 16 | [] 17 | [] 18 | member _.Theory(value:string) = 19 | Assert.NotNull value 20 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472_FSharp/v2x_net472_FSharp.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net472 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | all 22 | runtime; build; native; contentfiles; analyzers 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472_OldProject/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from x2x_net472_OldProject")] 20 | [InlineData(null)] 21 | public void Theory(object value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472_OldProject/v2x_net472_OldProject.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {06D874BC-29FE-4B68-AA7F-B4654AA4520A} 7 | Library 8 | Properties 9 | v2x_net472_OldProject 10 | v2x_net472_OldProject 11 | v4.7.2 12 | 512 13 | 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | runtime; build; native; contentfiles; analyzers 40 | all 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472_ReferencingProject/ConcreteTestClass.cs: -------------------------------------------------------------------------------- 1 | public class ConcreteTestClass : AbstractTestClass 2 | { 3 | } 4 | 5 | public class ConcreteGenericTestClass : GenericAbstractTestClass 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472_ReferencingProject/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("v2x_net45_referencingproject")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("v2x_net45_referencingproject")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b15afc6f-d6da-4f24-b120-0757651c68d4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /test-explorer/v2x_net472_ReferencingProject/v2x_net472_ReferencingProject.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net472 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test-explorer/v2x_net80/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v2x_net6.0")] 20 | [InlineData(null)] 21 | public void Theory(object value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-explorer/v2x_net80/v2x_net80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | all 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test-explorer/v3x_net472/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v3x_net472")] 20 | [InlineData(new object?[] { null })] 21 | public void Theory(object? value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-explorer/v3x_net472/v3x_net472.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | 10.0 6 | enable 7 | Exe 8 | net472 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test-explorer/v3x_net80/BasicTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | public class BasicTests 4 | { 5 | [Fact] 6 | public void Passing() 7 | { 8 | Assert.True(true); 9 | } 10 | 11 | [Fact] 12 | public void Failing() 13 | { 14 | Assert.True(false); 15 | } 16 | 17 | [Theory] 18 | [InlineData(2112)] 19 | [InlineData("hello from v3x_net80")] 20 | [InlineData(new object?[] { null })] 21 | public void Theory(object? value) 22 | { 23 | Assert.NotNull(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-explorer/v3x_net80/v3x_net80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | 10.0 6 | enable 7 | Exe 8 | net8.0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test-explorer/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnosticMessages": true, 3 | "internalDiagnosticMessages": true 4 | } --------------------------------------------------------------------------------