Integration Testing With Certificates

In my post about integration testing of WCF services, I hinted that one compelling reason to perform integration testing of services would be to test authorization managers or message interceptors. When working with message security, certificates tend to be ubiquitous, so you need some automated way to set up certificates for a test suite. Keep in…

7

Integration Testing WCF Services

In my previous post about unit testing WCF services, I hinted at the need to perform integration testing of services as well. As Jimmy writes, you should still place your logic involving OperationContext in the Service Interface Layer (SIL): In many cases, you need to know something about the context of the operation, such as authentication…

28

Unit Testing WCF Services

A few years ago, when ASP.NET web services were the only (or at least most common) implementation of web services on the Microsoft platform, you couldn’t really unit test services. Obviously, since you had programmatic access (via a proxy class) to the service, you could write tests against the service using unit testing tools, but…

15

Vertical Guidelines in Visual Studio

From time to time, I’ve found myself wishing that Visual Studio had vertical guidelines in the code editor. This may not apply to all developers, but in some scenarios, I’d really like to have a visual right border when writing code. In my case, it’s typically when I’m writing sample code for publication, where code must…

3

TechEd Aftermath

With TechEd: Developers long over, I thought I’d post a few links to the residue I left in my wake Jeff and Scott apparently found my session useful: http://blog.usingtangent.net/2006/11/tech-ed-unit-testing-best-practices.html. While I was at TechEd, I also gave an interview for the Virtual Side. It appears as a part of a longer podcast, shortly after the…

0

Data Access Component Testing

In a typical n-layer enterprise application, there’s almost always a data access layer with one or more data access components (DACs). In some cases, a DAC has complex interactions with its relational data store, and it will be a good idea to subject the DAC to a suite of integration tests. This may not always be…

8

Integration Testing Principles

As I’ve written before, integration tests are different from unit tests, but that does not mean that unit testing tools such as Visual Studio Team System can’t or shouldn’t be used to define integration tests. However, many integration tests will, by their nature, require the presence of external infrastructure, such as a relational database, web…

12

Mocking Generic Methods With NMock2

Recently I was asked how to mock a generic method, now that NMock2 supports generics. Here’s how: Suppose you have this interface: public interface IMyInterface{    T DoStuff<T>();}  And this class using IMyInterface: public class MyClass{    private IMyInterface mi_;     public MyClass(IMyInterface mi)    {        this.mi_ = mi;    }     public string DoSomething()    {        return this.mi_.DoStuff<string>();    }}…

15

Generating NotImplementedException Instead Of Exception

Ever since I started using Visual Studio 2005, I’ve been enjoying its refactoring features, but it has always been bugging me that when you generate a new method stub or implement an interface or abstract class, the auto-generated method throws System.Exception instead of NotImplementedException. However, now I’ve finally found out how to change this behavior,…

0

Console Unit Testing

In many scenarios, console applications are very useful, but if you have a console application of intermediate complexity, you should obviously unit test it like all the other code you write – right? If you have a console application as an administration utility for a complex piece of software you are developing, the console application…

7