vs-unit-testing-framework

Where to find .csdl, .ssdl, and .msl files in Entity Framework 4.0 code first?

﹥>﹥吖頭↗ 提交于 2020-05-28 22:29:02
问题 I want to run tests with Effort and to do that I need to specify a connectionstring that also contains a reference to .csdl, .ssdl , and .msl files. The (non-working) connectionstring looks like this now: <add name="SQLAzureConnection" connectionString= "metadata=res://*/Model.projectContext.csdl| res://*/Model.projectContext.ssdl|res://*/Model.projectContext.msl; provider=System.Data.SqlClient; provider connection string="Data Source=(LocalDb)\v11.0;Initial Catalog=Database_Nieuw;Integrated

Where to find .csdl, .ssdl, and .msl files in Entity Framework 4.0 code first?

浪子不回头ぞ 提交于 2020-05-28 22:22:39
问题 I want to run tests with Effort and to do that I need to specify a connectionstring that also contains a reference to .csdl, .ssdl , and .msl files. The (non-working) connectionstring looks like this now: <add name="SQLAzureConnection" connectionString= "metadata=res://*/Model.projectContext.csdl| res://*/Model.projectContext.ssdl|res://*/Model.projectContext.msl; provider=System.Data.SqlClient; provider connection string="Data Source=(LocalDb)\v11.0;Initial Catalog=Database_Nieuw;Integrated

Data Driven MSTest: DataRow is always null

老子叫甜甜 提交于 2020-01-04 04:19:09
问题 I am having a problem using Visual Studio data driven testing. I have tried to deconstruct this to the simplest example. I am using Visual Studio 2012. I create a new unit test project. I am referencing system data. My code looks like this: namespace UnitTestProject1 { [TestClass] public class UnitTest1 { [DeploymentItem(@"OrderService.csv")] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "OrderService.csv", "OrderService#csv", DataAccessMethod.Sequential)] [TestMethod] public

NUnit's TestCaseAttribute equivalent in VS Unit Test Framework

穿精又带淫゛_ 提交于 2020-01-03 19:15:44
问题 Is there an NUnit's TestCaseAttribute equivalent in Visual Studio 2008 unit test framework ? You know, something like this: [TestCase(1, 1, 1)] [TestCase(2, 2, 2)] [TestCase(3, 3, 3)] public void Test1(int a, int b, int c) { // do stuff depending on the TestCase } 回答1: MSTest unfortunately doesn't support parameterized tests in this way. The closest you get is with the DataSource attribute, which allows you to specify an external data source for the test method. 来源: https://stackoverflow.com

What could be causing a System.TypeLoadException in a Visual Studio Unit Test?

回眸只為那壹抹淺笑 提交于 2019-12-28 05:49:27
问题 I've got a C# .NET class library MyClassLibrary that compiles fine. I'm trying to create a unit test project for it (using Visual Studio Unit Testing Framework, with Visual Studio 2010). The class library does have big classes in it, but whenever I run even the simplest test against the simplest class, I get the following exception: Test method MyClassLibraryTest.MyClassLibraryTests.MySimpleClassTest threw exception: System.TypeLoadException: Could not load type 'MyClassLibrary.MySimpleClass'

How do I use Assert to verify that an exception has been thrown?

限于喜欢 提交于 2019-12-27 11:35:09
问题 How do I use Assert (or other Test class?) to verify that an exception has been thrown? 回答1: For "Visual Studio Team Test" it appears you apply the ExpectedException attribute to the test's method. Sample from the documentation here: A Unit Testing Walkthrough with Visual Studio Team Test [TestMethod] [ExpectedException(typeof(ArgumentException), "A userId of null was inappropriately allowed.")] public void NullUserIdInConstructor() { LogonInfo logonInfo = new LogonInfo(null, "P@ss0word"); }

Unable to run the unit test in visual studio 2017 professional

北慕城南 提交于 2019-12-24 05:23:08
问题 Unable to run the unit test in visual studio 2017 professional, Run Selected Tests is disabled. I have tried to rebuild the test project and also the solution. 回答1: try restart VS, you may be able to see then 回答2: Set Project solution from Release Mode to Debug Mode.. 来源: https://stackoverflow.com/questions/50945195/unable-to-run-the-unit-test-in-visual-studio-2017-professional

MSTest code coverage

大兔子大兔子 提交于 2019-12-23 19:10:31
问题 I have a test project for a web service and, when I run tests in debug mode, everything works ok. However, when I just run tests, I get following error, for a referenced assembly that I try to obtain code coverage: Class Initialization method WebServiceTest.wstest.MyClassInitialize threw exception. System.IO.FileLoadException: System.IO.FileLoadException: Could not load file or assembly 'TestAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=57f286581e1d278a' or one of its