If you followed my two blog posts previously (Create Unit Tests Workaround and Solution), you may found out at some point of time, the function of “Create Unit Tests” wizard is disabled on your next attempt to launch the Create Unit Tests wizard.
The following issues were encountered:
- When you used Keyboard Shortcut workaround, the Create Unit Tests Wizard does not appear.
- You may receive the following error while using the Command Window workaround:
Command "EditorContextMenus.CodeWindow.CreateUnitTests" is not available.
- Right-Click “Create Unit Tests…” menu is disabled or grayed out when you use either solutions.
This is a known issue and the below solution will solve the problem.
If you have an existing Unit Test project in the solution, you may skip to Step 3.
- Go to File –> Add –> New Project…
- In the Add New Project window, select Installed –> Visual C# –> Test –> Unit Test Project. Give it a meaningful name and click OK.
- At Solution Explorer, right click the Unit Test project –> Add –> Unit Test…
- Now, right click on a method and “Create Unit Tests…” will appear.
- This will create a new unit test class and trigger Visual Studio that an existing Unit Test class is available, thus enables Create Unit Tests wizard.
Note: You may delete the created Unit Test class file (UnitTestX.cs) as it is used to trigger the function.
Have fun Unit Testing!