mstest

Why does this Assert fail?

IEnumerable<ReportReceipt> expected = new List<ReportReceipt>() { new ReportReceipt("fileName1","Hash1","some comments1") }; IEnumerable<ReportReceipt> actual = new List<ReportReceipt>() { new ReportReceipt("fileName1","Hash1","some comments1") }; Assert.IsTrue(expected.SequenceEqual(actual)); I'm running MSTest with VS 2008....

MSTest VS2010 - DeploymentItem copying files to different locations on different machines

I have found that DeploymentItem [TestClass(), DeploymentItem(@"TestData\")] is not copying my test data files to the same location when tests are built and run on different machines. The test data files are copied to the "bin\debug" directory in the test project on my machine, but on my friend's machine they are copied to "TestResul...

Seeding repository Rhino Mocks

I am embarking upon my first journey of test driven development in C#. To get started I'm using MSTest and Rhino.Mocks. I am attempting to write my first unit tests against my ICustomerRepository. It seems tedious to new up a Customer for each test method. In ruby-on-rails I'd create a seed file and load the customer for each test. It se...

Code coverage in-place instrumentation: Cannot fully backup the binary error

Can anybody help with this error in the log of my Team Build 2010 build? It only seems to occur when I have two build agents running on the same machine at the same time. Run has the following issue(s): Code coverage in-place instrumentation: Cannot fully backup the binary 'C:\Builds\3\MyProject\Binaries\MyProject.UserMan...

Custom Assertions with MSTest - Handling the AssertFailedException

I would like to provide some custom Assert methods in my MSTest Unit Testing framework. I have my own static class "CustomAssert", and methods like the one below: public static void DatesAreEqualToDay(DateTime expectedValue, DateTime actualValue) { if (!( expectedValue.Year == actualValue.Year && expectedValue.Month =...

What are Contexts in MSTests?

I keep wondering what are Contexts when it comes to Unit testing. There seem to be 3 options for doing tests in Visual Studio: All Tests in the Current Context All Tests in Solution All Impacted Tests Point 2) is quite obvious to me, but I don't understand what Points 1) and 2) mean. Thanks ...

MSTest exception: Unit Test Adapter threw exception: Type is not resolved for member...

In my project I write tests using Microsoft's unit testing framework. All of my tests pass when I run them from Visual Studio but when I run the tests from MSBuild all of the tests fail with the following erorr message: Unit Test Adapter threw exception: Type is not resolved for member SomeType,*SomeAssembly* Version=assemblyVers...

Automatically run a list of tests in Visual Studio

Does anybody know how to automatically run a particular list of tests in the test list manager? We have two lists: a list of unit tests and a list of integration tests. Preferably we would like it to run the tests in the 'unit test' list automatically before it checks in to team system. We currently have a check-in rule that ensures th...

MSTEST folder deployment question

Is there a way to preserve folder structure with MSTEST deployment? I have a situation with some existing code where I have .config files in a subfolder (called "Configuration"). I can specify this folder using MSTEST deployment but, in it's infinite wisdom, MSTEST just copies the files from this folder to the run folder (TestResult\\O...

Setting Assembly Info for InternalsVisibleTo with MSBuild Community Tasks

I'm using MSBuild Community Tasks to automatically update my assembly version numbers according to my Subversion repository tag. I have added the following to my project file: This gives me a new AssemblyInfo.cs file: unfortunately I need to add the following to get my MStests to work properly: [assembly: System.Runtime.C...

Failed to queue test run: Unable to start the agent process(Visual Studio 2010)

Hi, While trying to run all the unit tests in my solution(Visual Studio 2010) I am getting a 'Failed to queue test run xxxx@MACHINENAME 2010-06-23 14:01:36': Unable to start the agent process' error. Does anyone know what causes this particular error to occur and how to resolve it so that I can run my unit tests? Thanks ...

CruiseControl.Net - Use of parameters in ccnet.config

I'm trying to use the CCNetBuildDate and CCNetBuildTime parameters to dynamically change the output filename of my unit test results, so for example: <project> <workingDirectory>C:\MyProject</workingDirectory> <tasks> <msbuild> <buildArgs>/property:TestResultsFile=TestResults.$[CCNetBuildDate].$[CCNetBuildTime].trx</b...

Unable to Debug MS Test on Visual Studio 2010?

I am using MS Test with Visual Studio 2010 to write unit Tests. When I debug a Test it shows a Message box as shown below Title : Downloading public symbols Message : System.XXXX.dll Has anyone else faced this issue with MS Test on Visual Studio 2010? This problem does not come when I run a test. Its only when I try to Debug a Test ...

TestDriven.NET runner not working with Silverlight 3 and MSTest

Hi, I am currently working on a project in Visual Studio 2010 that uses MSTest for Silverlight. I had recently converted this project from Visual Studio 2008 where the Silverlight-based tests ran without issue. However, when I try to run the unit tests at a test class scope (or beyond, i.e. "run all tests") in VS 2010 with TestDriven.NE...

Make MSTest respect [Conditional()] attribute?

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 EnsureVer...

Is it possible to build an MsTest project into a self-contained executable? How?

I can do so using MbUnit framework, but I cannot force everyone to install it (please do not ask); everybody already has mstest.exe as well as the library. http://www.gallio.org/oldwiki/MbUnit/TestExecutionUsingSelfExecutableTestAssemblies.html We do not even run unit tests yet, so the easiest way to cram it in is to reuse an existing ...

nCover + MSTest + CruiseControl = Zero Coverage

Hi, I use CruiseControl.net, MSTest 3.5 and nCover 1.5.8. I am new to nCover and want to integrate it in CruiseControl. The problem is that I get a 0% coverage result but it should be 100%. My demo app calls just one method and in my mstest project this method is tested. in my cruiseControl server all works fine without ncover and i ca...

MSTest /noisolation fails tests

Hi, If I use MSTest with the parameter /noisolation my tests fail, but without it they pass. If I run MSTest without the parameter for the first time a ms office configuration box appears and configures something because my tests depend on excel. this happens only the first time. then the test runs trough without problems. but if I ru...

CCnet MsBuild and MSTest

Hi, I've set up a CCNet Server with MSBuild and MSTest. Afterwards I've created a Test Project with some Unit Tests. The Build is sucessfull, but two of the Unit Tests do fail (on purpose). I receive an Email that the Build was not successfull (even only the Unit Tests failed). Is it possible to send a seperated Email (if only the Unit...

Can I unit test a method that makes Sitecore context calls ?

I'm working on a web application that is built over Sitecore CMS. I was wondering if we could unit test for example a method that takes some data from Sitecore makes some processing with it and spits out a result. I would like to test all the logic within the method via a unit test. I pretty confused after searching the internet wide an...