|
From: <sm...@us...> - 2003-08-13 20:58:32
|
Update of /cvsroot/nmock/nmock/src/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv8466/src/NMock
Modified Files:
DynamicMock.cs
Log Message:
Pushed parameters into fields in ClassGenerator
Moved superclassIfTypeIsAnInterface into field
Removed RemotingClasssGenerator
Index: DynamicMock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/DynamicMock.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** DynamicMock.cs 8 Aug 2003 00:05:03 -0000 1.14
--- DynamicMock.cs 13 Aug 2003 20:44:12 -0000 1.15
***************
*** 10,23 ****
{
! private object obj;
private Type type;
private IList ignoredMethodNames;
public DynamicMock(Type type) : this(type, "Mock" + type.Name) {}
! public DynamicMock(Type type, string name) : base(name)
{
this.ignoredMethodNames = new ArrayList();
this.type = type;
}
--- 10,27 ----
{
! private object mockInstance;
private Type type;
private IList ignoredMethodNames;
+ private readonly Type superclassIfTypeIsInterface;
public DynamicMock(Type type) : this(type, "Mock" + type.Name) {}
! public DynamicMock(Type type, string name) : this (type, name, null) {}
!
! public DynamicMock(Type type, string name, Type superclassIfTypeIsInterface) : base(name)
{
this.ignoredMethodNames = new ArrayList();
this.type = type;
+ this.superclassIfTypeIsInterface = superclassIfTypeIsInterface;
}
***************
*** 26,34 ****
get
{
! if (obj == null)
{
! generate();
}
! return obj;
}
}
--- 30,38 ----
get
{
! if (mockInstance == null)
{
! mockInstance = CreateClassGenerator().Generate();
}
! return mockInstance;
}
}
***************
*** 42,54 ****
}
! private void generate()
! {
! ClassGenerator cg = createClassGenerator();
! obj = cg.Generate(type, this, ignoredMethodNames);
! }
!
! protected virtual ClassGenerator createClassGenerator()
{
! return new ClassGenerator();
}
--- 46,52 ----
}
! private ClassGenerator CreateClassGenerator()
{
! return new ClassGenerator(type, this, ignoredMethodNames, superclassIfTypeIsInterface);
}
|