Why is there no ExceptionAssert in VS 2015?

aindrea

Member
Joined
Jun 5, 2018
Messages
23
Programming Experience
1-3
I am using VS 2015, and I have written both a dummy test method and a dummy test code to try hwow it is possible to make sure that an exception is actually thrown by the code.

C#:
 private void calculate() {

            try {
                int[] ia = new int[1];
                ia[0] = 1;
                ia[1] = 2;
                ia[2] = 3;
            }
            catch (Exception oEx) {
                string msg = oEx.Message;
            }
        }

        [TestMethod()]
        public void MyTestMethod() {

            ExceptionAssert.Throws<Exception>(() => calculate());

        }

Visual Studio says that the name ExceptionAssert does not exist in the current context. Is there any way of circumventing this in VS 2015?
 
Back
Top Bottom