In an existing solution, I added a new test project. In my Project Project.cs file, I have a class decorated with the [TestClass] attribute and a method decorated with the [TestMethod] attribute. I checked that Configuration Manager has the build flag set for the test project (since my Google search was found, there was a problem for others with this problem). I set up a test project as my initial project for the solution. When I try to run a test, I get "I can not start a test project because the project does not contain any tests." I am really new to unit testing. What am I missing?
[TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { Whole bunch of stuff Assert.Inconclusive("Done"); } }
Update. So, I opened a new instance of VS, went to File => New => Project => Test Project. Do not touch or edit anything. I went directly to the cs file, and here is its entire contents:
using Microsoft.VisualStudio.TestTools.UnitTesting; namespace TestProject2 { public class Inspection { public bool SubmitInsp() { return true; } } [TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { Inspection insp = new Inspection(); bool result = insp.SubmitInsp(); Assert.IsTrue(result); } } }
Same error about a project that does not contain any test when I try to run it. Also found this in the output of the assembly "Could not load file or assembly" ~ \ my documents \ visual studio 2010 \ Projects \ TestProject2 \ bin \ Debug \ TestProject2.dll or one of its dependencies. The operation is not supported. (Exception from HRESULT: 0x80131515) "
I do not know that unit tests become much simpler. What the hell???
source share