📄 dynamicmock.cs
字号:
using System;
namespace NUnit.Mocks
{
/// <summary>
/// Summary description for DynamicMock.
/// </summary>
public class DynamicMock : Mock
{
private Type type;
private object mockInstance;
public object MockInstance
{
get
{
if ( mockInstance == null )
{
MockInterfaceHandler handler = new MockInterfaceHandler( type, this );
mockInstance = handler.GetTransparentProxy();
}
return mockInstance;
}
}
#region Constructors
public DynamicMock( Type type ) : this( "Mock" + type.Name, type ) { }
public DynamicMock( string name, Type type ) : base( name )
{
// if ( !type.IsInterface )
// throw new VerifyException( "DynamicMock constructor requires an interface type" );
this.type = type;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -