Skip to content

A collection of practical examples demonstrating how to use Typemock Isolator for .NET to isolate and test hard-to-mock code like static methods, sealed classes, constructors, and legacy code without refactoring.

Notifications You must be signed in to change notification settings

Typemock/Typemock-Isolator-Examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Typemock Isolator .NET Examples

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.


πŸš€ About Typemock Isolator

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


πŸ“ Folder Structure

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/

Running Tests in Visual Studio

πŸ” 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:

image

Visual Studio Test Explorer:

image


Advanced option: Running Tests from Command Line:

▢️ dotnet test

%Installation_Dir%/BuildScripts/TMockRunner.exe dotnet test path/to/test.dll

See more: πŸ”— Running Tests with TMockRunner


About

A collection of practical examples demonstrating how to use Typemock Isolator for .NET to isolate and test hard-to-mock code like static methods, sealed classes, constructors, and legacy code without refactoring.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages