PSMock is a .NET mock framework capable of mocking all functions and properties.
资 源 简 介
PSMock
PSMock is yet another .NET mock framework, but capable of mocking all functions and properties in a class. I.e. it is not necessary to crate mocked objects based on interfaces or virtual functions.
The initial implementation is depending on the PostSharp framework to inject mock functionality into classes or function calls.
Sample
A sample on how a test function mocks an instance function:
```
using (Mock.Mocking)
{
// Verify that the unmocked Echo function returns the in-parameter as the result
EchoClass mocked = new EchoClass();
Assert.That(mocked.Echo("real"), Is.EqualTo("real"));
// Setup the mocked function to return "mock" regardless of the in-parameter
using (Mock.Setup)
{
Mock.Function(mocked.Echo(null))
.Return("mock");
}
// Verify that specified mocked return value is returned
Assert.That(mocked.Echo("real&quo
文 件 列 表
PSMock_0.5.0_src
Build.bat
Build.proj
License.txt
PSMock
PSMock.sln
PSMockTest
readme.txt
Samples
SamplesTest