In this post, we will see how to resolve Data source name not found while running the unit test Question: I am writing a data driven unit test. The input is an excel of type “.xlsx”. I took reference from ...
Resolved: How to organize TestClass to show in TestExplorer multiple times, once per each parameter?
In this post, we will see how to resolve How to organize TestClass to show in TestExplorer multiple times, once per each parameter? Question: I have MSTest [TestClass] class with 15 test methods [TestMethod]. Test class tests “local” and “remote” ...
In this post, we will see how to resolve Checking “value equality” of mutable classes in unit tests Question: In a project, I have several classes that are mutable. In unit tests using MSTest, I’d like to check whether objects ...
Question: There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: http://xunit.github.io/docs/comparisons.html Now I am to choose the best one for us. But how? Does it matter? Which one is most future ...
Question: I am trying to run my tests on TeamCity which is currently installed on my machine. System.InvalidOperationException: The Entity Framework provider type ‘System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ for the ‘System.Data.SqlClient’ ADO.NET provider could not be loaded. Make sure the ...
Question: How do I use Assert (or other Test class) to verify that an exception has been thrown when using MSTest/Microsoft.VisualStudio.TestTools.UnitTesting? Best Answer: For “Visual Studio Team Test” it appears you apply the ExpectedException attribute to the test’s method. Sample ...
Question: I can’t make it work, any help will be much apreciated. There is a list of entities from query response where I would like to test if they are in particular order, and I wish to make the comparison ...
Question: I have a .Net desktop project that targets .net V5. I added a MSTest project to write some tests but the highest version of .Net that I can target seems to be 4.8. How do I target .net 5.0 ...
Question: Simply passing Mock HttpContext to the controller context while unit testing logout functionality will throw following error HttpContext.Signout + value can not be null (Parameter ‘provider’) //set the controller HttpContext // Now call the Logout action method and Test ...
Question: I am using NUnit, NSubstitute, and Visual Studio 2022 for testing an ASP.NET Core 6 Service. I’m seeing some results that I don’t understand. Here is a screen capture, showing the code and the coverage results: The color coding ...