So I recently started to use Typemock instead of Moq and I’m currently getting acquainted with the API. I just found something that I really think shows that they are putting in some effort to the product. It’s no fancy feature just something that I think every Mocking-framework should provide: “Informative and guiding exceptions when you use the framework inappropriately.”
Take this for an example:
[Test, Isolated]
public void Execute_WhenNoNotationExistsAndDateIsToday_RegistrationIsAllowed()
{
var scenario = new RegisterSleepNotationScenario().ConfigureParams(
p => p.NewSleepNotation = new SleepNotation(new Kid(), Week.Current, DayOfWeek.Monday, 1, 50));
var sleepNotationsSourceFake = Isolate.Fake.Instance<IEditableObjectSource<SleepNotation>>();
scenario.SleepNotaionsSource = sleepNotationsSourceFake;
scenario.Execute();
Isolate.Verify.WasCalledWithExactArguments(
() => sleepNotationsSourceFake.Insert(scenario.Params.NewSleepNotation));
}
This test resulted in the following exception from Typemock:
This informative message then lead me to the small change:
var expectedNewSleepNotation = scenario.Params.NewSleepNotation; Isolate.Verify.WasCalledWithExactArguments(() => sleepNotationsSourceFake.Insert(expectedNewSleepNotation));
Which resulted in a green test and a happy developer, without having to use Google or the Typemock-documentations to search for: “how to consume WasCalledWithExactArguments”. As it should be. Thank you Typemock!
//Daniel
Advertisement

the image is broken – what does it say?
Hi,
The image looks good to me. Don’t understand why you can’t see it.
Well it says:
//Daniel
So I guess someone might think the code is hard to read. I totally agree and the code has been rewritten to not use the Configure methods etc, but instead a request/response solution, but that’s not the point of this post. The point is….
The good guidance from Typemock.
//Daniel
[...] This post was mentioned on Twitter by Roy Osherove. Roy Osherove said: a pat on the shoulder for the typemock crew – people like our verbose exceptions http://bit.ly/c9y4zK [...]
Thanks, Daniel, you made my day!
Doron
Typemock