-
Notifications
You must be signed in to change notification settings - Fork 288
Labels
Description
In MSTest v3.10.4, MSTEST0037 is currently not reported for all types that implement IComparable.
Steps To Reproduce
Compile the following code (with MSTest analyzers enabled):
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public sealed class MSTEST0037Tests
{
[TestMethod]
public void TimeSpanComparison()
{
var ts1 = TimeSpan.Zero;
var ts2 = TimeSpan.Zero;
Assert.IsTrue(ts2 > ts1);
Assert.IsTrue(ts2 >= ts1);
Assert.IsTrue(ts2 < ts1);
Assert.IsTrue(ts2 <= ts1);
Assert.IsTrue(ts2 == ts1);
Assert.IsTrue(ts2 != ts1);
}
[TestMethod]
public void DateTimeComparison()
{
var ts1 = DateTime.Today;
var ts2 = DateTime.Today;
Assert.IsTrue(ts2 > ts1);
Assert.IsTrue(ts2 >= ts1);
Assert.IsTrue(ts2 < ts1);
Assert.IsTrue(ts2 <= ts1);
Assert.IsTrue(ts2 == ts1);
Assert.IsTrue(ts2 != ts1);
}
}Expected behavior
MSTEST0037 is reported for each usage of Assert.IsTrue(...).
Actual behavior
MSTEST0037 is not reported at all.
Copilot