@@ -525,6 +525,120 @@ csharp_style_prefer_top_level_statements = true:silent
525525csharp_style_prefer_primary_constructors = true :suggestion
526526csharp_style_prefer_local_over_anonymous_function = true :suggestion
527527
528+
529+ # ############################################
530+ # NUnit Analyzers — enable all as errors
531+ # ############################################
532+
533+ # Structure Rules (NUnit1001 - )
534+ dotnet_diagnostic.NUnit1001.severity = error # TestCase args must match parameter types
535+ dotnet_diagnostic.NUnit1002.severity = error # TestCaseSource should use nameof
536+ dotnet_diagnostic.NUnit1003.severity = error # TestCase provided too few arguments
537+ dotnet_diagnostic.NUnit1004.severity = error # TestCase provided too many arguments
538+ dotnet_diagnostic.NUnit1005.severity = error # ExpectedResult type must match return type
539+ dotnet_diagnostic.NUnit1006.severity = error # ExpectedResult must not be used on void methods
540+ dotnet_diagnostic.NUnit1007.severity = error # Non-void method but no ExpectedResult provided
541+ dotnet_diagnostic.NUnit1008.severity = error # ParallelScope.Self at assembly level has no effect
542+ dotnet_diagnostic.NUnit1009.severity = error # ParallelScope.Children on non-parameterized test
543+ dotnet_diagnostic.NUnit1010.severity = error # ParallelScope.Fixtures on a test method
544+ dotnet_diagnostic.NUnit1011.severity = error # TestCaseSource member does not exist
545+ dotnet_diagnostic.NUnit1012.severity = error # async test method must have non-void return type
546+ dotnet_diagnostic.NUnit1013.severity = error # async method must use non-generic Task when no result
547+ dotnet_diagnostic.NUnit1014.severity = error # async method must use Task<T> when result expected
548+ dotnet_diagnostic.NUnit1015.severity = error # Source type does not implement I(Async)Enumerable
549+ dotnet_diagnostic.NUnit1016.severity = error # Source type lacks default constructor
550+ dotnet_diagnostic.NUnit1017.severity = error # Specified source is not static
551+ dotnet_diagnostic.NUnit1018.severity = error # TestCaseSource param count mismatch (target method)
552+ dotnet_diagnostic.NUnit1019.severity = error # Source does not return I(Async)Enumerable
553+ dotnet_diagnostic.NUnit1020.severity = error # Parameters provided to field/property source
554+ dotnet_diagnostic.NUnit1021.severity = error # ValueSource should use nameof
555+ dotnet_diagnostic.NUnit1022.severity = error # Specified ValueSource is not static
556+ dotnet_diagnostic.NUnit1023.severity = error # ValueSource cannot supply required parameters
557+ dotnet_diagnostic.NUnit1024.severity = error # ValueSource does not return I(Async)Enumerable
558+ dotnet_diagnostic.NUnit1025.severity = error # ValueSource member does not exist
559+ dotnet_diagnostic.NUnit1026.severity = error # Test or setup/teardown method is not public
560+ dotnet_diagnostic.NUnit1027.severity = error # Test method has parameters but no arguments supplied
561+ dotnet_diagnostic.NUnit1028.severity = error # Non-test method is public
562+ dotnet_diagnostic.NUnit1029.severity = error # TestCaseSource param count mismatch (Test method)
563+ dotnet_diagnostic.NUnit1030.severity = error # TestCaseSource parameter type mismatch (Test method)
564+ dotnet_diagnostic.NUnit1031.severity = error # ValuesAttribute args must match parameter types
565+ dotnet_diagnostic.NUnit1032.severity = error # IDisposable field/property should be disposed in TearDown
566+ dotnet_diagnostic.NUnit1033.severity = error # TestContext.Write methods will be obsolete
567+ dotnet_diagnostic.NUnit1034.severity = error # Base TestFixtures should be abstract
568+ dotnet_diagnostic.NUnit1035.severity = error # Range ' step' parameter cannot be zero
569+ dotnet_diagnostic.NUnit1036.severity = error # Range: from < to when step is positive
570+ dotnet_diagnostic.NUnit1037.severity = error # Range: from > to when step is negative
571+ dotnet_diagnostic.NUnit1038.severity = error # Attribute values' types must match parameter type
572+
573+ # Assertion Rules (NUnit2001 - )
574+ dotnet_diagnostic.NUnit2001.severity = error # Prefer Assert.That(..., Is.False) over ClassicAssert.False
575+ dotnet_diagnostic.NUnit2002.severity = error # Prefer Assert.That(..., Is.False) over ClassicAssert.IsFalse
576+ dotnet_diagnostic.NUnit2003.severity = error # Prefer Assert.That(..., Is.True) over ClassicAssert.IsTrue
577+ dotnet_diagnostic.NUnit2004.severity = error # Prefer Assert.That(..., Is.True) over ClassicAssert.True
578+ dotnet_diagnostic.NUnit2005.severity = error # Prefer Is.EqualTo over AreEqual
579+ dotnet_diagnostic.NUnit2006.severity = error # Prefer Is.Not.EqualTo over AreNotEqual
580+ dotnet_diagnostic.NUnit2007.severity = error # Actual value should not be a constant
581+ dotnet_diagnostic.NUnit2008.severity = error # Incorrect IgnoreCase usage
582+ dotnet_diagnostic.NUnit2009.severity = error # Same value used for actual and expected
583+ dotnet_diagnostic.NUnit2010.severity = error # Use EqualConstraint for better messages
584+ dotnet_diagnostic.NUnit2011.severity = error # Use ContainsConstraint for better messages
585+ dotnet_diagnostic.NUnit2012.severity = error # Use StartsWithConstraint for better messages
586+ dotnet_diagnostic.NUnit2013.severity = error # Use EndsWithConstraint for better messages
587+ dotnet_diagnostic.NUnit2014.severity = error # Use SomeItemsConstraint for better messages
588+ dotnet_diagnostic.NUnit2015.severity = error # Prefer Is.SameAs over AreSame
589+ dotnet_diagnostic.NUnit2016.severity = error # Prefer Is.Null over ClassicAssert.Null
590+ dotnet_diagnostic.NUnit2017.severity = error # Prefer Is.Null over ClassicAssert.IsNull
591+ dotnet_diagnostic.NUnit2018.severity = error # Prefer Is.Not.Null over ClassicAssert.NotNull
592+ dotnet_diagnostic.NUnit2019.severity = error # Prefer Is.Not.Null over ClassicAssert.IsNotNull
593+ dotnet_diagnostic.NUnit2020.severity = error # Incompatible types for SameAs constraint
594+ dotnet_diagnostic.NUnit2021.severity = error # Incompatible types for EqualTo constraint
595+ dotnet_diagnostic.NUnit2022.severity = error # Missing property required for constraint
596+ dotnet_diagnostic.NUnit2023.severity = error # Invalid NullConstraint usage
597+ dotnet_diagnostic.NUnit2024.severity = error # Wrong actual type with String constraint
598+ dotnet_diagnostic.NUnit2025.severity = error # Wrong actual type with ContainsConstraint
599+ dotnet_diagnostic.NUnit2026.severity = error # Wrong actual type with SomeItems+EqualConstraint
600+ dotnet_diagnostic.NUnit2027.severity = error # Prefer Is.GreaterThan over ClassicAssert.Greater
601+ dotnet_diagnostic.NUnit2028.severity = error # Prefer Is.GreaterThanOrEqualTo over GreaterOrEqual
602+ dotnet_diagnostic.NUnit2029.severity = error # Prefer Is.LessThan over ClassicAssert.Less
603+ dotnet_diagnostic.NUnit2030.severity = error # Prefer Is.LessThanOrEqualTo over LessOrEqual
604+ dotnet_diagnostic.NUnit2031.severity = error # Prefer Is.Not.SameAs over AreNotSame
605+ dotnet_diagnostic.NUnit2032.severity = error # Prefer Is.Zero over ClassicAssert.Zero
606+ dotnet_diagnostic.NUnit2033.severity = error # Prefer Is.Not.Zero over ClassicAssert.NotZero
607+ dotnet_diagnostic.NUnit2034.severity = error # Prefer Is.NaN over ClassicAssert.IsNaN
608+ dotnet_diagnostic.NUnit2035.severity = error # Prefer Is.Empty over ClassicAssert.IsEmpty
609+ dotnet_diagnostic.NUnit2036.severity = error # Prefer Is.Not.Empty over ClassicAssert.IsNotEmpty
610+ dotnet_diagnostic.NUnit2037.severity = error # Prefer Does.Contain over ClassicAssert.Contains
611+ dotnet_diagnostic.NUnit2038.severity = error # Prefer Is.InstanceOf over ClassicAssert.IsInstanceOf
612+ dotnet_diagnostic.NUnit2039.severity = error # Prefer Is.Not.InstanceOf over ClassicAssert.IsNotInstanceOf
613+ dotnet_diagnostic.NUnit2040.severity = error # Non-reference types for SameAs constraint
614+ dotnet_diagnostic.NUnit2041.severity = error # Incompatible types for comparison constraint
615+ dotnet_diagnostic.NUnit2042.severity = error # Comparison constraint on object
616+ dotnet_diagnostic.NUnit2043.severity = error # Use ComparisonConstraint for better messages
617+ dotnet_diagnostic.NUnit2044.severity = error # Non-delegate actual parameter
618+ dotnet_diagnostic.NUnit2045.severity = error # Use Assert.EnterMultipleScope or Assert.Multiple
619+ dotnet_diagnostic.NUnit2046.severity = error # Use CollectionConstraint for better messages
620+ dotnet_diagnostic.NUnit2047.severity = error # Incompatible types for Within constraint
621+ dotnet_diagnostic.NUnit2048.severity = error # Prefer Assert.That over StringAssert
622+ dotnet_diagnostic.NUnit2049.severity = error # Prefer Assert.That over CollectionAssert
623+ dotnet_diagnostic.NUnit2050.severity = error # NUnit 4 no longer supports string.Format spec
624+ dotnet_diagnostic.NUnit2051.severity = error # Prefer Is.Positive over ClassicAssert.Positive
625+ dotnet_diagnostic.NUnit2052.severity = error # Prefer Is.Negative over ClassicAssert.Negative
626+ dotnet_diagnostic.NUnit2053.severity = error # Prefer Is.AssignableFrom over ClassicAssert.IsAssignableFrom
627+ dotnet_diagnostic.NUnit2054.severity = error # Prefer Is.Not.AssignableFrom over ClassicAssert.IsNotAssignableFrom
628+ dotnet_diagnostic.NUnit2055.severity = error # Prefer Is.InstanceOf<T> over ' is T' expression
629+ dotnet_diagnostic.NUnit2056.severity = error # Prefer Assert.EnterMultipleScope statement over Multiple
630+
631+ # Suppressor Rules (NUnit3001 - )
632+ dotnet_diagnostic.NUnit3001.severity = error # Expression checked in NotNull/IsNotNull/Assert.That
633+ dotnet_diagnostic.NUnit3002.severity = error # Field/Property initialized in SetUp/OneTimeSetUp
634+ dotnet_diagnostic.NUnit3003.severity = error # TestFixture instantiated via reflection
635+ dotnet_diagnostic.NUnit3004.severity = error # Field should be disposed in TearDown/OneTimeTearDown
636+
637+ # Style Rules (NUnit4001 - )
638+ dotnet_diagnostic.NUnit4001.severity = error # Simplify the Values attribute
639+ dotnet_diagnostic.NUnit4002.severity = error # Use Specific constraint
640+
641+
528642# C++ Files
529643[* .{cpp,h,in} ]
530644curly_bracket_next_line = true
@@ -551,5 +665,3 @@ indent_size = 2
551665end_of_line = lf
552666[* .{cmd, bat} ]
553667end_of_line = crlf
554-
555- vsspell_dictionary_languages = en-US
0 commit comments