mstest

How to run a test method with multiple parameters in MSTest?

て烟熏妆下的殇ゞ 提交于 2019-11-26 05:59:45
问题 NUnit has a feature called Values, like below: [Test] public void MyTest( [Values(1,2,3)] int x, [Values(\"A\",\"B\")] string s) { // ... } This means that the test method will run 6 times: MyTest(1, \"A\") MyTest(1, \"B\") MyTest(2, \"A\") MyTest(2, \"B\") MyTest(3, \"A\") MyTest(3, \"B\") We\'re using MSTest now, is there any equivalent for this so that I can run the same test with multiple parameters? [TestMethod] public void Mytest() { // ... } 回答1: It is unfortunately not supported in

How to RowTest with MSTest?

懵懂的女人 提交于 2019-11-26 05:32:08
问题 I know that MSTest doesn\'t support RowTest and similar tests. What do MSTests users do? How is it possible to live without RowTest support? I\'ve seen DataDriven test features but sounds like too much overhead, is there any 3rd party patch or tool which allow me to do RowTest similar tests in MSTest ? 回答1: [TestMethod] Test1Row1 { Test1(1,4,5); } [TestMethod] Test1Row2 { Test1(1,7,8); } private Test1(int i, int j, int k) { //all code and assertions in here } 回答2: I know this is a late answer

How do I use MSTest without Visual Studio?

不羁岁月 提交于 2019-11-26 05:25:48
问题 Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it? 回答1: It doesn't have a GUI (apart from Visual Studio) but there's a command line tool: MSTest.exe Here is the official documentation on running MSTest tests. 回答2: MSTest can be used without installing Visual Studio. You will need to install Visual Studio Test Agent, which is a free download from Microsoft. I

Entity Framework Provider type could not be loaded?

牧云@^-^@ 提交于 2019-11-26 03:24:50
问题 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 provider assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId

NUnit vs. MbUnit vs. MSTest vs. xUnit.net [closed]

こ雲淡風輕ζ 提交于 2019-11-26 02:15:29
问题 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 proof and has a decent momentum behind it? Should I care about the features? While xUnit seems to be most modern and specifically designed for .NET, NUnit again seems to be the one that is widely accepted. MSTest again is already integrated into Visual

Unit Testing: DateTime.Now

喜你入骨 提交于 2019-11-26 00:57:54
问题 I have some unit tests that expects the \'current time\' to be different than DateTime.Now and I don\'t want to change the computer\'s time, obviously. What\'s the best strategy to achieve this? 回答1: The best strategy is to wrap the current time in an abstraction and inject that abstraction into the consumer. Alternatively , you can also define a time abstraction as an Ambient Context : public abstract class TimeProvider { private static TimeProvider current = DefaultTimeProvider.Instance;