How to run and debug tests in unit tests does not work for reasons

Source: Internet
Author: User

1. The right-click method to run the test and debug the test does not work for the code:

1         #regionMy albums2         /// <summary>3         ///My albums4         /// </summary>5         /// <param name= "Currindex" ></param>6         /// <param name= "PageSize" ></param>7 [TestMethod]8          Public voidMypiclist (intCurrindex,intPageSize)9         {Ten             intresult =0; One             Try A             { -                 //Test Logic -                 stringstr ="Holy crap"; the Console.WriteLine (str); -             } -             Catch(Exception) -             { +result =1; -             } +Assert.AreEqual (0, result); A         }  at         #endregion

Tangled up in the afternoon thought vs which block problem, tried various methods. Finally, while looking at a unit test post, I saw

Requirements for test methods: must have TestMethod annotations, the return type must be void, and cannot have parameters . This sentence immediately waking wake up.

Correct code:

1         #regionMy albums2         /// <summary>3         ///My albums4         /// </summary>5         /// <param name= "Currindex" ></param>6         /// <param name= "PageSize" ></param>7 [TestMethod]8          Public voidmypiclist ()9         {Ten             intresult =0; One             Try A             { -                 //Test Logic -                  stringstr ="Holy crap"; the Console.WriteLine (str); -             } -             Catch(Exception) -             { +result =1; -             } +Assert.AreEqual (0, result); A         }  at         #endregion

How to run and debug tests in unit tests does not work for reasons

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.