Telerik® JustMock™ by Progress

In this topic you will learn how to easily cover advanced (or elevated) testing scenarios with Telerik JustMock. Advanced testing scenarios include:

  • Mocking Sealed Classes
  • Mocking Static Classes, Methods and Properties
  • Mocking Final Methods and Properties
  • Mocking Framework Methods (MsCorlib)
  • Mocking Non-public Members and Types
  • Mocking LINQ Queries
To cover these scenarios, Telerik JustMock uses the .NET Profiling API. We provide integration tools with Visual Studio and you need to use the Enable and Disable commands from within the Telerik JustMock menu when you run unit tests that utilize the advanced scenarios.

Telerik JustMock supports what we call a dual architecture which basically covers the basic and the advanced(elevated) scenarios. In "basic mode" we support mocking interfaces, virtual and abstract methods and properties. While you mock those types you only need to reference the Telerik.JustMock.dll in your project. In this mode keep Telerik JustMock disabled and let your unit tests run lighting fast.

When you need the advanced features, you need to go to "elevated mode", i.e. to enable Telerik JustMock from the menu. In this mode Telerik JustMock makes use of the .NET Profiling API with a specially designed dynamic proxy library optimized only for the mocking needs.

How to Enable/Disable Telerik JustMock?

You only need to enable Telerik JustMock when you want to use the advanced features.

To enable/disable Telerik JustMock go to the Telerik JustMock menu and select Enable/Disable or use the shortcuts Ctrl+Alt+[ / Ctrl+Alt+] accordingly.

Enable/Disable JustMock
Figure 1: Enable/disable Telerik JustMock

How to Disable Telerik JustMock programmatically?

If you are not using any of the Advanced features described in this section, you may want to ensure that Telerik JustMock is not using the profiler.

Here is a quick example:

C# Copy imageCopy
public void Setup()

In This Section

Final Mocking
Describes how to mock Final methods.
Silverlight Mocking
Describes how to use Telerik JustMock within Silverlight applications.
Sealed Mocking
Describes how to mock Sealed classes.
Static Mocking
Describes how to mock Static claasses, methods and properties
Partial Mocking
Describes how to mock some of the methods of a class while keeping the rest intact.
Private Accessor
Describes how to use the Telerik JustMock Private Accessor to invoke private members.
Concrete Mocking
Describes how to use future mocking automatically based on an expectation.
Future Mocking
Describes how to mock the creation of an object.
MsCorlib Mocking
Describes how to mock framework methods.
Mocking Non-public Members and Types
Describes how to mock non-public members and types.
Mocking LINQ Queries
Describes how to mock LINQ queries.
Mocking DLL Imports
Describes how to mock DLL imports.
Entity Framework Mocking
Describes how to mock Microsoft Entity Framework objects.
SharePoint Mocking
Describes how to mock Microsoft SharePoint objects.
OpenAccess Mocking
Describes how to mock Telerik OpenAccess objects.
Threadpool Mocking
Describes how to mock objects and access them from different threads.
Extension Methods Mocking
Describes how to mock extension method calls.

See Also

Other Resources