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
5
votes
1 answer

Pex and F# in Visual Studio 2010 Ultimate

I have been trying using Pex in a F# project but I have faced several issues on which I would appreciate some help: Visual Studio Pex addin worked for half an hour and not for complex project exploration. After that each time I run a Pex…
Nicolas
  • 51
  • 1
5
votes
3 answers

Cannot use moles to mock the MVC framework

I am trying to generate moles for the System.Web.Mvc DLL version 3, but I get the following error: Moles : info : metadata : loading C:\TFS.as12.Projects\Project X\Main\Source\3rdPartyComponents\MVC3\System.Web.Mvc.dll Moles : info :…
Maurice
  • 66
  • 3
5
votes
3 answers

Using Moles with XUnit - wrong dll version

I'm trying to set up Moles to use in our unit testing. We are using xunit, so I am using the Xunit extension that comes with moles (Microsoft.Moles.Framework.Xunit). However, as we are running Xunit 1.7, Moles is complaining that I am not running…
Smashery
  • 57,848
  • 30
  • 97
  • 128
5
votes
1 answer

How to run unit tests written with Microsoft Moles without installing it?

Our team is working on writing unit tests for a big .Net project, using “Visual Studio 2010” IDE and “NUnit” (v. 2.5.9) unit-testing framework. Also we use “Microsoft Moles” type-isolating framework. After we finished writing tests for specific…
Kirill
  • 81
  • 2
5
votes
2 answers

Moles without Pex?

Can Moles be used without having to use Pex? Also, Does anyone know when MS Moles will have a Release candidate? I am hesitant of using it in the Production system without knowing which direction it will head.
DotnetDude
  • 11,617
  • 35
  • 100
  • 158
5
votes
2 answers

What to put as the Provider for a mocked IQueryable

I am working with Moles and mocking a System.Data.Linq.Table. I got it constructing fine, but when I use it, it wants IQueryable.Provider to be mocked (moled) as well. I just want it to use normal Linq To Objects. Any idea what that would be? Here…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
5
votes
1 answer

How do I Unit Test an infinitely waiting listener?

I am using MSTest, Vs2010. I have a situation where a method with a while loop calls AutoResetEvent.WaitOne. I can trigger this event from my Test method; it will iterate one time and then again wait for this event to be triggered. I am unable to…
Devesh
  • 396
  • 1
  • 4
  • 23
5
votes
5 answers

Microsoft Fakes and .Net 4.0

we've been looking into using the new Fakes framework to help us increase the test coverage on some legacy code running under the .net 4.0 framework. Unfortunately, it seems like we're going to be unable to upgrade to .net 4.5. Would I be correct…
gmancoll
  • 53
  • 1
  • 6
5
votes
2 answers

Moles/Fakes: How do I implement a test setup?

I have been recently working with Moles and I am now switching to Fakes. In my old test project I had a test setup, which looked like this: [TestInitialize] public void Setup() { //... } In there I did some necessary setup just like setting up…
Thomas Mondel
  • 1,944
  • 3
  • 20
  • 25
4
votes
1 answer

Moles exited with code -1002, how can I know what happen to it?

I'm using Pex and Moles 0.94.51023.0 with VS2010 SP1. I have successfully made some Moles type of some Assembly reference and tested some cases. But this time with another reference, Moles has an error: Error 3 The command ""C:\Program…
bychance
  • 282
  • 4
  • 14
4
votes
1 answer

Warning of could not resolve Moles dlls on Build server

We are using moles 0.94 for some tests in our solution. However, every time it gets first compiled, the build server will raise a couple of warnings: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1360): Could not resolve…
geekysteven
  • 113
  • 1
  • 6
4
votes
1 answer

How to unit test network connections?

I want to unit test the code below. I've been working with MSTest and I tried to learn Microsoft Moles and RhinoMocks. But I couldn't make neither of them help me. I know I can change the code drastically to use interfaces that make it more…
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
4
votes
1 answer

How can I use Moles to return different values for multiple calls to a method in C#?

I've been trying to find a solution for this, but either I've been looking with the wrong search terms or there simply isn't an answer for my question yet. Problem: I've got a method that I'd like to write a unit test for. Within this method there…
Gorgsenegger
  • 7,356
  • 4
  • 51
  • 89
4
votes
1 answer

Why does Moles keep getting readded to my project?

I added Moles to a project in VS2010, decided I didn't want to use it and then removed the Moles reference and the .behaviours and .moles assemblies. The problem is that I repeatedly find Moles has been readded to the project with no intervention…
Dave
  • 41
  • 2
4
votes
1 answer

Can I set expectations on mole types created with Moles?

I need to not only swap implementation but also to add necessary check to make sure that certain methods were called in the right order. I can imagine something like Mole + Mock would give me this option. Does anybody know if Moles has this…
StanislawSwierc
  • 2,571
  • 17
  • 23
1
2
3
17 18