【文件属性】:
文件名称:RhinoMoq.FromInstance:RhinoMocks和Moq的扩展-从接口实例创建模拟
文件大小:37KB
文件格式:ZIP
更新时间:2021-04-29 18:54:01
C#
RhinoMoq.FromInstance
和扩展-从接口实例创建模拟
它能做什么:
此扩展解决了从现有实例生成模拟的问题。 当您测试依赖于复杂对象Bar的类Foo且希望模拟Bar的某些成员而其余成员要针对原始成员执行时,这很方便。
换句话说,这使您不必初始化每个成员。
例子
给定接口和实现
public interface IFoo
{
string StringProp { get ; }
int IntProp { get ; }
}
public class Foo : IFoo
{
public string StringProp { get ; set ; }
public int IntProp { get ; set ; }
}
最小起订量:
var mock =
new Mock < IFoo>()
.
【文件预览】:
RhinoMoq.FromInstance-master
----.gitignore(3KB)
----RhinoMoq.FromInstance.sln(5KB)
----README.md(2KB)
----RhinoMoq.FromInstance()
--------DelegateWrapper.cs(2KB)
--------RhinoMoq.FromInstance.csproj(3KB)
--------Properties()
--------UnsupportedInstanceTypeException.cs(399B)
--------packages.config(145B)
--------FromInstanceMockingEngine.cs(5KB)
----RhinoMocks.FromInstance()
--------RhinoMocks.FromInstance.csproj(3KB)
--------FromInstanceExtension.cs(1KB)
--------Properties()
--------packages.config(134B)
----Moq.FromInstance.Tests()
--------Moq.FromInstance.Tests.csproj(6KB)
--------Properties()
--------Tests.cs(388B)
--------packages.config(745B)
--------app.config(498B)
--------MoqMockAbstraction.cs(799B)
----RhinoMoq.FromInstance.Tests()
--------Properties()
--------RhinoMoq.FromInstance.Tests.csproj(5KB)
--------TemplateExtensionTests()
--------packages.config(674B)
--------app.config(498B)
----LICENSE(1KB)
----Moq.FromInstance()
--------FromInstanceExtension.cs(1KB)
--------Properties()
--------Moq.FromInstance.csproj(3KB)
--------MoqFromInstanceMockingEngineTemplate.cs(3KB)
--------packages.config(135B)
----RhinoMocks.FromInstance.Tests()
--------Properties()
--------Tests.cs(416B)
--------RhinoMocks.FromInstance.Tests.csproj(6KB)
--------packages.config(744B)
--------app.config(498B)
--------RhinoMocksMockAbstraction.cs(824B)