You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(31) |
Dec
(26) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(8) |
Feb
(27) |
Mar
(15) |
Apr
|
May
(2) |
Jun
(13) |
Jul
(59) |
Aug
(48) |
Sep
(9) |
Oct
(4) |
Nov
(24) |
Dec
|
| 2004 |
Jan
(24) |
Feb
(2) |
Mar
(12) |
Apr
(9) |
May
(4) |
Jun
(26) |
Jul
(20) |
Aug
(23) |
Sep
(13) |
Oct
(31) |
Nov
(23) |
Dec
(11) |
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
(19) |
May
(64) |
Jun
(7) |
Jul
(20) |
Aug
(1) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2006 |
Jan
|
Feb
(69) |
Mar
(18) |
Apr
(1) |
May
(4) |
Jun
(3) |
Jul
(27) |
Aug
(19) |
Sep
(12) |
Oct
(3) |
Nov
(13) |
Dec
(6) |
| 2007 |
Jan
(20) |
Feb
(17) |
Mar
(1) |
Apr
(3) |
May
(4) |
Jun
(11) |
Jul
(10) |
Aug
(24) |
Sep
(19) |
Oct
(13) |
Nov
(8) |
Dec
(7) |
| 2008 |
Jan
(54) |
Feb
(24) |
Mar
(11) |
Apr
(35) |
May
(13) |
Jun
(10) |
Jul
(30) |
Aug
(18) |
Sep
(21) |
Oct
(18) |
Nov
(40) |
Dec
(76) |
| 2009 |
Jan
(64) |
Feb
(23) |
Mar
(15) |
Apr
(23) |
May
(46) |
Jun
(25) |
Jul
(31) |
Aug
(7) |
Sep
(7) |
Oct
(6) |
Nov
(15) |
Dec
(19) |
| 2010 |
Jan
(13) |
Feb
(8) |
Mar
(6) |
Apr
(4) |
May
(8) |
Jun
(7) |
Jul
(3) |
Aug
(9) |
Sep
(6) |
Oct
(15) |
Nov
(3) |
Dec
(5) |
| 2011 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(5) |
May
(2) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(2) |
Dec
(3) |
| 2012 |
Jan
(6) |
Feb
(2) |
Mar
(3) |
Apr
(3) |
May
(3) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
| 2013 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2015 |
Jan
|
Feb
(19) |
Mar
(115) |
Apr
(23) |
May
(41) |
Jun
(48) |
Jul
(59) |
Aug
(29) |
Sep
(40) |
Oct
(78) |
Nov
(58) |
Dec
(47) |
| 2016 |
Jan
(25) |
Feb
(30) |
Mar
(29) |
Apr
(10) |
May
(17) |
Jun
(1) |
Jul
(1) |
Aug
(6) |
Sep
(2) |
Oct
(1) |
Nov
(3) |
Dec
(2) |
| 2017 |
Jan
(5) |
Feb
(2) |
Mar
(7) |
Apr
(1) |
May
(7) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
(1) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
(29) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(5) |
Dec
(3) |
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(7) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
(1) |
Dec
(4) |
| 2024 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(8) |
Jun
(159) |
Jul
(90) |
Aug
(22) |
Sep
|
Oct
(6) |
Nov
(8) |
Dec
(1) |
| 2025 |
Jan
(20) |
Feb
(6) |
Mar
(2) |
Apr
(4) |
May
(29) |
Jun
(63) |
Jul
(62) |
Aug
(70) |
Sep
(120) |
Oct
(46) |
Nov
(33) |
Dec
(25) |
| 2026 |
Jan
(37) |
Feb
(56) |
Mar
(62) |
Apr
(20) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <exo...@us...> - 2002-12-31 21:36:44
|
Update of /cvsroot/nmock/nmock/test
In directory sc8-pr-cvs1:/tmp/cvs-serv31302/test
Modified Files:
test.csproj.user
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: test.csproj.user
===================================================================
RCS file: /cvsroot/nmock/nmock/test/test.csproj.user,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test.csproj.user 16 Dec 2002 14:52:41 -0000 1.1
--- test.csproj.user 31 Dec 2002 21:36:40 -0000 1.2
***************
*** 2,6 ****
<CSHARP>
<Build>
! <Settings ReferencePath = "D:\Projects\nmock\lib\" >
<Config
Name = "Debug"
--- 2,6 ----
<CSHARP>
<Build>
! <Settings ReferencePath = "D:\Projects\nmock\lib\;C:\dev\nmock\lib\" >
<Config
Name = "Debug"
|
|
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();
}
|
|
From: <exo...@us...> - 2002-12-31 21:36:43
|
Update of /cvsroot/nmock/nmock/test/NMock/Constraints
In directory sc8-pr-cvs1:/tmp/cvs-serv31302/test/NMock/Constraints
Modified Files:
ConstraintsTest.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: ConstraintsTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/Constraints/ConstraintsTest.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConstraintsTest.cs 15 Nov 2002 22:48:20 -0000 1.1
--- ConstraintsTest.cs 31 Dec 2002 21:36:40 -0000 1.2
***************
*** 235,238 ****
--- 235,250 ----
[Test]
+ public void CollectingConstraint()
+ {
+ CollectingConstraint c = new CollectingConstraint();
+ Assertion.Assert(c.Eval("test"));
+ Assertion.AssertEquals("test", c.Parameter);
+
+ Assertion.Assert("eval should always be true", c.Eval(null));
+ Assertion.AssertNull(c.Parameter);
+
+ }
+
+ [Test]
public void Delegate()
{
|
|
From: <exo...@us...> - 2002-12-31 21:36:43
|
Update of /cvsroot/nmock/nmock/src/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv31302/src/NMock
Modified Files:
MockCall.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: MockCall.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/MockCall.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MockCall.cs 16 Dec 2002 14:49:51 -0000 1.1
--- MockCall.cs 31 Dec 2002 21:36:39 -0000 1.2
***************
*** 63,67 ****
if ( HasExpectations )
{
! Mock.Assertion.AssertEquals("x() called with incorrect number of parameters",
expectedArgs.Length, actualArgs.Length);
--- 63,67 ----
if ( HasExpectations )
{
! Mock.Assertion.AssertEquals(methodName + "() called with incorrect number of parameters",
expectedArgs.Length, actualArgs.Length);
|
|
From: <exo...@us...> - 2002-12-31 21:36:42
|
Update of /cvsroot/nmock/nmock/src/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv31302/src/NMock/Dynamic
Modified Files:
ClassGenerator.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: ClassGenerator.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Dynamic/ClassGenerator.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ClassGenerator.cs 16 Dec 2002 14:48:49 -0000 1.4
--- ClassGenerator.cs 31 Dec 2002 21:36:38 -0000 1.5
***************
*** 25,29 ****
foreach ( MethodInfo m in methods )
{
! if(!methodsToIgnore.Contains(m.Name))
{
implementMethod(type, typeBuilder, m, mockFieldBuilder);
--- 25,29 ----
foreach ( MethodInfo m in methods )
{
! if (IsOverridable(m) && !methodsToIgnore.Contains(m.Name))
{
implementMethod(type, typeBuilder, m, mockFieldBuilder);
***************
*** 37,40 ****
--- 37,45 ----
}
+ private bool IsOverridable(MethodInfo m)
+ {
+ return (m.IsVirtual && ! m.IsFinal);
+ }
+
private TypeBuilder getTypeBuilder(string name, Type originalType)
{
|
|
From: Joe W. <jo...@tr...> - 2002-12-16 17:57:39
|
Steve: >>> Why not? It seems a bit odd to write another >>> assertion class Joe: >>Two reasons: >> >> 1) I haven't quite figured out how assembly linking works in .NET yet. >> If NMock is compiled for version x of NUnit and then the user attempts >> to use it with version y, it fails miserably. I'm sure there's a nice >> solution though... >> >> 2) There are lots of other unit-testing frameworks for .NET (NUnit 1, >> NUnit 2 which is totally different, X-Unity, #Unit, blah blah). Didn't >> want to tie the user into a particular tool. Steve: > Interesting, the monolithic MS world is far more splintered than for > other languages. Unfortunately NUnit 1.0 was a bit of a balls up (it was a direct port line for line of JUnit which didn't make the most of .NET). So lots of other people started writing alternatives that were better. Then NUnit 2.0 came out (recently) which kind of won, but there are still lots of people use other tools. > I think it may be worth thinking this one through a bit, because it > just feels wrong to start yet another assertion library. Agree. Any ideas? I was thinking about making an abstraction over the other apis, but compared with writing a very simple class it just didnt make sense. > Also, > - I'm not sure that the default behaviour for a null argument should be to match > anything. That makes it a right pain to test for equality with nulls. We can > have another marker for ignore all arguments. Well, there is the IsNull contstraint. I found I used IsAnything alot more than IsNull so I made it a default. However it's obviously confusing. Would like to get more people's opinions on this... > - we might want to add a return value on the mock call. I think we did this > in the Java version with a default value to fall back to. Yup. It's on the todo list: http://jira.truemesh.com/secure/ViewIssue.jspa?key=NMO-2 >I'll see if I can get checkin the new stuff. Too late!!! :) -Joe PS. See the roadmap: http://jira.truemesh.com/secure/BrowseProject.jspa?id=10001&report=roadmap |
|
From: <sm...@us...> - 2002-12-16 15:05:03
|
Update of /cvsroot/nmock/nmock/test
In directory sc8-pr-cvs1:/tmp/cvs-serv20035/test
Modified Files:
AssemblyInfo.cs
Log Message:
Turned off most of the AssemblyInfo to get through the build.
Index: AssemblyInfo.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/AssemblyInfo.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AssemblyInfo.cs 16 Dec 2002 14:52:31 -0000 1.1
--- AssemblyInfo.cs 16 Dec 2002 15:04:48 -0000 1.2
***************
*** 7,18 ****
// associated with an assembly.
//
! [assembly: AssemblyTitle("")]
! [assembly: AssemblyDescription("")]
! [assembly: AssemblyConfiguration("")]
! [assembly: AssemblyCompany("")]
! [assembly: AssemblyProduct("")]
! [assembly: AssemblyCopyright("")]
! [assembly: AssemblyTrademark("")]
! [assembly: AssemblyCulture("")]
//
--- 7,18 ----
// associated with an assembly.
//
! // [assembly: AssemblyTitle("NMock tests")]
! // [assembly: AssemblyDescription("")]
! // [assembly: AssemblyConfiguration("")]
! // [assembly: AssemblyCompany("truemesh.com")]
! // [assembly: AssemblyProduct("")]
! // [assembly: AssemblyCopyright("")]
! // [assembly: AssemblyTrademark("")]
! // [assembly: AssemblyCulture("")]
//
***************
*** 27,31 ****
// by using the '*' as shown below:
! [assembly: AssemblyVersion("1.0.*")]
//
--- 27,31 ----
// by using the '*' as shown below:
! // [assembly: AssemblyVersion("1.0.*")]
//
***************
*** 54,58 ****
// documentation for more information on this.
//
! [assembly: AssemblyDelaySign(false)]
! [assembly: AssemblyKeyFile("")]
! [assembly: AssemblyKeyName("")]
--- 54,58 ----
// documentation for more information on this.
//
! // [assembly: AssemblyDelaySign(false)]
! // [assembly: AssemblyKeyFile("")]
! // [assembly: AssemblyKeyName("")]
|
|
From: <sm...@us...> - 2002-12-16 14:53:41
|
Update of /cvsroot/nmock/nmock
In directory sc8-pr-cvs1:/tmp/cvs-serv16131
Added Files:
nmock.suo nmock.sln
Log Message:
Added VisualStudio noise
--- NEW FILE: nmock.suo ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: nmock.sln ---
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "src", "src\src.csproj", "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{2735C01B-475D-4B75-AF30-C00D9A977E58}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{4859B9E5-3F65-4517-878C-AFC58B9D0035}.Debug.ActiveCfg = Debug|.NET
{4859B9E5-3F65-4517-878C-AFC58B9D0035}.Debug.Build.0 = Debug|.NET
{4859B9E5-3F65-4517-878C-AFC58B9D0035}.Release.ActiveCfg = Release|.NET
{4859B9E5-3F65-4517-878C-AFC58B9D0035}.Release.Build.0 = Release|.NET
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Debug.ActiveCfg = Debug|.NET
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Debug.Build.0 = Debug|.NET
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Release.ActiveCfg = Release|.NET
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
|
|
From: <sm...@us...> - 2002-12-16 14:52:45
|
Update of /cvsroot/nmock/nmock/test
In directory sc8-pr-cvs1:/tmp/cvs-serv15699/test
Added Files:
test.csproj AssemblyInfo.cs test.csproj.user
Log Message:
Added VisualStudio noise
--- NEW FILE: test.csproj ---
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{2735C01B-475D-4B75-AF30-C00D9A977E58}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "test"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
RootNamespace = "NMock"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.XML"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
/>
<Reference
Name = "src"
Project = "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "nunit.util"
AssemblyName = "nunit.util"
HintPath = "..\lib\nunit.util.dll"
/>
<Reference
Name = "nunit.framework"
AssemblyName = "nunit.framework"
HintPath = "..\lib\nunit.framework.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\DynamicMockTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\MockTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\VerifyExceptionTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\Constraints\ConstraintsTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\Dynamic\ClassGeneratorTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
--- NEW FILE: AssemblyInfo.cs ---
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
--- NEW FILE: test.csproj.user ---
<VisualStudioProject>
<CSHARP>
<Build>
<Settings ReferencePath = "D:\Projects\nmock\lib\" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "false"
/>
<Config
Name = "Release"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "false"
/>
</Settings>
</Build>
<OtherProjectSettings
CopyProjectDestinationFolder = ""
CopyProjectUncPath = ""
CopyProjectOption = "0"
ProjectView = "ProjectFiles"
ProjectTrust = "0"
/>
</CSHARP>
</VisualStudioProject>
|
|
From: <sm...@us...> - 2002-12-16 14:51:34
|
Update of /cvsroot/nmock/nmock/src
In directory sc8-pr-cvs1:/tmp/cvs-serv15228/src
Added Files:
src.csproj.user src.csproj AssemblyInfo.cs
Log Message:
Added VisualStudio noise
--- NEW FILE: src.csproj.user ---
<VisualStudioProject>
<CSHARP>
<Build>
<Settings ReferencePath = "" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "false"
/>
<Config
Name = "Release"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "false"
/>
</Settings>
</Build>
<OtherProjectSettings
CopyProjectDestinationFolder = ""
CopyProjectUncPath = ""
CopyProjectOption = "0"
ProjectView = "ProjectFiles"
ProjectTrust = "0"
/>
</CSHARP>
</VisualStudioProject>
--- NEW FILE: src.csproj ---
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "NMock"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
RootNamespace = "NMock"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.XML"
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\DynamicMock.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\IMock.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\IVerifiable.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\Method.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\Mock.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\MockCall.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\VerifyException.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\Constraints\Constraints.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\Constraints\IConstraint.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\Dynamic\ClassGenerator.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
--- NEW FILE: AssemblyInfo.cs ---
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
|
|
From: <sm...@us...> - 2002-12-16 14:50:17
|
Update of /cvsroot/nmock/nmock/src/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv14529/src/NMock
Modified Files:
Mock.cs
Added Files:
MockCall.cs Method.cs
Log Message:
Refactoring.
Pulled out Method object
--- NEW FILE: MockCall.cs ---
using System;
using NMock.Constraints;
namespace NMock
{
public class MockCall
{
private IConstraint[] expectedArgs;
private object returnValue;
private Exception e;
public MockCall(object returnValue, Exception e, object[] expectedArgs)
{
this.expectedArgs = argsAsConstraints(expectedArgs);
this.returnValue = returnValue;
this.e = e;
}
public virtual bool HasExpectations
{
get { return expectedArgs.Length > 0; }
}
private IConstraint[] argsAsConstraints(object[] args)
{
if (null == args)
{
return new IConstraint[0];
}
IConstraint[] result = new IConstraint[args.Length];
for (int i = 0; i < result.Length; ++i)
{
result[i] = argAsConstraint(args[i]);
}
return result;
}
private IConstraint argAsConstraint(object arg)
{
IConstraint constraint = arg as IConstraint;
if (constraint != null)
{
return constraint;
}
return arg == null ? (IConstraint)new IsAnything() : (IConstraint)new IsEqual(arg);
}
public virtual object Call(string methodName, object[] actualArgs)
{
checkArguments(methodName, actualArgs);
if (e != null)
{
throw e;
}
return returnValue;
}
private void checkArguments(string methodName, object[] actualArgs)
{
if ( HasExpectations )
{
Mock.Assertion.AssertEquals("x() called with incorrect number of parameters",
expectedArgs.Length, actualArgs.Length);
for (int i = 0; i < expectedArgs.Length; i++)
{
checkConstraint(methodName, expectedArgs[i], actualArgs[i], i);
}
}
}
private void checkConstraint(string methodName, IConstraint expected, object actual, int index)
{
if (!expected.Eval(actual))
{
String messageFormat = "{0}() called with incorrect parameter ({1})";
String message = String.Format(messageFormat, methodName, index + 1);
throw new VerifyException(message, expected.Message, actual);
}
}
}
public class MockNoCall : MockCall
{
public MockNoCall() : base(null, null, null)
{
}
public override object Call(string methodName, object[] actualArgs)
{
throw new VerifyException(methodName + "() called", 0, 1);
}
}
}
--- NEW FILE: Method.cs ---
using System;
using System.Collections;
namespace NMock
{
/// <summary>
/// nb. Shouldn't return value belong to the Call?
/// </summary>
public class Method : IVerifiable
{
private static object NO_RETURN_VALUE = new object();
private string name;
private object returnValue = NO_RETURN_VALUE;
private int timesCalled = 0;
private CallSequence expectations;
public Method(string aName)
{
name = aName;
expectations = new CallSequence(aName);
}
public virtual object ReturnValue
{
set { returnValue = value; }
get { return returnValue; }
}
public virtual bool HasReturnValue
{
get { return ! Object.ReferenceEquals(NO_RETURN_VALUE, returnValue); }
}
public virtual bool HasNoExpectations
{
get { return expectations.Count == 0; }
}
public virtual string Name
{
get { return name; }
}
public virtual void AddExpected(MockCall aCall)
{
expectations.Add(aCall);
}
public virtual object Call(params object[] parameters)
{
MockCall mockCall = expectations[timesCalled];
timesCalled++;
return mockCall.Call(name, parameters);
}
public virtual void Verify()
{
Mock.Assertion.AssertEquals(name + "() " + CallCountErrorMessage(),
expectations.Count, timesCalled);
}
private string CallCountErrorMessage()
{
return (timesCalled == 0 ? "never called" : "not called enough times");
}
/// <summary>
/// Specialised collection class for Method Calls
/// </summary>
public class CallSequence
{
private string name;
private ArrayList sequence = new ArrayList();
public CallSequence(string aName)
{
name = aName;
}
public MockCall this[int timesCalled]
{
get
{
if (sequence.Count == timesCalled)
{
throw new VerifyException(name + "() called too many times", sequence.Count, timesCalled + 1);
}
return (MockCall)sequence[timesCalled];
}
}
public int Count
{
get { return sequence.Count; }
}
public void Add(MockCall aCall)
{
sequence.Add(aCall);
}
}
}
}
Index: Mock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Mock.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Mock.cs 12 Dec 2002 21:39:43 -0000 1.5
--- Mock.cs 16 Dec 2002 14:49:46 -0000 1.6
***************
*** 5,25 ****
namespace NMock
{
-
public class Mock : IMock
{
-
private string name;
! private object obj;
private bool strict;
! private IDictionary expectations;
! private IDictionary values;
! private IDictionary counters;
public Mock(string name)
{
this.name = name;
! expectations = new Hashtable();
! values = new Hashtable();
! counters = new Hashtable();
}
--- 5,19 ----
namespace NMock
{
public class Mock : IMock
{
private string name;
! private object instance;
private bool strict;
! private IDictionary methods;
public Mock(string name)
{
this.name = name;
! methods = new Hashtable();
}
***************
*** 32,37 ****
public virtual object MockInstance
{
! get { return obj; }
! set { obj = value; }
}
--- 26,31 ----
public virtual object MockInstance
{
! get { return instance; }
! set { instance = value; }
}
***************
*** 42,56 ****
}
- public virtual void Verify()
- {
- foreach (String methodName in expectations.Keys)
- {
- IList list = (IList) expectations[methodName];
- int count = counter(methodName);
- string msg = count == 0 ? "never called" : "not called enough times";
- Assertion.AssertEquals(methodName + "() " + msg, list.Count, count);
- }
- }
-
public virtual void Expect(string methodName, params object[] args)
{
--- 36,39 ----
***************
*** 60,210 ****
public virtual void ExpectNoCall(string methodName)
{
! addExpectation(new MockNoCall(methodName));
}
public virtual void ExpectAndReturn(string methodName, object result, params object[] args)
{
! addExpectation(new MockCall(methodName, result, null, args));
}
public virtual void ExpectAndThrow(string methodName, Exception e, params object[] args)
{
! addExpectation(new MockCall(methodName, null, e, args));
}
public virtual void SetupResult(string methodName, object returnVal)
{
! values[methodName] = returnVal;
}
public virtual object Call(string methodName, params object[] args)
{
! if (values.Contains(methodName))
{
! return values[methodName];
}
! IList methodExpectations = (IList) expectations[methodName];
! if (methodExpectations == null)
! {
if ( strict )
{
! throw new VerifyException(methodName + "() called too many times", 0, counter(methodName) + 1);
}
return null;
}
! if (methodExpectations.Count == counter(methodName))
! {
! throw new VerifyException(methodName + "() called too many times", methodExpectations.Count, counter(methodName) + 1);
! }
! MockCall mockCall = (MockCall)methodExpectations[counter(methodName)];
! if (mockCall is MockNoCall)
! {
! throw new VerifyException(methodName + "() called", 0, 1);
! }
! increment(methodName);
! return mockCall.Call(methodName, args);
}
! private void increment(string methodName)
! {
! counters[methodName] = counter(methodName) + 1;
! }
!
! private int counter(string methodName)
! {
! return counters.Contains(methodName) ? (int)counters[methodName] : 0;
! }
!
! private void addExpectation(MockCall call)
{
! IList list = (IList) expectations[call.MethodName];
! if (list == null)
{
! list = new ArrayList();
! expectations[call.MethodName] = list;
}
- list.Add(call);
}
! private class MockCall
{
! public string MethodName;
! private IConstraint[] expectedArgs;
! private object returnValue;
! private Exception e;
!
! public MockCall(string methodName, object returnValue, Exception e, object[] expectedArgs)
! {
! this.MethodName = methodName;
! this.returnValue = returnValue;
! this.e = e;
! this.expectedArgs = argsAsConstraints(expectedArgs);
! }
!
! private IConstraint[] argsAsConstraints(object[] args)
! {
! if (args == null)
! {
! return new IConstraint[0];
! }
! IConstraint[] result = new IConstraint[args.Length];
! for (int i = 0; i < args.Length; ++i)
! {
! result[i] = argAsConstraint(args[i]);
! }
! return result;
! }
!
! private IConstraint argAsConstraint(object arg)
! {
! IConstraint constraint = arg as IConstraint;
! if (constraint != null)
! {
! return constraint;
! }
! return arg == null ? (IConstraint)new IsAnything() : (IConstraint)new IsEqual(arg);
! }
!
! public virtual object Call(string methodName, object[] actualArgs)
! {
! if ( this.expectedArgs.Length > 0 )
! {
! // assert that the correct number of arguments were passed
! Assertion.AssertEquals("x() called with incorrect number of parameters", this.expectedArgs.Length, actualArgs.Length);
!
! // assert that each passed in arg is validated by the appropriate predicate.
! for (int i = 0; i < this.expectedArgs.Length; i++)
! {
! IConstraint expectedArg = expectedArgs[i];
! object actualArg = actualArgs[i];
!
! if (!expectedArg.Eval(actualArg))
! {
! String messageFormat = "{0}() called with incorrect parameter ({1})";
! String message = String.Format(messageFormat, methodName, i + 1);
! throw new VerifyException(message, expectedArg.Message, actualArg);
! }
! }
! }
!
! // if exception setup to be thrown, throw it
! if (e != null)
! {
! throw e;
! }
! // otherwise return desired value
! return returnValue;
! }
}
!
! private class MockNoCall : MockCall
{
! public MockNoCall(string methodName) : base(methodName, null, null, null)
! {
}
}
! private class Assertion
{
public static void Assert(string message, bool expression)
--- 43,108 ----
public virtual void ExpectNoCall(string methodName)
{
! addExpectation(methodName, new MockNoCall());
}
public virtual void ExpectAndReturn(string methodName, object result, params object[] args)
{
! addExpectation(methodName, new MockCall(result, null, args));
}
public virtual void ExpectAndThrow(string methodName, Exception e, params object[] args)
{
! addExpectation(methodName, new MockCall(null, e, args));
}
public virtual void SetupResult(string methodName, object returnVal)
{
! getMethod(methodName).ReturnValue = returnVal;
}
public virtual object Call(string methodName, params object[] args)
{
! Method method = getMethod(methodName);
! if (method.HasReturnValue)
{
! return method.ReturnValue;
}
! if (method.HasNoExpectations) {
if ( strict )
{
! throw new VerifyException(method.Name + "() called too many times", 0, 1);
}
return null;
}
! return method.Call(args);
}
! public virtual void Verify()
{
! foreach (Method method in methods.Values)
{
! method.Verify();
}
}
! private void addExpectation(string methodName, MockCall call)
{
! getMethod(methodName).AddExpected(call);
}
!
! private Method getMethod(string methodName)
{
! Method found = (Method)methods[methodName];
! if (found == null)
! {
! found = new Method(methodName);
! methods[methodName] = found;
}
+ return found;
}
!
! public class Assertion
{
public static void Assert(string message, bool expression)
***************
*** 223,232 ****
}
}
-
}
-
-
-
}
-
}
--- 121,125 ----
|
|
From: <sm...@us...> - 2002-12-16 14:49:01
|
Update of /cvsroot/nmock/nmock/src/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv14056/src/NMock/Dynamic
Modified Files:
ClassGenerator.cs
Log Message:
Made getBoxingOpCode public to allow tests access.
This is probably the wrong solution.
Index: ClassGenerator.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Dynamic/ClassGenerator.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ClassGenerator.cs 12 Dec 2002 21:39:43 -0000 1.3
--- ClassGenerator.cs 16 Dec 2002 14:48:49 -0000 1.4
***************
*** 132,136 ****
}
! internal OpCode getBoxingOpCode( Type aType )
{
if (boxingOpCodes == null)
--- 132,136 ----
}
! public OpCode getBoxingOpCode( Type aType )
{
if (boxingOpCodes == null)
|
|
From: <exo...@us...> - 2002-12-14 21:34:03
|
Update of /cvsroot/nmock/nmock/tools In directory sc8-pr-cvs1:/tmp/cvs-serv16177/tools Added Files: nant.exe Log Message: tortise skipped this for some reason --- NEW FILE: nant.exe --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/nmock/nmock/tools In directory sc8-pr-cvs1:/tmp/cvs-serv14230/tools Added Files: NAnt.Core.dll NAnt.DotNetTasks.dll NAnt.NUnit1Tasks.dll NAnt.NUnitTasks.dll NDoc.Core.dll NUnitCore.dll nunit.framework.dll Log Message: set everything up to make nmock run under ccnet. included distribution of NAnt used by ccnet in tools folder. developers should run build.bat to perform the NAnt build. test target now uses nunit2 target. --- NEW FILE: NAnt.Core.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NAnt.DotNetTasks.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NAnt.NUnit1Tasks.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NAnt.NUnitTasks.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NDoc.Core.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NUnitCore.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: nunit.framework.dll --- (This appears to be a binary file; contents omitted.) |
|
From: <exo...@us...> - 2002-12-14 21:28:12
|
Update of /cvsroot/nmock/nmock/ccnet In directory sc8-pr-cvs1:/tmp/cvs-serv14230/ccnet Added Files: ccnet-nmock.bat ccnet.config Log Message: set everything up to make nmock run under ccnet. included distribution of NAnt used by ccnet in tools folder. developers should run build.bat to perform the NAnt build. test target now uses nunit2 target. --- NEW FILE: ccnet-nmock.bat --- title CCNET "C:\Program Files\CruiseControl.NET\bin\ccnet.exe" --- NEW FILE: ccnet.config --- <cruisecontrol> <project name="nmock"> <projectUrl>http://teetor/nmock</projectUrl> <sourceControl name="cvs"> <executable>cvs.exe</executable> <workingDirectory>..</workingDirectory> </sourceControl> <build> <executable>C:\Program Files\CruiseControl.NET\tools\nant\NAnt.exe</executable> <baseDirectory>..</baseDirectory> <buildFile>nmock.build</buildFile> <targetList> <target>cruise</target> </targetList> <buildTimeout>30000</buildTimeout> </build> <publishers> <email from="cc...@th..." mailhost="mother.thoughtworks.com"> <users> <user name="buildmaster" group="buildmaster" address="jo...@tr..."/> <user name="joewalnes" group="developers" address="jo...@tr..."/> <user name="exortech" group="developers" address="nm...@ex..."/> </users> <groups> <group name="developers" notification="change"/> <group name="buildmaster" notification="always"/> </groups> </email> <xmllogger> <logDir>log</logDir> </xmllogger> </publishers> <logDir>log</logDir> <sleep>60000</sleep> </project> </cruisecontrol> |
|
From: <exo...@us...> - 2002-12-14 21:28:12
|
Update of /cvsroot/nmock/nmock
In directory sc8-pr-cvs1:/tmp/cvs-serv14230
Modified Files:
nmock.build
Added Files:
build.bat
Log Message:
set everything up to make nmock run under ccnet.
included distribution of NAnt used by ccnet in tools folder. developers should run build.bat to perform the NAnt build.
test target now uses nunit2 target.
--- NEW FILE: build.bat ---
@echo off
tools\NAnt.exe %*
Index: nmock.build
===================================================================
RCS file: /cvsroot/nmock/nmock/nmock.build,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** nmock.build 10 Nov 2002 17:36:05 -0000 1.1
--- nmock.build 14 Dec 2002 21:28:09 -0000 1.2
***************
*** 1,3 ****
--- 1,5 ----
<project name="NMock" default="release">
+
+ <property name="nunit.output" value="Plain"/>
<target name="compile" description="Compile core library">
***************
*** 13,20 ****
</references>
</csc>
</target>
<target name="test" depends="compile" description="Run unit tests">
! <exec program="lib\nunit-console.exe" commandline="/assembly:build\nmock.dll"/>
</target>
--- 15,25 ----
</references>
</csc>
+ <copy file="lib\nunit.framework.dll" todir="build" />
</target>
<target name="test" depends="compile" description="Run unit tests">
! <nunit2>
! <test assemblyname="build\nmock.dll" fork="true" type="${nunit.output}"/>
! </nunit2>
</target>
***************
*** 40,42 ****
--- 45,52 ----
</target>
+ <target name="cruise">
+ <property name="nunit.output" value="Xml"/>
+ <exec program="cvs.exe" commandline="-q update -P -d" />
+ <call target="release"/>
+ </target>
</project>
|
|
From: <exo...@us...> - 2002-12-14 21:26:00
|
Update of /cvsroot/nmock/nmock/tools In directory sc8-pr-cvs1:/tmp/cvs-serv13636/tools Log Message: Directory /cvsroot/nmock/nmock/tools added to the repository |
|
From: <exo...@us...> - 2002-12-14 21:24:13
|
Update of /cvsroot/nmock/nmock/ccnet In directory sc8-pr-cvs1:/tmp/cvs-serv13086/ccnet Log Message: Directory /cvsroot/nmock/nmock/ccnet added to the repository |
|
From: <joe...@us...> - 2002-12-12 21:42:44
|
Update of /cvsroot/nmock/nmock/src/NMock/Constraints
In directory sc8-pr-cvs1:/tmp/cvs-serv19262/src/NMock/Constraints
Modified Files:
Constraints.cs
Log Message:
*** keyword substitution change ***
Index: Constraints.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Constraints/Constraints.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Constraints.cs 15 Nov 2002 22:48:20 -0000 1.1
--- Constraints.cs 12 Dec 2002 21:42:35 -0000 1.2
***************
*** 1,383 ****
! using System;
! using System.Text;
! using System.Text.RegularExpressions;
!
! namespace NMock.Constraints
! {
!
! public class IsNull : IConstraint
! {
! public bool Eval(object val)
! {
! return val == null;
! }
!
! public string Message
! {
! get { return "null"; }
! }
! }
!
! public class IsAnything : IConstraint
! {
! public bool Eval(object val)
! {
! return true;
! }
!
! public string Message
! {
! get { return ""; }
! }
! }
!
! public class IsIn : IConstraint
! {
! private object[] inList;
!
! public IsIn(params object[] inList)
! {
! if (inList.Length == 1 && inList[0].GetType().IsArray)
! {
! Array arr = (Array)inList[0];
! this.inList = new object[arr.Length];
! arr.CopyTo(this.inList, 0);
! }
! else
! {
! this.inList = inList;
! }
! }
!
! public bool Eval(object val)
! {
! foreach (object o in inList)
! {
! if (o.Equals(val))
! {
! return true;
! }
! }
! return false;
! }
!
! public string Message
! {
! get
! {
! StringBuilder builder = new StringBuilder("IN ");
! foreach (object o in inList)
! {
! builder.Append('<');
! builder.Append(o);
! builder.Append(">, ");
! }
! string result = builder.ToString();
! if (result.EndsWith(", "))
! {
! result = result.Substring(0, result.Length - 2);
! }
! return result;
! }
! }
! }
!
! public class IsEqual : IConstraint {
! private object compare;
!
! public IsEqual(object compare)
! {
! this.compare = compare;
! }
!
! public bool Eval(object val)
! {
! return compare.Equals(val);
! }
!
! public string Message
! {
! get { return "<" + compare + ">"; }
! }
! }
!
! public class IsTypeOf : IConstraint
! {
! private Type type;
!
! public IsTypeOf(Type type)
! {
! this.type = type;
! }
!
! public bool Eval(object val)
! {
! return val == null ? false : type.IsAssignableFrom(val.GetType());
! }
!
! public string Message
! {
! get { return "typeof <" + type.FullName + ">"; }
! }
! }
!
! public class Not : IConstraint
! {
! private IConstraint p;
!
! public Not(IConstraint p)
! {
! this.p = p;
! }
!
! public bool Eval(object val)
! {
! return !p.Eval(val);
! }
!
! public string Message
! {
! get { return "NOT " + p.Message; }
! }
! }
!
! public class And : IConstraint
! {
! private IConstraint p1, p2;
!
! public And(IConstraint p1, IConstraint p2)
! {
! this.p1 = p1;
! this.p2 = p2;
! }
!
! public bool Eval(object val)
! {
! return p1.Eval(val) && p2.Eval(val);
! }
!
! public string Message
! {
! get { return p1.Message + " AND " + p2.Message; }
! }
! }
!
! public class Or : IConstraint
! {
! private IConstraint p1, p2;
!
! public Or(IConstraint p1, IConstraint p2)
! {
! this.p1 = p1;
! this.p2 = p2;
! }
!
! public bool Eval(object val)
! {
! return p1.Eval(val) || p2.Eval(val);
! }
!
! public string Message
! {
! get { return p1.Message + " OR " + p2.Message; }
! }
! }
!
! public class NotNull : IConstraint
! {
! public bool Eval(object val)
! {
! return val != null;
! }
!
! public string Message
! {
! get { return "NOT null"; }
! }
! }
!
! public class NotEqual : IConstraint
! {
! private IConstraint p;
!
! public NotEqual(object compare)
! {
! p = new Not(new IsEqual(compare));
! }
!
! public bool Eval(object val)
! {
! return p.Eval(val);
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class NotIn : IConstraint
! {
! private IConstraint p;
!
! public NotIn(params object[] inList)
! {
! p = new Not(new IsIn(inList));
! }
!
! public bool Eval(object val)
! {
! return p.Eval(val);
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class IsEqualIgnoreCase : IConstraint
! {
! private IConstraint p;
!
! public IsEqualIgnoreCase(object compare)
! {
! p = new IsEqual(compare.ToString().ToLower());
! }
!
! public bool Eval(object val)
! {
! return p.Eval(val.ToString().ToLower());
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class IsEqualIgnoreWhiteSpace : IConstraint
! {
! private IConstraint p;
!
! public IsEqualIgnoreWhiteSpace(object compare)
! {
! p = new IsEqual(StripSpace(compare.ToString()));
! }
!
! public bool Eval(object val)
! {
! return p.Eval(StripSpace(val.ToString()));
! }
!
! public static string StripSpace(string s)
! {
! StringBuilder result = new StringBuilder();
! bool lastWasSpace = true;
! foreach(char c in s)
! {
! if (Char.IsWhiteSpace(c))
! {
! if (!lastWasSpace)
! {
! result.Append(' ');
! }
! lastWasSpace = true;
! }
! else
! {
! result.Append(c);
! lastWasSpace = false;
! }
! }
! return result.ToString().Trim();
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class IsMatch : IConstraint
! {
! private Regex regex;
!
! public IsMatch(Regex regex)
! {
! this.regex = regex;
! }
!
! public IsMatch(String regex) : this(new Regex(regex))
! {
! }
!
! public IsMatch(String regex, bool ignoreCase) :
! this(new Regex(regex, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None))
! {
! }
!
! public bool Eval(object val)
! {
! return val == null ? false : regex.IsMatch(val.ToString());
! }
!
! public string Message
! {
! get { return "<" + regex.ToString() + ">"; }
! }
! }
!
! public class IsCloseTo : IConstraint
! {
!
! private double expected;
! private double error;
!
! public IsCloseTo(double expected, double error)
! {
! this.expected = expected;
! this.error = error;
! }
!
! public bool Eval(object val)
! {
! try
! {
! double actual = Convert.ToDouble(val);
! return Math.Abs(actual - expected) <= error;
! }
! catch (FormatException)
! {
! return false;
! }
! }
!
! public string Message
! {
! get { return "<" + expected + ">"; }
! }
! }
!
! public class Constraint : IConstraint
! {
! public delegate bool Method(object val);
! private Method m;
!
! public Constraint(Method m)
! {
! this.m = m;
! }
!
! public bool Eval(object val)
! {
! return m(val);
! }
!
! public string Message
! {
! get { return "Custom Constraint"; }
! }
! }
!
! }
--- 1,383 ----
! using System;
! using System.Text;
! using System.Text.RegularExpressions;
!
! namespace NMock.Constraints
! {
!
! public class IsNull : IConstraint
! {
! public bool Eval(object val)
! {
! return val == null;
! }
!
! public string Message
! {
! get { return "null"; }
! }
! }
!
! public class IsAnything : IConstraint
! {
! public bool Eval(object val)
! {
! return true;
! }
!
! public string Message
! {
! get { return ""; }
! }
! }
!
! public class IsIn : IConstraint
! {
! private object[] inList;
!
! public IsIn(params object[] inList)
! {
! if (inList.Length == 1 && inList[0].GetType().IsArray)
! {
! Array arr = (Array)inList[0];
! this.inList = new object[arr.Length];
! arr.CopyTo(this.inList, 0);
! }
! else
! {
! this.inList = inList;
! }
! }
!
! public bool Eval(object val)
! {
! foreach (object o in inList)
! {
! if (o.Equals(val))
! {
! return true;
! }
! }
! return false;
! }
!
! public string Message
! {
! get
! {
! StringBuilder builder = new StringBuilder("IN ");
! foreach (object o in inList)
! {
! builder.Append('<');
! builder.Append(o);
! builder.Append(">, ");
! }
! string result = builder.ToString();
! if (result.EndsWith(", "))
! {
! result = result.Substring(0, result.Length - 2);
! }
! return result;
! }
! }
! }
!
! public class IsEqual : IConstraint {
! private object compare;
!
! public IsEqual(object compare)
! {
! this.compare = compare;
! }
!
! public bool Eval(object val)
! {
! return compare.Equals(val);
! }
!
! public string Message
! {
! get { return "<" + compare + ">"; }
! }
! }
!
! public class IsTypeOf : IConstraint
! {
! private Type type;
!
! public IsTypeOf(Type type)
! {
! this.type = type;
! }
!
! public bool Eval(object val)
! {
! return val == null ? false : type.IsAssignableFrom(val.GetType());
! }
!
! public string Message
! {
! get { return "typeof <" + type.FullName + ">"; }
! }
! }
!
! public class Not : IConstraint
! {
! private IConstraint p;
!
! public Not(IConstraint p)
! {
! this.p = p;
! }
!
! public bool Eval(object val)
! {
! return !p.Eval(val);
! }
!
! public string Message
! {
! get { return "NOT " + p.Message; }
! }
! }
!
! public class And : IConstraint
! {
! private IConstraint p1, p2;
!
! public And(IConstraint p1, IConstraint p2)
! {
! this.p1 = p1;
! this.p2 = p2;
! }
!
! public bool Eval(object val)
! {
! return p1.Eval(val) && p2.Eval(val);
! }
!
! public string Message
! {
! get { return p1.Message + " AND " + p2.Message; }
! }
! }
!
! public class Or : IConstraint
! {
! private IConstraint p1, p2;
!
! public Or(IConstraint p1, IConstraint p2)
! {
! this.p1 = p1;
! this.p2 = p2;
! }
!
! public bool Eval(object val)
! {
! return p1.Eval(val) || p2.Eval(val);
! }
!
! public string Message
! {
! get { return p1.Message + " OR " + p2.Message; }
! }
! }
!
! public class NotNull : IConstraint
! {
! public bool Eval(object val)
! {
! return val != null;
! }
!
! public string Message
! {
! get { return "NOT null"; }
! }
! }
!
! public class NotEqual : IConstraint
! {
! private IConstraint p;
!
! public NotEqual(object compare)
! {
! p = new Not(new IsEqual(compare));
! }
!
! public bool Eval(object val)
! {
! return p.Eval(val);
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class NotIn : IConstraint
! {
! private IConstraint p;
!
! public NotIn(params object[] inList)
! {
! p = new Not(new IsIn(inList));
! }
!
! public bool Eval(object val)
! {
! return p.Eval(val);
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class IsEqualIgnoreCase : IConstraint
! {
! private IConstraint p;
!
! public IsEqualIgnoreCase(object compare)
! {
! p = new IsEqual(compare.ToString().ToLower());
! }
!
! public bool Eval(object val)
! {
! return p.Eval(val.ToString().ToLower());
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class IsEqualIgnoreWhiteSpace : IConstraint
! {
! private IConstraint p;
!
! public IsEqualIgnoreWhiteSpace(object compare)
! {
! p = new IsEqual(StripSpace(compare.ToString()));
! }
!
! public bool Eval(object val)
! {
! return p.Eval(StripSpace(val.ToString()));
! }
!
! public static string StripSpace(string s)
! {
! StringBuilder result = new StringBuilder();
! bool lastWasSpace = true;
! foreach(char c in s)
! {
! if (Char.IsWhiteSpace(c))
! {
! if (!lastWasSpace)
! {
! result.Append(' ');
! }
! lastWasSpace = true;
! }
! else
! {
! result.Append(c);
! lastWasSpace = false;
! }
! }
! return result.ToString().Trim();
! }
!
! public string Message
! {
! get { return p.Message; }
! }
! }
!
! public class IsMatch : IConstraint
! {
! private Regex regex;
!
! public IsMatch(Regex regex)
! {
! this.regex = regex;
! }
!
! public IsMatch(String regex) : this(new Regex(regex))
! {
! }
!
! public IsMatch(String regex, bool ignoreCase) :
! this(new Regex(regex, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None))
! {
! }
!
! public bool Eval(object val)
! {
! return val == null ? false : regex.IsMatch(val.ToString());
! }
!
! public string Message
! {
! get { return "<" + regex.ToString() + ">"; }
! }
! }
!
! public class IsCloseTo : IConstraint
! {
!
! private double expected;
! private double error;
!
! public IsCloseTo(double expected, double error)
! {
! this.expected = expected;
! this.error = error;
! }
!
! public bool Eval(object val)
! {
! try
! {
! double actual = Convert.ToDouble(val);
! return Math.Abs(actual - expected) <= error;
! }
! catch (FormatException)
! {
! return false;
! }
! }
!
! public string Message
! {
! get { return "<" + expected + ">"; }
! }
! }
!
! public class Constraint : IConstraint
! {
! public delegate bool Method(object val);
! private Method m;
!
! public Constraint(Method m)
! {
! this.m = m;
! }
!
! public bool Eval(object val)
! {
! return m(val);
! }
!
! public string Message
! {
! get { return "Custom Constraint"; }
! }
! }
!
! }
|
|
From: <joe...@us...> - 2002-12-12 21:39:48
|
Update of /cvsroot/nmock/nmock/test/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv18108/test/NMock/Dynamic
Modified Files:
ClassGeneratorTest.cs
Log Message:
Forgotten whatever the hell it is we've done (but Steve did some too)
Index: ClassGeneratorTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/Dynamic/ClassGeneratorTest.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ClassGeneratorTest.cs 15 Nov 2002 22:31:10 -0000 1.2
--- ClassGeneratorTest.cs 12 Dec 2002 21:39:44 -0000 1.3
***************
*** 227,235 ****
mock.ExpectAndReturn("VirtualMethod", "hello");
- mock.ExpectAndReturn("ToString", "STRING");
mock.ExpectAndReturn("GetHashCode", 123);
mock.ExpectAndReturn("AbstractMethod", "fish");
Assertion.AssertEquals("hello", s.VirtualMethod());
- Assertion.AssertEquals("STRING", s.ToString());
Assertion.AssertEquals(123, s.GetHashCode());
Assertion.AssertEquals("fish", s.AbstractMethod());
--- 227,233 ----
|
|
From: <joe...@us...> - 2002-12-12 21:39:47
|
Update of /cvsroot/nmock/nmock/test/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv18108/test/NMock
Modified Files:
DynamicMockTest.cs
Log Message:
Forgotten whatever the hell it is we've done (but Steve did some too)
Index: DynamicMockTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/DynamicMockTest.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DynamicMockTest.cs 15 Nov 2002 22:31:10 -0000 1.3
--- DynamicMockTest.cs 12 Dec 2002 21:39:44 -0000 1.4
***************
*** 78,81 ****
--- 78,111 ----
}
}
+
+ [Test]
+ public void MockOfClassUsedAsExpectation()
+ {
+ DynamicMock m1 = new DynamicMock(typeof(Thingy));
+ Thingy b = (Thingy)m1.MockInstance;
+ Mock m2 = new Mock("x");
+
+ m2.Expect("y", b);
+ m2.Call("y", b);
+ m2.Verify();
+ }
+
+ [Test]
+ [ExpectedException(typeof(VerifyException))]
+ public void MockOfClassUsedAsFailedExpectation()
+ {
+ DynamicMock m1 = new DynamicMock(typeof(Thingy));
+ Thingy b = (Thingy)m1.MockInstance;
+ Mock m2 = new Mock("x");
+
+ m2.Expect("y", b);
+ m2.Call("y", "something else");
+ m2.Verify();
+ }
+
+ public class Thingy
+ {
+ public void X() {}
+ }
}
}
|
|
From: <joe...@us...> - 2002-12-12 21:39:47
|
Update of /cvsroot/nmock/nmock/sample/order
In directory sc8-pr-cvs1:/tmp/cvs-serv18108/sample/order
Modified Files:
OrderProcessorTest.cs
Log Message:
Forgotten whatever the hell it is we've done (but Steve did some too)
Index: OrderProcessorTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/sample/order/OrderProcessorTest.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OrderProcessorTest.cs 15 Nov 2002 22:31:09 -0000 1.2
--- OrderProcessorTest.cs 12 Dec 2002 21:39:44 -0000 1.3
***************
*** 49,53 ****
// setup
notifier.Expect("NotifyUser", "joe", "Order 123 has been dispatched");
!
// execute
orderProcessor.Process((Order)order.MockInstance);
--- 49,53 ----
// setup
notifier.Expect("NotifyUser", "joe", "Order 123 has been dispatched");
!
// execute
orderProcessor.Process((Order)order.MockInstance);
|
|
From: <joe...@us...> - 2002-12-12 21:39:47
|
Update of /cvsroot/nmock/nmock/src/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv18108/src/NMock
Modified Files:
Mock.cs IMock.cs
Added Files:
IVerifiable.cs
Log Message:
Forgotten whatever the hell it is we've done (but Steve did some too)
--- NEW FILE: IVerifiable.cs ---
namespace NMock
{
public interface IVerifiable
{
void Verify();
}
}
Index: Mock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Mock.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Mock.cs 15 Nov 2002 22:31:09 -0000 1.4
--- Mock.cs 12 Dec 2002 21:39:43 -0000 1.5
***************
*** 60,74 ****
public virtual void ExpectNoCall(string methodName)
{
! addExpectation(new NoCallExpectation(methodName));
}
public virtual void ExpectAndReturn(string methodName, object result, params object[] args)
{
! addExpectation(new Expectation(methodName, result, null, args));
}
public virtual void ExpectAndThrow(string methodName, Exception e, params object[] args)
{
! addExpectation(new Expectation(methodName, null, e, args));
}
--- 60,74 ----
public virtual void ExpectNoCall(string methodName)
{
! addExpectation(new MockNoCall(methodName));
}
public virtual void ExpectAndReturn(string methodName, object result, params object[] args)
{
! addExpectation(new MockCall(methodName, result, null, args));
}
public virtual void ExpectAndThrow(string methodName, Exception e, params object[] args)
{
! addExpectation(new MockCall(methodName, null, e, args));
}
***************
*** 85,90 ****
}
! IList list = (IList) expectations[methodName];
! if (list == null)
{
if ( strict )
--- 85,90 ----
}
! IList methodExpectations = (IList) expectations[methodName];
! if (methodExpectations == null)
{
if ( strict )
***************
*** 94,108 ****
return null;
}
! if (list.Count == counter(methodName))
{
! throw new VerifyException(methodName + "() called too many times", list.Count, counter(methodName) + 1);
}
! Expectation e = (Expectation)list[counter(methodName)];
! if (e is NoCallExpectation)
{
throw new VerifyException(methodName + "() called", 0, 1);
}
increment(methodName);
! return e.Verify(methodName, args);
}
--- 94,108 ----
return null;
}
! if (methodExpectations.Count == counter(methodName))
{
! throw new VerifyException(methodName + "() called too many times", methodExpectations.Count, counter(methodName) + 1);
}
! MockCall mockCall = (MockCall)methodExpectations[counter(methodName)];
! if (mockCall is MockNoCall)
{
throw new VerifyException(methodName + "() called", 0, 1);
}
increment(methodName);
! return mockCall.Call(methodName, args);
}
***************
*** 117,186 ****
}
! private void addExpectation(Expectation e)
{
! IList list = (IList) expectations[e.MethodName];
if (list == null)
{
list = new ArrayList();
! expectations[e.MethodName] = list;
}
! list.Add(e);
}
! private class Expectation
{
public string MethodName;
! private object[] args;
private object returnValue;
private Exception e;
! public Expectation(string methodName, object returnValue, Exception e, object[] args)
{
this.MethodName = methodName;
if (args == null)
{
! this.args = new object[0];
}
! else
{
! this.args = args;
}
!
! this.returnValue = returnValue;
! this.e = e;
}
!
! public virtual object Verify(string methodName, object[] args)
{
! if ( this.args.Length > 0 )
{
// assert that the correct number of arguments were passed
! Assertion.AssertEquals("x() called with incorrect number of parameters", this.args.Length, args.Length);
// assert that each passed in arg is validated by the appropriate predicate.
! for (int i = 0; i < this.args.Length; i++)
{
! object expectedArg = this.args[i];
! object actualArg = args[i];
! IConstraint Constraint = expectedArg as IConstraint;
! // if expectedArg is not an IConstraint, use default
! // behavior of IsEqual or IsAnything
! if (Constraint == null)
! {
! if (expectedArg == null)
! {
! Constraint = new IsAnything();
! }
! else
! {
! Constraint = new IsEqual(expectedArg);
! }
! }
! String messageFormat = "{0}() called with incorrect parameter ({1})";
! String message = String.Format(messageFormat, methodName, i + 1);
! if (!Constraint.Eval(actualArg))
{
! throw new VerifyException(message, Constraint.Message, actualArg);
}
}
--- 117,188 ----
}
! private void addExpectation(MockCall call)
{
! IList list = (IList) expectations[call.MethodName];
if (list == null)
{
list = new ArrayList();
! expectations[call.MethodName] = list;
}
! list.Add(call);
}
! private class MockCall
{
public string MethodName;
! private IConstraint[] expectedArgs;
private object returnValue;
private Exception e;
! public MockCall(string methodName, object returnValue, Exception e, object[] expectedArgs)
{
this.MethodName = methodName;
+ this.returnValue = returnValue;
+ this.e = e;
+ this.expectedArgs = argsAsConstraints(expectedArgs);
+ }
+
+ private IConstraint[] argsAsConstraints(object[] args)
+ {
if (args == null)
{
! return new IConstraint[0];
}
! IConstraint[] result = new IConstraint[args.Length];
! for (int i = 0; i < args.Length; ++i)
{
! result[i] = argAsConstraint(args[i]);
}
! return result;
}
!
! private IConstraint argAsConstraint(object arg)
{
! IConstraint constraint = arg as IConstraint;
! if (constraint != null)
! {
! return constraint;
! }
! return arg == null ? (IConstraint)new IsAnything() : (IConstraint)new IsEqual(arg);
! }
!
! public virtual object Call(string methodName, object[] actualArgs)
! {
! if ( this.expectedArgs.Length > 0 )
{
// assert that the correct number of arguments were passed
! Assertion.AssertEquals("x() called with incorrect number of parameters", this.expectedArgs.Length, actualArgs.Length);
// assert that each passed in arg is validated by the appropriate predicate.
! for (int i = 0; i < this.expectedArgs.Length; i++)
{
! IConstraint expectedArg = expectedArgs[i];
! object actualArg = actualArgs[i];
! if (!expectedArg.Eval(actualArg))
{
! String messageFormat = "{0}() called with incorrect parameter ({1})";
! String message = String.Format(messageFormat, methodName, i + 1);
! throw new VerifyException(message, expectedArg.Message, actualArg);
}
}
***************
*** 197,203 ****
}
! private class NoCallExpectation : Expectation
{
! public NoCallExpectation(string methodName) : base(methodName, null, null, null)
{
}
--- 199,205 ----
}
! private class MockNoCall : MockCall
{
! public MockNoCall(string methodName) : base(methodName, null, null, null)
{
}
Index: IMock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/IMock.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IMock.cs 15 Nov 2002 22:31:09 -0000 1.2
--- IMock.cs 12 Dec 2002 21:39:43 -0000 1.3
***************
*** 8,12 ****
/// </summary>
/// <see cref="Mock"/>
! public interface IMock
{
/// <summary>
--- 8,12 ----
/// </summary>
/// <see cref="Mock"/>
! public interface IMock : IVerifiable
{
/// <summary>
***************
*** 59,67 ****
/// </summary>
object Call(string methodName, params object[] args);
!
! /// <summary>
! /// Verify that all expectations were met.
! /// </summary>
! void Verify();
}
}
--- 59,63 ----
/// </summary>
object Call(string methodName, params object[] args);
!
}
}
|
|
From: <joe...@us...> - 2002-12-12 21:39:47
|
Update of /cvsroot/nmock/nmock/src/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv18108/src/NMock/Dynamic
Modified Files:
ClassGenerator.cs
Log Message:
Forgotten whatever the hell it is we've done (but Steve did some too)
Index: ClassGenerator.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Dynamic/ClassGenerator.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ClassGenerator.cs 11 Nov 2002 20:00:20 -0000 1.2
--- ClassGenerator.cs 12 Dec 2002 21:39:43 -0000 1.3
***************
*** 18,21 ****
--- 18,23 ----
public virtual object Generate(Type type, IMock mock, IList methodsToIgnore)
{
+ methodsToIgnore.Add("Equals");
+ methodsToIgnore.Add("ToString");
TypeBuilder typeBuilder = getTypeBuilder("Mock" + type.Name, type);
FieldBuilder mockFieldBuilder = typeBuilder.DefineField("underlyingMock", typeof(IMock), FieldAttributes.Public);
|
|
From: <joe...@us...> - 2002-11-15 22:48:23
|
Update of /cvsroot/nmock/nmock/test/NMock
In directory usw-pr-cvs1:/tmp/cvs-serv3449/test/NMock
Added Files:
VerifyExceptionTest.cs
Log Message:
- Added sensible error messages
- Renamed IMock.Object to IMock.MockInstance
- Renamed Conditions to Constraints and moved to new namespace.
- Renamed eval() to Eval() (.NET conventions).
- Renamed IMock.SetValue() to IMock.SetupResult (as in Java MockObjects).
--- NEW FILE: VerifyExceptionTest.cs ---
using System;
using NUnit.Framework;
namespace NMock
{
[TestFixture]
public class VerifyExceptionTest
{
[Test]
public void Message()
{
VerifyException e = new VerifyException("Boo", "<Wee>", 44);
Assertion.AssertEquals("Boo\nexpected:<Wee>\n but was:<44>", e.Message);
Assertion.AssertEquals("Boo", e.Reason);
Assertion.AssertEquals("<Wee>", e.Expected);
Assertion.AssertEquals(44, e.Actual);
}
}
}
|