JustMock is here !!

As announced earlier by Hristo Kosev at Telerik blogs , we have started giving out JustMock builds from today. This is the first of early builds before the official Q2 release and we are pretty excited to get your feedbacks.


Its pretty early to say anything on it. It actually depends on your feedback. To add few, with JustMock we tried to build a mocking tool with simple and intuitive syntax as possible excluding more and more noises and avoiding any smell that can be made to your code [We are still trying everyday] and we want to make the tool even better with your help. JustMock can be used to mock virtually anything. Moreover, we left an option open that it can be used to reduce / elevate the features  just though a single click. We tried to make a strong API and make stuffs fluent and guided as possible so that you never have the chance to get de-railed. Our syntax is AAA (Arrange – Act – Assert) , we decided to stay away from Record – Reply model which some of the smarter mocking tools are planning to remove from their coming release or even don’t have [its always fun to lean from each other] and honestly its kind of hard to comprehend . Overall more signals equals more complexity , reminds me of 37 signals :-).

Currently, here are the things you can do with JustMock ( will cover more in-depth in coming days)

Proxied mode

  1. Mock interfaces and class with virtuals
  2. Mock properties that includes indexers
  3. Set raise event for specific calls
  4. Use matchers to control mock arguments
  5. Assert specific occurrence of a mocked calls.
  6. Assert using matchers
  7. Do recursive mocks
  8. Do Sequential mocking ( same method with argument returns different values or perform different tasks)
  9. Do strict mocking (by default and i prefer loose , so that i can use it as stubs)

Elevated mode

  1. Mock static calls
  2. Mock final class
  3. Mock sealed classes
  4. Mock Extension methods
  5. Partially mock a  class member directly using Mock.Arrange
  6. Mock MsCorlib (we will support more and more members in coming days) , currently we support FileInfo, File and DateTime.

These are few, you need to take a look at the test project that is provided with the build to find more [Along with the document]. Also, one of the features that I will be using it for my next OS projects is the ability to run it separately in  proxied mode which makes it easy to redistribute and do some personal development in a more DI model and my option to elevate as i go.

I’ve surely forgotten tons of other features to mention that i will cover time but  don’t for get the URL : www.telerik.com/justmock

Finally a little mock code:


  1. var lvMock = Mock.Create<ILoveJustMock>();
  3.  // set your goal
  4.  Mock.Arrange(() => lvMock.Response(Arg.Any<string>())).Returns((int result) => result);
  6.  //perform
  7.  string ret =  lvMock.Echo("Yes");
  9.  Assert.Equal(ret, "Yes");
  10.  // make sure everything is fine
  11.  Mock.Assert(() => lvMock.Echo("Yes"), Occurs.Once());


Hope that helps to get started,  will cover if not :-).

Leave a Reply

Your email address will not be published. Required fields are marked *