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

VS2010 Professional using Moles...receive error "System.InvalidOperationException : Could not start Moles host."

My situation is similar to user2768132's question (VS2010 pro not able to start Moles host), however, I have a couple differences. I also attempted the suggestion by SouthShoreAK but it didn't resolve my problem. Pardon the similar post. I'm new…
0
votes
1 answer

Can Moles be used to create a sealed class?

I am trying to mock my Linq To SQL classes. I have the following code: IQueryable vUser = (from aUser in _ctx.Users where aUser.UserName == userName select aUser); Clearly while doing a unit test _ctx.Users is null. I can…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
0
votes
1 answer

TFS Build is failing while running Moles

My TFS 2010 Build is failing due to Moles framework. Its unable to generate sharepoint.moles assembly. Currently I am having Visual studio premium installed and Moles 64 bit on the Build server. Please note that this is a sharepoint 2010 project so…
0
votes
1 answer

Moles crashing when unit test debugging is being stopped

I'm using Pex and Moles Power Tools 0.94.51023.0 64-bit (en_visual_studio_2010_pex_0.94.51023.0_power_tools_x64_598803.exe) in Visual Studio 2010 SP1 (Windows 7 Enterprise 64-bit, all updates installed via Windows Update). Project is .NET 2.0,…
Jaded
  • 1,802
  • 6
  • 25
  • 38
0
votes
1 answer

Is worth starting with Moles in VS2010 right now?

We are considering starting to use Moles as we found ourselves creating a lot of Facades here and there. Then I read somewhere than Fakes is replacing Moles in VS2012 and that it requires changes to move from one infrastructure to the new one. My…
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
0
votes
1 answer

moles: making sealed internal classes visible to

I need a help as I am very new to moles, I have the following code: namespace A.BusinessLayer { sealed class AManager { void Method1(object obj){ // do something } } public class B { void Method1(object obj){ if some thing{ AManager a=new…
Devesh
  • 396
  • 1
  • 4
  • 23
0
votes
1 answer

Stubs access to the protected variables

I need to test this class: public abstract class GaBase { protected GoogleAnalyticsInfo GAInfo; protected abstract void PopulateGAInfo(); public string GetGoogleAnalyticsTag() { //Return any info related to GAInfo } …
Kapoue
  • 847
  • 2
  • 11
  • 15
0
votes
2 answers

Mocking the throwing of exceptions with Microsoft Moles

Possible Duplicate: How to throw a SqlException(need for mocking) I want to mock the throwing of SqlException when ExecuteNonQuery is executed; System.Data.SqlClient.Moles.MSqlCommand.AllInstances.ExecuteNonQuery = (command) => …
SeeNoWeevil
  • 2,549
  • 4
  • 26
  • 39
0
votes
2 answers

DefaultIfEmpty Linq to Sql returning null in Moles test

I made a moles in for testing my repository class and it works when I put DefaultIfEmpty(new Drivers()) but when I run the program, I get this error: Unsupported overload used for query operator 'DefaultIfEmpty'. But when I put it back to…
MilkTea027
  • 301
  • 1
  • 5
  • 24
0
votes
1 answer

Many errors when "Add Moles Assembly for mscorlib"

I want to de-tour some method calls into the mscorlib assembly, so I tried to generate a Mole assembly for mscorlib. But it gives me thousands of errors. I am using Win8+VS2010, VS2012 is installed on my box, too. What I did is: Step 0: Create an…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
0
votes
1 answer

Moles framework: How does it drill through?

When Moles framework is used, it allows any function call to be mocked up. This is aquote from here: http://msdn.microsoft.com/en-us/library/ff798308.aspx When execution enters a method, such as the DateTime.Now property getter, the Moles…
TheSilverBullet
  • 605
  • 7
  • 21
0
votes
1 answer

Mole System.Random class

I have the following method to test : public float coverageJump(bool a) { int c = 0; first: c++; Random random = new Random(); float result = random.Next(0, 100); Console.WriteLine(result); if(result < 50) goto…
Boymix81
  • 31
  • 4
0
votes
1 answer

UnitTesting with Moles for tightly coupled 3rd party DLL

I'm new to PEX and Moles just wondering how to UnitTest with moles something like below. I just need a UniDynArray to test. But Creating a UniDynArray depends on the UniSession and UniSession Depends on UniObjects.OpenConnection. When i run this…
AllSpark
  • 425
  • 1
  • 4
  • 17
0
votes
1 answer

ASP.NET mocking Membership.GetUser with Moles framework

Here is a method that returns a view model with user information: public ActionResult EditUserInfo(string userName) { try { var user = Membership.GetUser(userName); var model = new…
Ashton H.
  • 291
  • 1
  • 5
  • 15
0
votes
1 answer

Moles hosting unable to resolve dependent assembly

I'm developing a test method where both RhinoMocks as well as Moles are used. I have declared the host type as Moles for the test method as required. Now when it comes to the point where RhinoMocks has to emit a runtime assembly to create a mock for…
Chai
  • 468
  • 4
  • 5
1 2 3
17
18