DataTestMethod vs TestMethod

ShreyasRmsft commented the following on GitHub: Hi @cactuaroid DataTestMethod is not needed. Go ahead and use TestMethod with DataRows to data drive your tests. For any more doubts follow the official docs at https://github.com/microsoft/testfx-docs https://github.com/microsoft/testfx/issues/614 https://github.com/microsoft/testfx-docs/issues/64 So, according to Microsoft, it is preferred to use TestMethod over DataTestMethod.

Using MS Test ClassInitialize() and TestInitialize() in VS2010 as opposed to NUnit

Here is a simple example using TestInitialize and TestCleanup. [TestClass] public class UnitTest1 { private NorthwindEntities context; [TestInitialize] public void TestInitialize() { this.context = new NorthwindEntities(); } [TestMethod] public void TestMethod1() { Assert.AreEqual(92, this.context.Customers.Count()); } [TestCleanup] public void TestCleanup() { this.context.Dispose(); } }

BadImageFormatException when AnyCPU test assembly implements interface from x64 production assembly

I came here searching for the solution for a similar problem. Posting this answer just in case the solution I found helps someone else. This solved it for me in Visual Studio (2012): Add New Item -> Test Settings Change the testsetting By default this is set to “Force test to run in 32 bit … Read more

MSTest and app.config issue

Kateroh, My setup looks like this (I’m using msbuild from a TFSbuild.proj): Build sln Copy all from output to %TEMP% (black magic :D) Don’t know why but mstest is looking for references in %TEMP%. Run mstest with parms: “C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe” /nologo /testcontainer:$(TestDir)\mylib.dll /resultsfile:$(TestResultFile) /runconfig:$(SlnDir)\AutomaticBuildTest.testrunconfig /searchpathroot:$(TestDir) /publish:mytfsserver /publishbuild:$(BuildDefinition) /flavor:Debug /platform:AnyCPU /teamproject:mytfsproject where AutomaticBuildTest.testrunconfig … Read more

CollectionAssert use with generics?

You can use CollectionAssert with generic collections. The trick is to understand that the CollectionAssert methods operate on ICollection, and although few generic collection interfaces implement ICollection, List<T> does. Thus, you can get around this limitation by using the ToList extension method: IEnumerable<Foo> expected = //… IEnumerable<Foo> actual = //… CollectionAssert.AreEqual(expected.ToList(), actual.ToList()); That said, I … Read more

What is the difference between MSTest.TestAdapter vs MSTest.TestFramework and when do I need which one?

So Visual Studio uses a framework called Visual Studio Test Platform to load test adapters, https://github.com/Microsoft/vstest To discover or execute test cases, VSTest would call the test adapters based on your project configuration. (That’s why NUnit/xUnit/MSTest all ask you to install a test adapter NuGet package to your unit testing projects). So MSTest.TestAdapter exists for … Read more

techhipbettruvabetnorabahisbahis forumueduedusedusedusedueduseduseduseduedu