ExpectedException Assert

前端 未结 5 1218
死守一世寂寞
死守一世寂寞 2021-02-08 05:25

I need to write a unit test for the next function and I saw I can use [ExpectedException]

this is the function to be tested.

public static T FailIfEnumIs         


        
5条回答
  •  感情败类
    2021-02-08 06:00

    You must use ExpectedException differently:

    [TestMethod]
    [ExpectedException(typeof(ArgumentOutOfRangeException))]
    public void MyTestSomething() 
    

    and then code your test so that the expected exception gets thrown.

提交回复
热议问题