HRESULT: 0x80131040: The located assembly’s manifest definition does not match the assembly reference

This is a mismatch between assemblies: a DLL referenced from an assembly doesn’t have a method signature that’s expected. Clean the solution, rebuild everything, and try again. Also, be careful if this is a reference to something that’s in the GAC; it could be that something somewhere is pointing to an incorrect version. Make sure … Read more

C# – Asserting two objects are equal in unit tests

You’ve got two different Board instances, so your call to Assert.AreEqual will fail. Even if their entire contents appear to be the same, you’re comparing references, not the underlying values. You have to specify what makes two Board instances equal. You can do it in your test: Assert.AreEqual(expected.Rows.Count, actual.Rows.Count); Assert.AreEqual(expected.Rows[0].Cells[0], actual.Rows[0].Cells[0]); // Lots more tests … Read more

MSTest Equivalent for NUnit’s Parameterized Tests?

For those using MSTest2, DataRow + DataTestMethod are available to do exactly this: [DataRow(Enum.Item1, “Name1”, 123)] [DataRow(Enum.Item2, “Name2”, 123)] [DataRow(Enum.Item3, “Name3”, 456)] [DataTestMethod] public void FooTest(EnumType item, string name, string number) { var response = ExecuteYourCode(item, name, number); Assert.AreEqual(item, response.item); } More about it here

Does MSTest have an equivalent to NUnit’s TestCase?

Microsoft recently announced “MSTest V2” (see blog-article). This allows you to consistently (desktop, UWP, …) use the DataRow-attribute! [TestClass] public class StringFormatUtilsTest { [DataTestMethod] [DataRow(“tttt”, “”)] [DataRow(“”, “”)] [DataRow(“t3a4b5”, “345”)] [DataRow(“3&5*”, “35”)] [DataRow(“123”, “123”)] public void StripNonNumeric(string before, string expected) { string actual = FormatUtils.StripNonNumeric(before); Assert.AreEqual(expected, actual); } } Again, Visual Studio Express’ Test Explorer … Read more

NUnit vs. Visual Studio 2008’s test projects for unit testing [closed]

Daok named all the pro’s of Visual Studio 2008 test projects. Here are the pro’s of NUnit. NUnit has a mocking framework. NUnit can be run outside of the IDE. This can be useful if you want to run tests on a non-Microsoft build server, like CruiseControl.NET. NUnit has more versions coming out than visual studio. You … Read more