The Inquisitive Coder – Davy Brion's Blog

Trying to walk that thin line between intelligence and ignorance

I can’t help it…

Posted by Davy Brion on July 25th, 2008

but i think this is cool:

        [Test]

        public void DisposesRequestProcessorUponDisposal()

        {

            requestProcessor.Expect(r => r.Dispose());

            requestProcessor.Replay();

 

            dispatcher.Dispose();

            requestProcessor.VerifyAllExpectations();

        }

i know… i know… total geek.

4 Responses to “I can’t help it…”

  1. kve Says:

    cool man!

    what is it?

  2. Davy Brion Says:

    i would think (hope) that it’s pretty obvious…

  3. HardTime Says:

    I think the r => r.Dispose() is the hard part. I do think it’s obvious, although … maybe not pretty obvious ;-) . But yeah, pretty cool.
    Type inference in C# (3.whatever) sucks big time b.t.w., ( r being an inferred Request class I guess, I’m still on 2.0 … ) either go all the way, or don’t do it at all, is my opinion. I think ambiguity should be avoided, unless it enriches the language, as for instance the ambiguity of multiple inheritance does. The C# sharp guys haseem to miss this point on multiple occasions. MS’s current infatiation with functional languages that seeps through in their own implementation does not do justice to the origanal ideas. Check out Scheme, Haskell, or Lisp.

  4. HardTime Says:

    And check out the Nomad pattern while you’re at it… It blew my mind.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>