Telerik® JustCode™ by Progress

We've provided a tight integration between Telerik® JustCode™ and JustMock so that you can use them both side by side and benefit from each other's features.

You can also watch the video tutorial JustCode - Setting Mock Expectations with JustCode.

Unit Test Runner support for JustMock

The test runner fully supports JustMock so you can run both "elevated" and "non-elevated" unit tests with Telerik® JustCode™.

No matter whether the tests use JustMock or not, you run and debug all tests in the same way. Refer to the Run and Debug Tests topic.

Mock Warning

A warning is shown when a mock object doesn't have any arranges set or is not used in any mock assert. By default, this warning is turned off. You can turn it on from JustCode's options dialog.


This warning is available only for C# code.

Let's consider the following code:

C# Copy imageCopy
public void CalculateTax_PositiveInput_Success()
	var target = Mock.Create<Calculator>();
	double total = 100F;
	double tax = 0F;
	double expected = 100F;
	double actual;
	actual = target.CalculateTax(total, tax);
	Assert.AreEqual(expected, actual);

There are no arranges for target. Telerik® JustCode™ warns you for that in the Error List Window and in the Marker Bar.

Mock Warning

Quick Fix: Add New Arranges for Mock Object

To fix the mock warning, we provide a special quick fix - Add New Arranges For This Mock Object. You can quickly add arranges for the currently unused mock object without writing a single line of code.

  1. Position the caret over an unused mock object.
  2. Press Alt+Enter. From the pop-up menu, select Add New Arranges For This Mock Object.

    MocK Add New Arranges
  3. Select the member you'd like to set an arrangement for and click Add.

    Mock Select Member
  4. In the dialog you can set expectations for the selected member. You can configure the return type of the method, as well as all the parameters that it accepts. You can use JustMock Matchers (Any), a default value or a specific value to pass as a parameter.

    Mock Set Expectations
  5. By clicking Finish you get as a result an arrange statement for the selected member without writing a single line of code.

    Mock Arrange Result

Create Mock Arrange

Even if you already have some arranges set for a mock object, you can still take advantage of the dialog for setting a new arrange statement.

  1. Position the caret over the Mock.Create method.

  2. Press Alt+Insert. From the pop-up menu, select Create Mock Arrange...

    Mock Create Mock Arrange
  3. This will lead you through the same steps as in the Add New Arranges For This Mock Object fix.


In order to rename, you can also navigate on the main menu. Choose JustCode | Refactor | Create Mock Arrange..., or just press Ctrl+R, Ctrl+K.

See Also