How Moles Isolation framework is implemented?

后端 未结 2 1450
臣服心动
臣服心动 2020-12-02 17:42

Moles is an isolation framework created by Microsoft. A cool feature of Moles is that it can \"mock\" static/non-virtual methods and sealed classes (which is not possible w

2条回答
  •  情话喂你
    2020-12-02 18:14

    This is working like as wrapper to any assembly you want, for example mscorlib (this example baseing on Moles Assembly Wrapper of mscorlib). This giving to you power to replace any .NET method by the delegate written by coder.

    This is not working automagicaly. You must first create before this start works, Moles XML configuration file with list of Assemblies to "Wrapper" and by this code Moles generate a References of this assembiles from config file. And you must in this file add using namespace System.Moles, and before function [HostType("Moles")]

提交回复
热议问题