Questions tagged [pex-and-moles]

pex-and-moles developed by Microsoft research team. Pex being an exploration tool explores and provides random inputs to the method in test to go in every branch of that code. Moles being an isolation framework isolates the code to be tested from all dependencies.

85 questions
1
vote
2 answers

How to call delegate only once / one time with moles?

How is it possible to call a delegated Method only once / one time with moles? MyClass.AllInstances.ResultateGet = delegate { return new ResultatInfoCollection(); }; I want to call the Method "ResultateGet" only one time because the init is quite…
1
vote
1 answer

Moles/VS2010 SP1 Issue - Error 32, exit code -1002 building mstest with Moles 0.94.51023.0

Update 6/20/2011 I can only build the test project once or twice before getting this error. Moles is unusable for me until this is resolved. Deleting obj/bin and closing/reopening visual studio isn't practical. The Error Error 32 The command…
John Dhom
  • 1,022
  • 9
  • 21
1
vote
1 answer

Moles test completes successfully when debugging tests, but moles host crashes when selecting "run tests"

I have an issue running some moles tests within Visual Studio 2010. Within a test fixture, I have 4 tests - which when I run them in Debug mode, they all work properly. When I run them using "Run Tests" rather than "Debug Tests", one in particular…
dotnetnate
  • 769
  • 4
  • 11
1
vote
0 answers

Using MS Moles with datacontext and stored procedures without using a Connection string

I have just begun to work with MS Moles for testing and I have followed the idea/pattern in which jcollum(thanks) uses a Mole for a table in this stackoverflow question here. But I am having a problem as I do not want to have to pass a connection…
Brian
  • 688
  • 5
  • 18
1
vote
1 answer

Parameterized testing tools with automatic code exploration

I've checked and played a bit with Microsoft Pex. It's a very handy tool/library even though it's not as straight forward to write parametrized unit tests with it. But when used correctly it can provide much better test code coverage than writing…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
1
vote
1 answer

can I use the MbUnit gui with Moles tests?

I'd like to set up our unit tests to use Moles -- mostly so we don't write a lot of interfaces in places that don't call for interfaces. Ok, that part is debatable but it is a concern on our team. To that end, we're investigating Moles. Moles is…
jcollum
  • 43,623
  • 55
  • 191
  • 321
1
vote
1 answer

How to use Moles to stub entity framework stored procedure call?

I'm trying to stub a call to db. The basic idea is for a line of code like this: Person person = (from p in this.Entities.FindPerson("Smith") select p).FirstOrDefault(); to return an object the way I want it without going of to db.…
Rad
  • 11
  • 1
1
vote
0 answers

Pex: list with non-null elements

I have a class that is basically a List with a fancy name (dyn_string). I would like to generate test cases with Pex. To teach Pex how to properly create a dyn_string I created this factory: #!cs [PexFactoryMethod(typeof(dyn_string))] public static…
stklik
  • 834
  • 1
  • 8
  • 19
1
vote
0 answers

Application breakage showing error of moles on server

I have an application (asp.net) which has referenced Moles.On development environment it is working fine but after deployment it breaks randomly giving the follwoing error- Could not load file or assembly 'Microsoft.Moles.Framework,…
Richa
  • 407
  • 1
  • 10
  • 22
1
vote
1 answer

How to add [assembly: PexLinqPackage] to a test project

I am trying to get Pex to work with linq in my project. I got this explanation on what I need to do: In order for Pex to support Linq, make sure you add a reference to Microsoft.Pex.Linq.dll and add the [assembly: PexLinqPackage] attribute to the…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
1
vote
1 answer

How to mock private or protected class variable in Microsoft moles?

I have the following example code as a class variable. protected static readonly string _url = "SomeURL"; I want to access that _url variable through either stub type or moled type. As I test, public static class variables can be accessed through…
DineshN
  • 11
  • 1
1
vote
1 answer

How to mole SharePointServiceLocator to work with the logger

I trying to figure out how to mole the Microsoft.Practices.SharePoint.Common.ServiceLocation.SharePointServiceLocator.GetCurrentFarmLocator because I trying to use …
Salvatore Di Fazio
  • 705
  • 2
  • 7
  • 25
1
vote
0 answers

create instance for stub class using moles call the actual class constructor

I'm new to Microsoft Moles. I tried to create instance for the stub class generated by Moles, and when I debug it calls the actaul class constructor which I don't need. how to achieve this in Moles. Provided a sample code below for better…
Sivakumar
  • 11
  • 2
1
vote
1 answer

Microsoft.Moles.NUnit.dll with nunit 2.6

How can I make Microsoft.Moles.NUnit.dll work with nunit 2.6. The docs say: Assembly Microsoft.Moles.NUnit.dll You will have to register that add-in with NUnit by copying the Microsoft.Moles.NUnit.dll assembly in the NUnit bin/addins…
bitbonk
  • 48,890
  • 37
  • 186
  • 278
1
vote
1 answer

Pex raises NullReferenceException when exploring

I'm writing a server component in C# and use Pex for unittesting. I've a complex parameterized unit test for a specific method. Now it turns out that as soon as i add a certain assert block, some pex exploration runs come up as failed with a…
Polity
  • 14,734
  • 2
  • 40
  • 40