DCSIMG
Moles in Visual Studio 2012 – The new Fake feature - Manu Cohen-Yashar's Blog

Manu Cohen-Yashar's Blog

Moles in Visual Studio 2012 – The new Fake feature

Unit testing is not easy. One of the greatest challenges is to identify external dependencies and provide mock objects and behaviors. Few years ago Microsoft Research came out with an infrastructure called “moles” designed to solve this problem. With moles is was extremely easy to inject mock behavior and functionality to existing code (including code we don’t own such as the .net framework itself)

Well In Visual Studio 2012 moles was adopted and introduced as the “Fake” feature.
Now all we need to do to inject mock behavior to external code is create a fake assembly by right clicking the referenced assembly and choosing “Add Fake Assembly”. Now all left to do is to inject mock behavior to the new mock objects and use it in our test.

image

The details about using the fake objects and injecting mock functionality can be found here.

Enjoy

Manu

Comments

Moles and Fakes in Visual Studio 2012 | SELA Blog News | Scoop.it said:

Pingback from  Moles and Fakes in Visual Studio 2012 | SELA Blog News | Scoop.it

# October 17, 2012 9:23 AM

Jeff LeBert said:

It is very important to note that Fake is ONLY in VS 2012 ULTIMATE. That means everybody who wants to run your unit tests must have VS 2012 ULTIMATE. Not Premium or Professional. Microsoft says they will release a version of Moles that works with VS 2012. For me and my company, Fakes is unusable because we can't afford to bump the 100's of developers from VS Professional to VS Ultimate.

# October 19, 2012 11:31 PM

Stokes said:

When some one searches for his essential thing, so he/she needs to be available that in detail, so that thing

is maintained over here.

# February 17, 2013 3:55 AM

replicated said:

hey you should get social media plugin.  was searching for the 榣ike?button but couldn't locate it. replicated www.louisvuittonreplicated.com

# March 24, 2013 11:45 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: