mstest

assemblybinding does not work in mstest

空扰寡人 提交于 2019-12-01 23:27:46
问题 I have a very simple MSTest unit test project that indirectly have dependency on two versions of MVC. assemblybinding in app.config is configured to redirect to MVC v4 when I run mstest test runner (VS2012 RC built-in) - I get exception indicating that assembly binding did not work. If I create testsettings file and disable deployment (or enable deployment and add app.config to the list of items to deploy) - test passes. Question: why does assemblybinding works with deployment set to false?

Unit Testing .NET 3.5 projects using MStest in VS2010

為{幸葍}努か 提交于 2019-12-01 20:44:26
There's a bug/feature in Visual Studio 2010 where you can't create a unit test project with the 2.0 CLR. https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=483891&wa=wsignin1.0 This causes all sorts of problems when the project being tested is targetting the 2.0 CLR (ASP.NET MVC 2 on top of .Net 3.5 SP1 in this case) - crashes on debug, tests failing unexpectedly, in one case the test project doesn't even build because of the dependency on System.Web 2.0.0.0 which isn't available in projects targetting 4.0. It's not possible to change the test project to target

Debugging MSTest Unittests in VisualStudio Code

这一生的挚爱 提交于 2019-12-01 20:20:30
I am trying to use Visual Studio Code to Debug a MSTest unit test project. But the tests just run and the breakpoint is never reached. Here is my launch.json: { "version": "0.2.0", "configurations": [ { "name": ".NET Core Test (console)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", "program": "C:\\Program Files\\dotnet\\dotnet.exe", "args": ["test"], "cwd": "${workspaceRoot}", "console": "internalConsole", "stopAtEntry": false, "internalConsoleOptions": "openOnSessionStart" }, { "name": ".NET Core Attach", "type": "coreclr", "request": "attach", "processId": "${command

DirectoryInfo.Exists always returns false during MSTest

六月ゝ 毕业季﹏ 提交于 2019-12-01 20:15:43
I have a little bit of logic at the boundary of my app dealing with creating directories. I would like to test that it actually creates directories as expected, but the DirectoryInfo.Exists property always returns false even when the directory actually exists. See also this question - you need to set a breakpoint to see that the directory has actually been created because MSTest will delete it when the test ends. Is there some setting that tells MSTest to allow "normal" filesystem IO during tests? Assuming you create the DirectoryInfo instance somewhat earlier there is some internal caching of

OpenCover MSBuild Integration - No results generated

女生的网名这么多〃 提交于 2019-12-01 19:02:27
After getting OpenCover to work on my machine, the next step is getting it to work with the build server. I've been trying to integrate OpenCover with MSBuild on a Bamboo Build Server. I have modified Build.proj as follows to run OpenCover after building the solution: <Target Name="TestAndCodeCoverage" DependsOnTargets="Build" > <Message Text="Executing Unit Tests and running OpenCover to check code coverage..." /> <MakeDir Directories="Coverage" /> <Exec Command='"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE

Can not get Resharper Test Runner working with MS Test on VS 2010

不羁的心 提交于 2019-12-01 18:55:46
问题 I have recently upgraded to VS2010 Premium and Resharper 5.1.3000.12. Its test runner will now not execute MS Tests. The dialog shows up but nothing happens. So when opening \Bin\Debug\TestResults .trx file, I see a list of tests reported as not executed. They will execute fine if I click run from this dialog. If I click to view the 'Test run error' link I see the error message: "Failed to queue test run 'user@network date': The system can not find the file specified" Nunit tests work fine.

How can I precisely time a test run in visual studio 2010

╄→尐↘猪︶ㄣ 提交于 2019-12-01 18:07:49
I have a suite of unit tests for my project which I run using the visual studio test runner. I want to know how long the test run takes when it runs. The test run details screen shows me the start and end times of the run, but only to the nearest second. My test suite at the moment is taking less than a second to complete, so I can't tell if my suite of 50 tests is taking < 0.1 second (good!) or up to 1 second (bad!). Is there any way to enable this level of precision? In your root solution directory, there is a folder called Test Results following the test runs. If you look in there, each run

Can not get Resharper Test Runner working with MS Test on VS 2010

三世轮回 提交于 2019-12-01 18:04:05
I have recently upgraded to VS2010 Premium and Resharper 5.1.3000.12. Its test runner will now not execute MS Tests. The dialog shows up but nothing happens. So when opening \Bin\Debug\TestResults .trx file, I see a list of tests reported as not executed. They will execute fine if I click run from this dialog. If I click to view the 'Test run error' link I see the error message: "Failed to queue test run 'user@network date': The system can not find the file specified" Nunit tests work fine. Any ideas? Thanks Well, look like Resharper 6 does not have the issue. http://confluence.jetbrains.net

Testing ASP.NET MVC website

久未见 提交于 2019-12-01 17:52:06
I'm working on an MVC site with an image upload capability and I want to write a test that will upload an image. I made an image called TestImage.jpg and set Copy to Output to be "Copy if Newer". In my test I try to load that with the following code: System.Drawing.Image testImage = System.Drawing.Image.FromFile(@"TestImage.jpg"); Shouldn't the "Copy to Output" copy it to the same directory where the test is running? If not, how can I find out where it was copied to? Best would be some kind of project root relative path so I can feel free to move the solution around without this breaking. in

Make MSTest respect [Conditional()] attribute?

你离开我真会死。 提交于 2019-12-01 17:04:17
I'm using VS2010, I have the following method call: [Conditional("DEBUG")] public void VerboseLogging() { } public void DoSomething() { VerboseLogging(); Foo(); Bar(); } Then I have a unit test for the DoSomething method which checks that it emits proper logging. [Conditional("DEBUG"), TestMethod()] public void EnsureVerboseLog() { DoSomething(); VerifyVerboseLoggingCalled(); // <-- fail in release builds since VerboseLogging() calls get eliminated. } It seems that MSTest only sees TestMethod and executes it (generating failed test) even though I've marked it with Conditional("DEBUG") and