Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6166961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:25:49+00:00 2026-05-23T22:25:49+00:00

I was trying to find a consistent description on how to use moles isolation

  • 0

I was trying to find a consistent description on how to use moles isolation framework but haven’t found much on this topic.
So far i did the following:

  1. Download moles from here (x86 version).
  2. Install it.
  3. Here guy describes how to use it with custom library. So i added moles assembly for my own library. After rebuild the assembly appeared in references.
  4. Then i tried to add using of .Moles namespace and build the project but it failed with bunch of errors. Example with MDateTime didn’t work either. MDateTime just didn’t have any method.
  5. Considering that was 5th failed attempt to get it work i uninstalled it from the system.

So the question: does moles work for anybody at all? If yes how did you get there?
Should i also install pex to make it work?
What if i want to use it on build server from msbuild script? I saw they mentioned support of msbuild, but has anyone real experience with using it from msbuild?

For me it looks very raw to be used in serious development process.
Maybe someone has another opinion?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:25:50+00:00Added an answer on May 23, 2026 at 10:25 pm

    Yes, it works fine. I assume you’re installing v0.94.51023.0. For Moles to function properly, you must do a few things, to set up the test class. These quickly become second nature — don’t worry!

    1. You must create a “moled assembly”, for each assembly against which you wish to use Moles:

      a. Right-click an assembly in the “References” node of the Solution Explorer, and then select “Add Moles Assembly”.
      b. If you wish to mole a .NET Framework assembly, right-click the References node, and then select “Add Moles Assembly for mscorlib'”.

    2. Reference the Microsoft.Moles.Framework assembly in the .CS file:

      using Microsoft.Moles.Framework;

    3. Build the project. This causes the appropriate Moles framework references to be added to the project. As @Lara commented, step 3 will fail, without adding the references.

    4. Reference moled assemblies in the .CS file:

      using MyNamespace.Moles;

    5. Decorate test methods that use Moled types with the [HostType(“Moles”] attribute

      [HostType(“Moles”)]

    6. Identify either an entire assembly or individual types that are used in the .CS file, by using the assembly attributes:

      using MyNameSpace.MyAssemblyName.Moles;

      [assembly: MoledAssemblyType(“MyNameSpace.MyAssemblyName”)]

      [assembly: MoledType(typeof(MyNameSpace.MyAssemblyName.MyClass))]

    When the test project is compiled, Moles copies the “moled” assemblies, and then injects detours into the copy. The namespace of moled assemblies and types are appended with “.Moles”. Therefore, “MyNameSpace.MyAssembly” becomes “MyNameSpace.MyAssembly.Moles”. I’m sure you are also familiar with the “S” and “M” prefixes to the type names of moled assemblies. If not, please refer to the Moles Reference Manual.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use PdfSmartCopy from ItextSharp but I cannot find any relevant
Trying to find an XML file I can use in lieu of a look-up
still trying to find where i would use the yield keyword in a real
I use jQuery. I'm trying to find a way to get the current width
I am learning regular expressions and I am trying find this string day1otlk_XXXX.gif where
Trying to find the links on a page. my regex is: /<a\s[^>]*href=(\\'??)([^\\' >]*?)[^>]*>(.*)<\/a>/ but
I found this issue to always happen and not consistent. This issue causing jquery
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Trying to find the sqlserver adapter for rails on windows. I have tried getting
Im trying to find out a good JavaScript library that can create a nice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.