Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.45 KB

File metadata and controls

46 lines (32 loc) · 1.45 KB

PH2055: Avoid Assert.IsTrue(true)

Property Value
Package Philips.CodeAnalysis.MsTestAnalyzers
Diagnostic ID PH2055
Category MsTest
Analyzer AssertIsTrueLiteralAnalyzer
CodeFix No
Severity Error
Enabled By Default Yes

Introduction

Calling Assert.IsTrue(true) (or Assert.IsFalse(false)) serves no purpose.

How to solve

Remove the line of code.

Example

Code that triggers a diagnostic:

        [TestMethod]
        public void BadTestMethod()
        {
            Assert.IsTrue(true);
        }

Microsoft Equivalent

Microsoft's official MSTest analyzers provide similar functionality with broader coverage:

Microsoft Rule Description
MSTEST0032 Use proper assert methods

Migration

Consider migrating to Microsoft's official MSTest analyzers which provide equivalent or better functionality with official support.

Configuration

This analyzer does not offer any special configuration. The general ways of suppressing diagnostics apply.