ploeh blog

Mark Seemann's discontinued .NET blog.

Blog - About

About ploeh blog

Mark Seemann was a software development engineer working for Microsoft in Copenhagen, Denmark. This was his (professional) blog. Please visit the current ploeh blog instead.

All postings are provided "AS IS" with no warranties, and confer no rights. Any opinions expressed in this blog are solely those of the author and not official positions of Microsoft Corporation.

  • ploeh blog

    Integration Testing WCF Services

    • 28 Comments
    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...
  • ploeh blog

    Hello World

    • 20 Comments
    private static void Main( string [] args) { Person father = new Person (); Person mother = new Person (); Person girl = new Person (); Person boy = mother.Emit(mother.Union(father), new DateTime (2007, 4, 21)); girl.PromoteTo( Rank .BigSister); mother...
  • ploeh blog

    A Generic IAsyncResult Implementation

    • 19 Comments
    Lately, I've found myself writing implementations of IAsyncResult more than once, and as it turns out, all of those implementations have been so similar that I have ended up creating a generic implementation. When implementing the Async Pattern, you...
  • ploeh blog

    How To Dispose Members From Forms

    • 19 Comments
    When you create a new Form (or UserControl for that matter), Visual Studio creates it as a partial class, with the designer-generated code going into the *.Designer.cs file. One other piece of code that also goes into the designer code is an override...
  • ploeh blog

    Unit Test Your Enterprise Library Logging Logic

    • 17 Comments
    Most enterprise applications need to perform logging in some form or other, and the Enterprise Library Logging Application Block provides an excellent platform for implementation. With the Logging Application Block (henceforth LAB) you don't have to think...
  • ploeh blog

    Mocking Generic Methods With NMock2

    • 15 Comments
    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...
  • ploeh blog

    Unit Testing WCF Services

    • 15 Comments
    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...
  • ploeh blog

    Typemock

    • 15 Comments
    Roy recently posted his thoughts on Typemock - whether it's too powerful and will kill TDD. His conclusion seems to be a confident no , and he argues well, but I have to disagree with some of his points. However, first of all, I have to state that...
  • ploeh blog

    Running MSTest In An MTA

    • 14 Comments
    Writing deterministic, multi-threaded unit tests may not be your idea of a fun Saturday night, but with a little discipline and knowledge, it can be done, and it sure beats writing multi-dreaded code without the safety net provided by an automated test...
  • ploeh blog

    Code As Dependency Configuration

    • 13 Comments
    In his article on Inversion of Control and Dependency Injection , Martin Fowler has a quite interesting section towards the end where he talks about how to configure loosely coupled systems. One of his points is that in some cases, it makes more sense...
  • ploeh blog

    Integration Testing Principles

    • 12 Comments
    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...
  • ploeh blog

    Test Types

    • 12 Comments
    The recent discussion spawned by my former post has prompted me to write this entry about test types. There's not a single clear definition of what a unit test is, so sometimes people approach me with unit testing challenges that don't really relate to...
  • ploeh blog

    Towards Unit Testing Component Serializers

    • 12 Comments
    When writing complex components or controls, it is sometimes necessary to implement custom CodeDOM serialization of the control. If the code serialization logic is complex, it would be nice if it was possible to unit test this logic. It's not quite as...
  • ploeh blog

    Testing Events Using Anonymous Methods

    • 11 Comments
    If you are unit testing a class which may raise an event, it will be appropriate to test that the event is raised when appropriate. Before .NET 2.0, you had to attach an event handler to an instance of the class to test the event, but now you can do it...
  • ploeh blog

    Ambient Context

    • 11 Comments
    These days, I'm becoming increasingly enamored with the idea of implementing cross-cutting concerns using Thread Local Storage (TLS) or the current call context. For the most typical aspects of software, such as security and logging, the .NET framework...
  • ploeh blog

    Installing Event Sources For The Logging Application Block

    • 11 Comments
    One of the nice things about the Enterprise Library Logging Application Block (LAB) is that it's so darned configurable (like the other Enterprise Library Application Blocks). One of the benefits of this is that it makes it rather easy to unit test your...
  • ploeh blog

    Troubleshooting WCF In Production Environments

    • 11 Comments
    WCF is such a nice framework, and its diagnostics capabilities are really comprehensive. Really, I only have two (pseudo-)issues with diagnostics so far: Configuring diagnostics is pretty difficult to do (lots of XML editing involved) Reading...
  • ploeh blog

    Speaking in ANUG

    • 10 Comments
    Aarhus .NET User Group has been so kind to invite me to come and give a session on June 25th, 2008, and I've elected to speak about TDD and Installers, a subject that regular readers of this blog would correctly surmise is dear to my heart . Read more...
  • ploeh blog

    Provider Injection

    • 10 Comments
    In his article Inversion of Control Containers and the Dependency Injection pattern , Martin Fowler describes four types of inversion of control: Constructor Injection Property Injection Interface Injection Service Locator Constructor...
  • ploeh blog

    onevent Code Snippet

    • 10 Comments
    When raising events, the .NET framework design guidelines recommend that this is done from a protected virtual method named On<EventName> (unless the class is sealed or the event is static, etc.). This leads to a recurring pattern of similarly looking...
  • ploeh blog

    Fixture Setup With Installers

    • 9 Comments
    It's no secret that I prefer unit tests over integration tests. Whenever it's possible to replace an external resource dependency with a test double, I do that, but sometimes, you need to test the resource access component itself: If you have a data access...
  • ploeh blog

    Zero-Friction TDD

    • 9 Comments
    Writing good code is difficult. Unit tests are written as code, so a corollary to the first sentence is that writing good unit tests is also difficult. TDD (particularly if you interpret the last D as Design ) carries this challenge in abundance, since...
  • ploeh blog

    Data Access Component Testing Redux

    • 8 Comments
    About a year ago, I wrote about data access component testing using a custom helper class for setting up a shared fixture . Since then, I've standardized on using Installers for fixture setup whenever it makes sense, which it does in this case. Instead...
  • ploeh blog

    Unit Testing A CAB Controller

    • 8 Comments
    In my previous post I demonstrated how to create an application based on the Composite UI Application Block (CAB) while truly separating Views from Controllers by placing them in separate assemblies. My main motivation for separating these application...
  • ploeh blog

    Data Access Component Testing

    • 8 Comments
    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...
Page 1 of 6 (132 items) 12345»