c# - What is the difference between Microsoft Fakes Testing framework vs MS Unit Testing framework -
fakes testing framework available on premium , ultimate editions of viual studio. however, there other difference compared ms unit testing framework?
you use ms's unit testing framework write unit tests within visual studio. here's basic class use guideline:
using system; using microsoft.visualstudio.testtools.unittesting; namespace unittestproject1 { [testclass] public class unittest1 { [testmethod] public void testmethod1() { // arrange // act // assert } } }
if find unit tests have lot of dependencies use microsoft fakes isolate pieces of code need test. if using tdd , unit testing code relies on other code isn't complete yet can use fakes mock incomplete code well.
from isolating code under test microsoft fakes:
fakes come in 2 flavors:
a stub replaces class small substitute implements same interface. use stubs, have design application each component depends on interfaces, , not on other components. (by "component" mean class or group of classes designed , updated , typically contained in assembly.)
a shim modifies compiled code of application @ run time instead of making specified method call, runs shim code test provides. shims can used replace calls assemblies cannot modify, such .net assemblies.
you use microsoft fakes inside unit tests.
here's great resource microsoft fakes: http://vsartesttoolingguide.codeplex.com/releases/view/102290
Comments
Post a Comment