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