1 turn on tool--customize

2 Select context menu--Editor context menu|Code window

3 Here we can see the "Create Unit Test" menu, move it under the Run Test menu

4 shut downVSAnd restart
After restarting, right-click on the class name and find that the "Create Unit Test" button has appeared in the context menu, but it is grayed out and cannot be used. But we are not far from success.
Restart is very important. If you don’t restart, the menu won’t come out.

5 Right click in the solution and add--Create a new project and add a unit test project.

As shown:

6 Right-click the unit test project and add--unit test

7. Haha, you're done at this time, you go back to the non-test project, right-click on the class name, and you can see that "Create Unit Test" is available. (Pictured above)