我想根据我在TestFixtureSetUp. 有没有办法忽略基于参数运行测试?
[TestFixture]
public class MessagesTests
{
    private bool isPaidAccount;
    [TestFixtureSetUp]
    public void Init () {
        isPaidAccount = ConfigurationManager.AppSettings["IsPaidAccount"] == "True";
    }
    [Test]
    //this test should run only if `isPaidAccount` is true
    public void Message_Without_Template_Is_Sent()
    {
         //this tests an actual web api call.
    }
}
如果我们正在测试的帐户是付费帐户,则测试应该可以正常运行,如果不是,该方法将抛出异常。
会有属性的扩展[Ignore(ReallyIgnore = isPaidAccount )]吗?或者我应该在方法中编写它并运行 2 个单独的测试用例,例如。
    public void Message_Without_Template_Is_Sent()
    {
         if(isPaidAccount)
         {
              //test for return value here
         }
         else
         {
              //test for exception here
         }
    }