|
From: <exo...@us...> - 2002-12-31 21:36:44
|
Update of /cvsroot/nmock/nmock/test/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv31302/test/NMock/Dynamic
Modified Files:
ClassGeneratorTest.cs
Log Message:
modified nant build file to build separate core and test assemblies
added new CollectingConstraint for post-test parameter validation
modified ClassGenerator to support overriding of internal and protected internal methods
fixed exception message in MockCall.checkArguments
Index: ClassGeneratorTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/Dynamic/ClassGeneratorTest.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ClassGeneratorTest.cs 12 Dec 2002 21:39:44 -0000 1.3
--- ClassGeneratorTest.cs 31 Dec 2002 21:36:40 -0000 1.4
***************
*** 29,49 ****
}
! public abstract class SolidThingy
{
public virtual string VirtualMethod() { return "xx"; }
- public override string ToString() { return "xx"; }
public abstract string AbstractMethod();
// cannot override
public static string StaticMethod() { return "xx"; }
public string NonVirtualMethod() { return "xx"; }
private string privateMethod() { return "xx"; }
- internal string internalMethod() { return "xx"; }
protected virtual string protectedMethod() { return "xx"; }
- protected internal virtual string protectedInternalMethod() { return "xx"; }
string defaultInternalMethod() { return "xx"; }
!
}
!
[TestFixture]
public class ClassGeneratorTest
--- 29,61 ----
}
! public interface ISolidThingy
! {
! string NonVirtualProperty { get; }
! }
!
! // internal and protected internal methods must be overridable!
! public abstract class SolidThingy : ISolidThingy
{
public virtual string VirtualMethod() { return "xx"; }
public abstract string AbstractMethod();
+ internal virtual string InternalMethod() { return "xx"; }
+ protected internal virtual string ProtectedInternalMethod() { return "xx"; }
// cannot override
public static string StaticMethod() { return "xx"; }
public string NonVirtualMethod() { return "xx"; }
+ internal string NonVirtualInternalMethod() { return "xx"; }
private string privateMethod() { return "xx"; }
protected virtual string protectedMethod() { return "xx"; }
string defaultInternalMethod() { return "xx"; }
! public override string ToString() { return "xx"; } // method is ignored
!
! // implemented interface members/methods are defined as final (ie. non-virtual)
! public string NonVirtualProperty
! {
! get { return "xx"; }
! }
}
!
[TestFixture]
public class ClassGeneratorTest
***************
*** 229,237 ****
--- 241,256 ----
mock.ExpectAndReturn("GetHashCode", 123);
mock.ExpectAndReturn("AbstractMethod", "fish");
+ mock.ExpectAndReturn("InternalMethod", "black");
+ mock.ExpectAndReturn("ProtectedInternalMethod", "white");
+
Assertion.AssertEquals("hello", s.VirtualMethod());
Assertion.AssertEquals(123, s.GetHashCode());
Assertion.AssertEquals("fish", s.AbstractMethod());
+ Assertion.AssertEquals("black", s.InternalMethod());
+ Assertion.AssertEquals("white", s.ProtectedInternalMethod());
Assertion.AssertEquals("xx", s.NonVirtualMethod());
+ Assertion.AssertEquals("xx", s.NonVirtualProperty);
+ Assertion.AssertEquals("xx", s.ToString());
mock.Verify();
}
|