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

    Testing Against The Passage of Time

    • 7 Comments
    This is the fourth in a small series of posts about testing against non-determinism. In this installation, I'm going to cover the passage of time. In my former post , I demonstrated how you can use the Provider Injection pattern to decouple your test...
  • ploeh blog

    Testing Against The Current Time

    • 6 Comments
    This is the third in a small series of posts about testing against non-determinism. In this installation, I'm going to cover how to deal with the current time or date. If you have logic that is dependent of the current time or date, test results will...
  • ploeh blog

    Testing Against Guids

    • 5 Comments
    This is the second in a small series of posts about testing against non-determinism. In this installation, I'm going to cover Guids. Despite sharing some similarities with random numbers, Guids actually turn out to be a lot less difficult to use in...
  • ploeh blog

    Testing Against Randomness

    • 1 Comments
    This is the first in a small series of posts about testing against non-determinism. In this installation, I'm going to cover randomness. When code paths are selected at random, the outcome of a unit test may not be deterministic. Consider this example...
  • ploeh blog

    Testing Against Non-Determinism

    • 4 Comments
    Although computers tend to be rather deterministic in nature, you will sometimes have to deal with concepts that are de-facto non-deterministic. These include, but are not limited to: Random numbers. These are typically generated by a random number...
  • 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

    Unit Testing Activity CodeDOM Serializers

    • 2 Comments
    Windows Workflow Foundation (WF) defines workflows as object graphs. To save or compile workflow definitions, these object graphs must be serialized, and WF supports serialization to both XAML and code. Similar to other components, WF utilizes the .NET...
  • ploeh blog

    BPL

    • 4 Comments
    Although my daughter is now 4½ years old, she still can't write code. Some may say that it's because she has not yet learned to read and write in general, but we at Microsoft know differently: Even though our current development tools are very productive...
  • ploeh blog

    Validating Code Serialized by CodeDomDesignerLoaders

    • 1 Comments
    A while back I wrote about unit testing component serializers , but I left the task of validating the generated code against an expected result up to the reader. The approach outlined in that article was to retrieve the generated code as a string and...
  • 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

    Service Locator 2 Released

    • 8 Comments
    After far too much delay, today I have finally released Service Locator 2 to the web. Since GotDotNet is being phased out, I have moved the project to CodePlex , which means that you should go to Service Locator's new home to download the new release...
  • ploeh blog

    TOOD? TOOP?

    • 8 Comments
    Roy Osherove has noted a discrepancy between pure object-oriented design and testable design principles, and suggests that it's time to revisit how we think about software design. His current example is how the FxCop team has decided to internalize an...
  • ploeh blog

    How Will LINQ Impact Database Development Best Practices?

    • 5 Comments
    Ever since I first heard about the LINQ project , I've been wondering how this would fit in with our best practices for database development. Slowly, I think I've arrived at an interim conclusion. Since this posting deals with future developments in best...
  • 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

    Vote For Generic Set Class

    • 7 Comments
    From time to time, I find myself in a situation where I need a class that mimics the behavior of a mathematical set: Elements are unordered An element can only appear once Sets can interact via Union, Intersect, Difference, IsSubset, IsSuperset...
  • ploeh blog

    ClassCleanup May Run Later Than You Think

    • 5 Comments
    In addition to the well-known TestInitializeAttribute, the Visual Studio Team System unit testing framework also includes both initialization and clean-up attributes for both individual test cases, classes and assemblies. Although the use of these attributes...
  • ploeh blog

    Mapping SAML Tokens to IPrincipals

    • 6 Comments
    In my post about integration testing of WCF services , I briefly touched on the topic of authorization managers and the desirability of separation of concerns. When working with user identity, it's important to place authentication and authorization logic...
  • ploeh blog

    Integration Testing With Certificates

    • 7 Comments
    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...
  • 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

    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

    Vertical Guidelines in Visual Studio

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

    TechEd Aftermath

    • 0 Comments
    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...
  • 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...
  • 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

    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...
Page 4 of 6 (132 items) «23456