Code Contracts and Pex: Power Charge Your Assertions and Unit Tests

Sign in to queue

The Discussion

  • User profile image

    Near the end now and I really need to ask:

    Witch one is nicer in your opinion ?

    1. MDataTime.NowGet() = () => DateTime.Now;

    2. Isolate.WhenCalled(()=> DareTime.Now()).WillReturn(DateTime.Now);


    And you know what's great, WillReturn can have a delegate also, but it does not have too all the time.

  • User profile image

    > Witch one is nicer in your opinion ?

    Let's say that both are not as good as they could be. Language/CLR support would be the ultimate solution.


    ps: 1. will result in a stackoverflow since the delegate will recursively call itself. Not sure about 2.

Add Your 2 Cents