Welcome to the official example repository for Typemock Isolator, the most powerful mocking framework for .NET.
This repository showcases official example projects for Typemock Isolator, the most powerful .NET mocking framework. It includes real-world and minimal examples that demonstrate how to unit test hard-to-mock .NET code, including static methods, sealed classes, legacy systems, and private members using Typemockβs advanced mocking engine.
Typemock Isolator is a powerful and flexible mocking framework designed to test legacy code without the need for refactoring. It allows developers to isolate and control dependencies, including the toughest ones like:
- Static methods
- Sealed classes
- Non-virtual methods
- Private methods
- Constructors
Isolator lets you create tests before design, giving you full control over the behavior of any .NET code.
π Learn more in the online documentation
Examples/
βββ CSharp/ # Examples using the full .NET Framework (e.g., .NET 4.5+)
β βββ Typemock.Examples.ThirdPartyProject/
β
βββ CSharpCore/ # Examples targeting .NET Core / .NET 5+
βββ Typemock.Examples.Core.ThirdPartyProject/
π How to Run the Examples To run these examples successfully, follow the steps below:
β Step 1: Install Typemock Isolator
Download the installer:
π Download Isolator
π Installation Guide
β Step 2: Clone this repository:
git clone https://github.com/typemock/Typemock-Isolator-Examples.git
cd Typemock-Isolator-Examples
Open one of the solution files:
For .NET Framework: CSharp/Typemock.Examples.sln
For .NET Core / .NET 5+: CSharpCore/Typemock.Examples.Core.sln
Build the solution.
β Step 3: Open and Run Tests in Visual Studio Run the tests using Test Explorer or Typemock Smart Runner in Visual Studio.
Typemock Test Navigator:
Visual Studio Test Explorer:
%Installation_Dir%/BuildScripts/TMockRunner.exe dotnet test path/to/test.dll
See more: π Running Tests with TMockRunner