Usage Analyzers

ID Title
xUnit1000 Error Test classes must be public
xUnit1001 Error Fact methods cannot have parameters
xUnit1002 Error Test methods cannot have multiple Fact or Theory attributes
xUnit1003 Error Theory methods must have test data
xUnit1004 Info Test methods should not be skipped
xUnit1005 Warning Fact methods should not have test data
xUnit1006 Warning Theory methods should have parameters
xUnit1007 Error ClassData must point at a valid class
xUnit1008 Warning Test data attribute should only be used on a Theory
xUnit1009 Error InlineData values must match the number of method parameters
xUnit1010 Error The value is not convertible to the method parameter type
xUnit1011 Error There is no matching method parameter
xUnit1012 Warning Null should not be used for value type parameters
xUnit1013 Warning Public method should be marked as test
xUnit1014 Warning MemberData should use nameof operator for member name
xUnit1015 Error MemberData must reference an existing member
xUnit1016 Error MemberData must reference a public member
xUnit1017 Error MemberData must reference a static member
xUnit1018 Error MemberData must reference a valid member kind
xUnit1019 Error MemberData must reference a member providing a valid data type
xUnit1020 Error MemberData must reference a property with a getter
xUnit1021 Warning MemberData should not have parameters if the referenced member is not a method
xUnit1022 Error Theory methods cannot have a parameter array
xUnit1023 Error Theory methods cannot have default parameter values
xUnit1024 Error Test methods cannot have overloads
xUnit1025 Warning InlineData should be unique within the Theory it belongs to
xUnit1026 Warning Theory methods should use all of their parameters
xUnit1027 Error Collection definition classes must be public
xUnit1028 Error Test method must have valid return type
xUnit1029 Error Local functions cannot be test functions
xUnit1030 Warning Do not call ConfigureAwait in test method
xUnit1031 Warning Do not use blocking task operations in test method
xUnit1032 Error Test classes cannot be nested within a generic class
xUnit1033 Info Test classes decorated with 'Xunit.IClassFixture' or 'Xunit.ICollectionFixture' should add a constructor argument of type TFixture
xUnit1034 Warning Null should only be used for nullable parameters
xUnit1035 Error The value is not convertible to the method parameter type
xUnit1036 Error There is no matching method parameter
xUnit1037 Error There are fewer theory data type arguments than required by the parameters of the test method
xUnit1038 Error There are more theory data type arguments than allowed by the parameters of the test method
xUnit1039 Error The type argument to theory data is not compatible with the type of the corresponding test method parameter
xUnit1040 Warning The type argument to theory data is nullable, while the type of the corresponding test method parameter is not
xUnit1041 Warning Fixture arguments to test classes must have fixture sources
xUnit1042 Info The member referenced by the MemberData attribute returns untyped data rows
xUnit1043 Error Constructors on classes derived from FactAttribute must be public when used on test methods
xUnit1044 Info Avoid using TheoryData type arguments that are not serializable
xUnit1045 Info Avoid using TheoryData type arguments that might not be serializable
xUnit1046 Info Avoid using TheoryDataRow arguments that are not serializable
xUnit1047 Info Avoid using TheoryDataRow arguments that might not be serializable
xUnit1048 Warning Avoid using 'async void' for test methods as it is deprecated in xUnit.net v3
xUnit1049 Error Do not use 'async void' for test methods as it is no longer supported
xUnit1050 Info The class referenced by the ClassData attribute returns untyped data rows

Assertion Analyzers

ID Title
xUnit2000 Warning Constants and literals should be the expected argument
xUnit2001 Hidden Do not use invalid equality check
xUnit2002 Warning Do not use null check on value type
xUnit2003 Warning Do not use equality check to test for null value
xUnit2004 Warning Do not use equality check to test for boolean conditions
xUnit2005 Warning Do not use identity check on value type
xUnit2006 Warning Do not use invalid string equality check
xUnit2007 Warning Do not use typeof expression to check the type
xUnit2008 Warning Do not use boolean check to match on regular expressions
xUnit2009 Warning Do not use boolean check to check for substrings
xUnit2010 Warning Do not use boolean check to check for string equality
xUnit2011 Warning Do not use empty collection check
xUnit2012 Warning Do not use Enumerable.Any() to check if a value exists in a collection
xUnit2013 Warning Do not use equality check to check for collection size.
xUnit2014 Error Do not use throws check to check for asynchronously thrown exception
xUnit2015 Warning Do not use typeof expression to check the exception type
xUnit2016 Error Keep precision in the allowed range when asserting equality of doubles or decimals.
xUnit2017 Warning Do not use Contains() to check if a value exists in a collection
xUnit2018 Warning Do not compare an object's exact type to an abstract class or interface
xUnit2019 Hidden Do not use obsolete throws check to check for asynchronously thrown exception
xUnit2020 Warning Do not use always-failing boolean assertion to fail a test
xUnit2021 Error Async assertions should be awaited
xUnit2022 Info Boolean assertions should not be negated
xUnit2023 Info Do not use collection methods for single-item collections
xUnit2024 Info Do not use boolean asserts for simple equality tests
xUnit2025 Info The boolean assertion statement can be simplified
xUnit2026 Warning Comparison of sets must be done with IEqualityComparer
xUnit2027 Warning Comparison of sets to linear containers have undefined results
xUnit2028 Warning Do not use Assert.Empty or Assert.NotEmpty with problematic types

Extensibility Analyzers

ID Title
xUnit3000 Error Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject
xUnit3001 Error Classes that implement Xunit.Abstractions.IXunitSerializable must have a public parameterless constructor
Copyright © .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit/tree/gh-pages.