Question About NerdDinner Controller Constructors

Posted by Gavin Draper on Stack Overflow See other posts from Stack Overflow or by Gavin Draper
Published on 2010-04-29T11:40:54Z Indexed on 2010/04/29 11:47 UTC
Read the original article Hit count: 176

Filed under:

I've been looking at the Nerd Dinner app, more specifically how it handles its unit tests.

The following constructors for the RSVPController are confusing my slightly

public RSVPController()
    : this(new DinnerRepository()) {
}

public RSVPController(IDinnerRepository repository) {
    dinnerRepository = repository;
}

From what I can tell the second one is used by the unit tests so it can use Fake repositories. What I cant work out is what the first constructor does. It doesn't seem to ever set the dinnerRepository variable, it seems to imply its inheriting from something but I really don't get it.

Can anyone explain?

Thanks

© Stack Overflow or respective owner

Related posts about c#