run
(Regin Nielsen)
August 22, 2019, 9:08am
1
We are running into issues with the rule: C#: Tests should have assertions
Which states the following frameworks as supported:
MSTest
NUnit
XUnit
FluentAssertions
But we happen to use NSubstitute with patterns like this (example code):
[TestMethod]
void Test()
{
// Arrange
var calculator = Substitute.For<ICalculator>();
// Act
calculator.Add(1, 2);
// Assert
calculator.Received().Add(1, Arg.Any<int>());
}
The rule is really good, so I don’t want to disable it, nor do I want to manually fix every test case which uses the NSubstitute assertions.
What is our best approach here?
Thanks
welcome to the community, @run !
I added NSubstitute to #1353 thanks for the suggestion
run
(Regin Nielsen)
August 26, 2019, 5:08am
3
Thank you!
Any idea (roughly), when this might be supported?
No.
The main priority for the rest of this year is to add support for the new C#8 features and to add some more rules to the analyzer. We might include it in the rules sprint, but the decision would be taken later in the year.
hi @run , this has been released in SonarCSharp 8.0
system
(system)
Closed
April 8, 2021, 9:19am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.