Questions tagged [moles]

Moles - an isolation framework for Microsoft .NET. It allow you to replace any .NET method with a delegate.

Moles is an isolation framework for Microsoft .NET, that allow you to replace any method (including non-virtual/static methods in sealed types) with your own delegate. The moles project was created by the Microsoft Research Pex team.

257 questions
4
votes
4 answers

Is Pex and Moles project still active?

They used to release a two new versions a month but since October 2010 they haven't released a new one. I've found this. But the fact they have closed its support forum on MSDN makes me suspect the project is not going forward. We are using it for…
Hero
  • 1,423
  • 1
  • 10
  • 9
4
votes
1 answer

Using Moles with DateTime

I'm starting to using Moles in unit tests and am struggling a little with documentation. I want to mole DateTime.Now. If you look around the old way of doing this was to add a reference to mscorlib, then add a stubx file for it (Add New Item ->…
Mark
  • 60
  • 4
4
votes
1 answer

Can Tests be written in 3.5 MsTest Unit Test assemblies?

Hi: I've enjoyed playing around with Pex and Moles...now it's time to use it in earnest to cover an legacy app as much as possible. We've started by converted to .NET 3.5 (the client can't yet host in .NET 4.0) We noticed that we are having trouble…
Ciel
  • 41
  • 2
4
votes
2 answers

Unit Testing Scheduler in the FUTURE C#

I'm using quartz.NET inside a scheduler project (class library) on my application, this is because i want the other projects to be agnostic of the actual implementation. In the future, if i want to change quartz for Castle Scheduler or Windows…
Bongo Sharp
  • 9,450
  • 8
  • 25
  • 35
4
votes
1 answer

Using Moles with System.Reflection

I'm trying to mole the method Assembly.GetEntryAssembly but it appears that only stub types are generated for the System.Reflection namespace i.e. System.Reflection.Moles.SAssembly is generated but not System.Reflection.Moles.MAssembly. I checked…
bjwbell
  • 553
  • 1
  • 6
  • 18
4
votes
5 answers

Trying to use Moles with NUnit. Getting "Moles requires tests to be an instrumented process"

I am trying to use moles with NUnit and am getting the following error "Moles requires tests to be an instrumented process". I am also using Visual NUnit within Visual Studio 2008 to get this working. Any help is welcome.
Seth
  • 363
  • 1
  • 4
  • 23
4
votes
3 answers

How to effectively test SiteCore LinkField

I have been using moles to write unit tests on the hard to reach parts of my code – particularly where I use the types found in the sitecore class libraries (which are hard to use mocking frameworks with). I have come across a surprisingly tricky…
chrislewisdev
  • 556
  • 1
  • 7
  • 21
4
votes
1 answer

Visual Studio 2012 Fakes not generating a stub for an interface that has a method with Stream return type

Using Visual Studio 2012 to generate stubs with "Add Fakes Assembly", everything works as expected, except it is failing to generate a stub for this interface: public interface IFileWrapper { IEnumerable ReadLines(string path); bool…
Adam
  • 3,872
  • 6
  • 36
  • 66
3
votes
1 answer

Moles For Linq Join

Been busting my head on this one - time to give it up to the crowd: anyone know how to successfully set a Mole (or any other unit testing work around) for a Join in Linq? Specifically, this particular project is using Linq to Sql. In fact, it is the…
sfuqua
  • 5,797
  • 1
  • 32
  • 33
3
votes
3 answers

Can't access information from configuration files when tests have host type "Moles"

We are having problems accessing information in .net configuration files (such as app.config and web.config) via unit tests when the unit tests have a host type of "Moles". It's causing quite a few headaches, so I hope someone has an idea on what…
Nicholas Hill
  • 306
  • 2
  • 18
3
votes
1 answer

mocking session variable in unit test using Moles

Method I am unit testing checks for a session variable like if(Session["somevar"] != null) { // rest of the code } In my test, not able to get rid of this since Session is null, it's throwing null referrence exception. To bypass this, I have…
Rahul
  • 76,197
  • 13
  • 71
  • 125
3
votes
1 answer

Pex & Moles - Dependencey Injection

I'm new to Pex and Moles. I am trying to run Pex on my code but I am using Constructor injection. Is there a way of instructing Pex on how to inject the constructors? Edit public UserLogic(IUserRepository userRepository) { …
ministrymason
  • 1,783
  • 2
  • 20
  • 33
3
votes
1 answer

Running Unit Test with Microsoft Moles Host under Visual Studio 2010 Remote Test Agent in TFS Build

We would like to have our TFS automated CI build and test process use a remote test agent to run our tests separate from our build agent. On normal unit tests that do not use moles or moles host, we have no problems. However, when we include a moles…
John Dahle
  • 244
  • 1
  • 6
3
votes
1 answer

Running Moles on a build server - any ideas how to skip code generation?

Running Moles 0.94 in order to stub out certain types in 3rdparty assemblies which would be otherwise hard to test. Works great locally, tests pass and the solution compiles fine. The first time it compiles it does take quite a while because it…
chrislewisdev
  • 556
  • 1
  • 7
  • 21
3
votes
2 answers

Moles is not working with MVC3 (System.Web.Mvc.dll)

I just started investigate moles framework and I get not really good experince from start. By some reason I can't generate moles for the System.Web.Mvc.dll (v.3) I will try to explain my problem step-by-step In just created empty solution I adding…
user863388
  • 31
  • 1
1 2
3
17 18