Tag Archives: Unit Testing

Unit Test Workflow 4 Activities : Dependency Injection

At first glance unit testing workflow activities with dependency injection seems like a no-brainer. For example consider the following activity using constructor-based dependency injection. public class SendEmail : CodeActivity { private readonly IEmailClient emailClient; public SendEmail() : this(new EmailClient()) {} public SendEmail(IEmailClient emailClient) { this.emailClient = emailClient; } public InArgument<string> To { get; set; } [...]

4  

Unit Testing Workflow 4 Activities : The TestContext Tracking Participant

I’m a big believer in using TestContext in MSTest or Console.WriteLine, Debug.WriteLine etc in your favourite Unit Testing framework to give context to passed or failed tests. Especially if you do CI and have only the test results to look at from the build server to try to understand why a build went wrong. Taking [...]

0  

Unit Testing Workflow 4 Activities : Basics

Unit testing workflows became a lot easier in WF4. The basic approach is the same as for normal code classes except for a few differences which we will cover in the posts in this series. Lets start off with a simple code activity which will return the time in a given city. public class GetCityTime [...]

1  

Unit Testing Visual Studio DSL Tools

I’ve been meaning to post this entry for a while now so while I wait for a 2010 beta install to complete…. For a long time I thought it wasn’t possible to unit test DSL Tools projects easily. Due to the nature of the environment it is sometimes difficult to see how unit testing is [...]

0  

MS-Test DeploymentItem Attribute……..Aaaaaaaagh!

We have a policy of using MS-Test, although that is overdue for a serious review. So it turns out you can use the deployment item attribute…. [TestMethod] [DeploymentItem("UnitTest.MyProject.TestData.xml")] public void GetAllStatuses() {…} ….As long as you don’t provide a constant… public const string XMLCONFIGFILE = “UnitTest.MyProject.TestData.xml”; [TestMethod] [DeploymentItem(TestHelper.XMLCONFIGFILE)] public void GetAllStatuses() {…} It just ignores [...]

2  

Visual Studio Unit Test and the evil vsmdi

During a recent project we found a recurring problem where the test view of the unit (& integration) test projects would not load and we could not run tests. This was typically seen by the Test View load progress bar sitting at around 99%. This just adds to the list of “features” of VSTS Unit [...]

0