远如上所述。 我不禁要问它如何区别。 它是微软公司的产品,与比较共同的框架类似,但新名称或稍有不同;似乎很难......。 e. 女士。
它的成熟程度如何? 生产读物? 其目的是要做更多的工作,而不是莫克。 (例如,禁试女士不仅仅是一个单位测试框架)。 这是否涵盖同样的平地。 难道情况更糟吗? 更好?
我想看一下它,但是,随着这些日子的这么多框架,我不禁要想有什么好处。
远如上所述。 我不禁要问它如何区别。 它是微软公司的产品,与比较共同的框架类似,但新名称或稍有不同;似乎很难......。 e. 女士。
它的成熟程度如何? 生产读物? 其目的是要做更多的工作,而不是莫克。 (例如,禁试女士不仅仅是一个单位测试框架)。 这是否涵盖同样的平地。 难道情况更糟吗? 更好?
我想看一下它,但是,随着这些日子的这么多框架,我不禁要想有什么好处。
Mocking frameworks and isolation frameworks are really two similar but different things. Mocking and stubbing frameworks typically are referenced libraries that allow you to create a stub implementation of an interface (to fake out behavior) or mocking (to verify that behavior was called). Isolation frameworks generally work at the CLR and allow you to instrument into just about any area of code (your own others) you want. Moles (which is part of Pex) is an isolation framework still in the research division of Microsoft (http://research.microsoft.com/en-us/projects/pex/). With Moles, you can pretty much isolate any section of your code (or any code in the CLR) and control how it behaves. For example with Moles, you could intercept the DateTime.Now() and return a set date and time to use for testing date-dependent calculation. It is also useful when you have a black-box third-party library that you cannot control.
The downside to Moles is that it is a little bit more complicated than using a mocking framework like Moq or RhinoMocks. This added functionality makes Moles learning curve a little steeper. Also, while you can stub an interface with Moles fairly easily and use it in a CI build, when you actually instrument into Moles you "mole" and generate a new assembly with the proper hooks into new .dll. On larger projects, this might increase the build-time slightly. Finally, I ve had some issues getting Moles to work in TFS build and test deployments (but that could just be me).
I wouldn t really make this an "either-or" situation. I would primarily use Moq for most of my needs and try to write my code to be testable using a conventional framework. If, however, you get stuck in a situation where you cannot easily isolate your code for various unit tests, I d use Moles for those situations.
Finally, go read Martin Fowler s article "Mocks Aren t Stubs" (http://martinfowler.com/articles/mocksArentStubs.html). In my opinion it is the best description of what you really want to try to do with mocking and stubbing.
As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....
I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...
I ve got some code which sets up a datacontext. Often enough, the datacontext should be set to some underlying data collection, such as an ObservableCollection - but occasionally I d like to set it ...
I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...
NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...