You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[patch] Fix SonarCloud MSTest issues and unblock the build
Build fixes (ktsu.Sdk 2.26.1 analyzers, were failing the build):
- KTSU0007: Polyfill PackageReference now sets PrivateAssets="all" so the
build-time-only package stops leaking into consumers dependency graphs.
- KTSU0002: add Containers/AssemblyInfo.cs exposing internals to
ktsu.Containers.Test.
SonarCloud fixes (46 issues):
- MSTEST0068 (34): CollectionAssert.AreEqual -> Assert.AreSequenceEqual.
AreSequenceEqual takes IEnumerable<T>, so the accompanying .ToArray()
calls became redundant (IDE0305) and were dropped.
- MSTEST0037 (11): Assert.AreEqual(n, x.Length) -> Assert.HasCount(n, x)
for the span assertions, and Assert.IsTrue(a >= b) ->
Assert.IsGreaterThanOrEqualTo(b, a) in SpscRingBufferTests.
- MSTEST0049 (1): pass TestContext.CancellationToken to the Task.Run calls
in ConcurrentProducerConsumer_TransfersAllItemsInOrder.
Also refreshed the outdated CollectionAssert guidance in CLAUDE.md.
Build clean, 351/351 tests pass.
- Use MSTest framework (`[TestClass]`, `[TestMethod]`)
72
-
- Use `CollectionAssert.AreEqual` for collection equality (use `.ToArray()` if type inference issues arise)
72
+
- Use `Assert.AreSequenceEqual` for collection equality; `CollectionAssert.AreEqual` is flagged by MSTEST0068. It accepts any `IEnumerable<T>`, so no `.ToArray()` is needed
73
+
- Use `Assert.HasCount` rather than asserting `.Count`/`.Length` via `Assert.AreEqual` (MSTEST0037)
73
74
- Test edge cases: empty containers, boundary conditions, constructor validation
0 commit comments