Results 1 to 3 of 3

Thread: Why is there no ExceptionAssert in VS 2015?

  1. #1
    .NET Framework
    .NET 4.5
    Join Date
    Jun 2018
    Posts
    21
    Rep Power
    7

    Why is there no ExceptionAssert in VS 2015?

    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.

    Code:
     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?

  2. #2
    .NET Framework
    .NET 4.5
    Join Date
    Apr 2011
    Posts
    1,933
    Rep Power
    149
    Why would there be? It's not part of the .NET Framework. It's third-party code. It took me a web search and two minutes to find that out.

    https://blogs.msdn.microsoft.com/ddi...throws-method/

  3. #3
    .NET Framework
    .NET 4.5
    Join Date
    Apr 2011
    Posts
    1,933
    Rep Power
    149

Similar Threads

  1. VS 2015 - Running Unit tests from cmd line, problems with initializing chromedriver
    By desmo in forum Testing, Quality Control, Debugging
    Replies: 0
    Last Post: 01-23-2018, 4:42 AM
  2. Replies: 0
    Last Post: 01-05-2018, 6:56 AM
  3. Replies: 0
    Last Post: 07-17-2015, 11:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •