Skip to content

NUnit Analyzers

Mikkel Nylander Bundgaard edited this page Apr 25, 2020 · 2 revisions

Analyzers

Id Title Enabled by Default
NUnit1001 The individual arguments provided by a TestCaseAttribute must match the type of the matching parameter of the method.
NUnit1002 TestCaseSource should use nameof operator to specify target.
NUnit1003 Too few arguments provided by TestCaseAttribute.
NUnit1004 Too many arguments provided by TestCaseAttribute.
NUnit1005 The type of ExpectedResult must match the return type.
NUnit1006 ExpectedResult must not be specified when the method returns void.
NUnit1007 Method has non-void return type, but no result is expected in ExpectedResult.
NUnit1008 Specifying ParallelScope.Self on assembly level has no effect.
NUnit1009 No ParallelScope.Children on a non-parameterized test method.
NUnit1010 No ParallelScope.Fixtures on a test method.
NUnit1011 TestCaseSource argument does not specify an existing member.
NUnit1012 Async test method must have non-void return type.
NUnit1013 Async test method must have non-generic Task return type when no result is expected.
NUnit1014 Async test method must have Task return type when a result is expected
NUnit2001 Consider using Assert.That(expr, Is.False) instead of Assert.False(expr).
NUnit2002 Consider using Assert.That(expr, Is.False) instead of Assert.IsFalse(expr).
NUnit2003 Consider using Assert.That(expr, Is.True) instead of Assert.IsTrue(expr).
NUnit2004 Consider using Assert.That(expr, Is.True) instead of Assert.True(expr).
NUnit2005 Consider using Assert.That(expr2, Is.EqualTo(expr1)) instead of Assert.AreEqual(expr1, expr2).
NUnit2006 Consider using Assert.That(expr2, Is.Not.EqualTo(expr1)) instead of Assert.AreNotEqual(expr1, expr2).
NUnit2007 Actual value should not be constant.
NUnit2008 Incorrect IgnoreCase usage.
NUnit2009 Same value provided as actual and expected argument.
NUnit2010 Use EqualConstraint.
NUnit2011 Use ContainsConstraint.
NUnit2012 Use StartsWithConstraint.
NUnit2013 Use EndsWithConstraint.
NUnit2014 Use SomeItemsConstraint.
NUnit2015 Consider using Assert.That(expr2, Is.SameAs(expr1)) instead of Assert.AreSame(expr1, expr2).
NUnit2016 Consider using Assert.That(expr, Is.Null) instead of Assert.Null(expr).
NUnit2017 Consider using Assert.That(expr, Is.Null) instead of Assert.IsNull(expr).
NUnit2018 Consider using Assert.That(expr, Is.Not.Null) instead of Assert.NotNull(expr).
NUnit2019 Consider using Assert.That(expr, Is.Not.Null) instead of Assert.IsNotNull(expr).
NUnit2020 Incompatible types for SameAs constraint.
NUnit2021 Incompatible types for EqualTo constraint.
NUnit2022 Missing property required for constraint.
NUnit2023 Invalid NullConstraint usage.
Clone this wiki locally