VS2017 Could not load file or assembly Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll or one of its dependencies

I had a similar issue (with the additional message The “BuildShadowTask” task failed unexpectedly) with a project originally developed with VS2010, and got to spend the last few hours learning about yet another legacy facet of the build process. There is a good chance that you are dealing with private accessor files (.accessor), which were … Read more

Model state validation in unit tests

TL;DR If you don’t want to read the entire article provided by Youssef and want a quick solution to how to make ModelState.IsValid return false. Do this. [TestMethod] public void TestLogin_InvalidModel() { AccountController controller = CreateAccountController(); // new code added –> controller.ModelState.AddModelError(“fakeError”, “fakeError”); // end of new code … var response = controller.PostLogin(new LoginModel() { … Read more

How to access TestRunParameters within RunSettings file

For those that use Resharper with this issue, I discovered the fix (no need to disable Resharper): Go to Visual Studio top menu -> Resharper -> Options Find the Tools section, expand “Unit Testing” Click on “MsTest”. The checkbox should be on enabled, but the Test Settings file path below that may be blank. If … Read more

MSTest: No tests are run because no tests are loaded or the selected tests are disabled

Another one for the googlers – this one turned out to be my problem, and it’s embarrassingly boneheaded of me. Make sure that your test project is set to build in whatever solution configuration you’re using. If the test assembly isn’t being built, VS won’t be able to find any tests in the non-existent assembly, … Read more

techhipbettruvabetnorabahisbahis forumueduseduseduedueduseduedueduseduedus