Is Assert.Fail() considered bad practice?

前端 未结 14 1160
面向向阳花
面向向阳花 2021-01-31 07:20

I use Assert.Fail a lot when doing TDD. I\'m usually working on one test at a time but when I get ideas for things I want to implement later I quickly write an empty test where

14条回答
  •  难免孤独
    2021-01-31 07:26

    I use MbUnit for my Unit Testing. They have an option to Ignore tests, which show up as Orange (rather than Green or Red) in the test suite. Perhaps xUnit has something similar, and would mean you don't even have to put any assert into the method, because it would show up in an annoyingly different colour making it hard to miss?

    Edit:

    In MbUnit it is in the following way:

    [Test]
    [Ignore]
    public void YourTest()
    { } 
    

提交回复
热议问题