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
(24) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sm...@us...> - 2003-07-26 06:22:20
|
Update of /cvsroot/nmock/nmock/test/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv9204/test/NMock/Dynamic
Modified Files:
ClassGeneratorTest.cs
Log Message:
Restored broken support for Longs and Remoting
Can no longer mock classes with internal methods
Index: ClassGeneratorTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/Dynamic/ClassGeneratorTest.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ClassGeneratorTest.cs 24 Jul 2003 23:09:05 -0000 1.8
--- ClassGeneratorTest.cs 25 Jul 2003 15:52:41 -0000 1.9
***************
*** 1,7 ****
using NUnit.Framework;
using NMock;
using NMock.Constraints;
- using System.Reflection.Emit;
- using System.Collections;
namespace NMock.Dynamic
--- 1,10 ----
+ using System;
+ using System.Collections;
+ using System.Reflection.Emit;
+
+
using NUnit.Framework;
using NMock;
using NMock.Constraints;
namespace NMock.Dynamic
***************
*** 18,21 ****
--- 21,26 ----
void WithOtherArgs(int x, bool y, object o, IList list);
void WithParams(int i, params string[] extra);
+ void WithLongParam(long l);
+ void WithIntParam(int i);
object simpleReturn();
string stringReturn();
***************
*** 35,44 ****
}
- // 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"; }
--- 40,48 ----
}
public abstract class SolidThingy : ISolidThingy
{
+ // internal and protected internal methods must be overridable!
public virtual string VirtualMethod() { return "xx"; }
public abstract string AbstractMethod();
protected internal virtual string ProtectedInternalMethod() { return "xx"; }
***************
*** 57,61 ****
--- 61,69 ----
get { return "xx"; }
}
+ }
+ public class ClassWithInternalMethod
+ {
+ internal virtual string InternalMethod() { return "xx"; }
}
***************
*** 163,166 ****
--- 171,188 ----
}
+ [Test] public void CallMethodWithStringParameter()
+ {
+ mock.Expect("WithSimpleArg", "hello");
+ thingy.WithSimpleArg("hello");
+ mock.Verify();
+ }
+
+ [Test] public void CallMethodWithIntParameter()
+ {
+ mock.Expect("WithIntParam", 1);
+ thingy.WithIntParam(1);
+ mock.Verify();
+ }
+
[Test]
[ExpectedException(typeof(VerifyException))]
***************
*** 214,217 ****
--- 236,246 ----
}
+ [Test] public void CallMethodWithLongParam()
+ {
+ mock.Expect("WithLongParam", 5L);
+ thingy.WithLongParam(5);
+ mock.Verify();
+ }
+
[Test]
public void CallReadOnlyProperty()
***************
*** 257,261 ****
mock.ExpectAndReturn("GetHashCode", 123);
mock.ExpectAndReturn("AbstractMethod", "fish");
- mock.ExpectAndReturn("InternalMethod", "black");
mock.ExpectAndReturn("ProtectedInternalMethod", "white");
--- 286,289 ----
***************
*** 263,267 ****
Assertion.AssertEquals(123, s.GetHashCode());
Assertion.AssertEquals("fish", s.AbstractMethod());
- Assertion.AssertEquals("black", s.InternalMethod());
Assertion.AssertEquals("white", s.ProtectedInternalMethod());
--- 291,294 ----
***************
*** 272,275 ****
--- 299,308 ----
}
+ [Test] [ExpectedException(typeof(TypeLoadException))]
+ public void CannotMockClassWithInternalMethodBecauseOfAssemblyVisibility()
+ {
+ new ClassGenerator().Generate(typeof(ClassWithInternalMethod), mock);
+ }
+
[Test]
public void CheckBoxingOpCodes()
|
|
From: <sm...@us...> - 2003-07-26 06:22:19
|
Update of /cvsroot/nmock/nmock/src/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv9112/src/NMock
Modified Files:
Mock.cs DynamicMock.cs
Log Message:
Restored broken support for Longs and Remoting
Index: Mock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Mock.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Mock.cs 24 Jul 2003 23:08:42 -0000 1.9
--- Mock.cs 25 Jul 2003 15:52:11 -0000 1.10
***************
*** 68,76 ****
}
- // public virtual void SetupResult(string methodName, object returnVal)
- // {
- // SetupResult(methodName, new Type[0], returnVal);
- // }
-
public virtual void SetupResult(string methodName, object returnVal, params Type[] argTypes)
{
--- 68,71 ----
Index: DynamicMock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/DynamicMock.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** DynamicMock.cs 24 Jul 2003 23:08:42 -0000 1.11
--- DynamicMock.cs 25 Jul 2003 15:52:11 -0000 1.12
***************
*** 47,52 ****
private void generate()
{
! ClassGenerator cg = new ClassGenerator();
obj = cg.Generate(type, this, ignore);
}
--- 47,57 ----
private void generate()
{
! ClassGenerator cg = createClassGenerator();
obj = cg.Generate(type, this, ignore);
+ }
+
+ protected virtual ClassGenerator createClassGenerator()
+ {
+ return new ClassGenerator();
}
|
|
From: Joe W. <jo...@tr...> - 2003-07-25 16:59:52
|
It's funny you should say this. Tim Mackinnon came across the problem
with structs today - and he's fixed it.
Tim, where's our patch? ;)
-joe
Vaughn, Clifton wrote:
>I tried the following test case and i get a wierd error:
>
> public interface ITestStruct
> {
> System.Drawing.Point getPoint();
> void setPoint( System.Drawing.Point pt );
> }
> public void TestStruct()
> {
> DynamicMock foo = new DynamicMock( typeof(
>ITestStruct ));
> ITestStruct ifoo = (ITestStruct)foo.MockInstance;
> System.Drawing.Point p1 = new
>System.Drawing.Point(1,2);
> foo.ExpectAndReturn( "getPoint", p1 );
> foo.Expect( "setPoint", p1 );
>
> ifoo.setPoint( ifoo.getPoint() );
> foo.Verify();
> }
>
>c:\documents and settings\vaughnc.vci\my
>documents\dev\media\tests\tnfwmarketscontroller.cs(52):
>TargetNavigator.Tests.TNfwMarketsController.TestStruct: setPoint() called
>with incorrect parameter (1)
>expected:<{X=1,Y=2}>
> but was:<{X=322283128,Y=0}>
>
>This also happens with DateTime. Any ideas?
>
>cliff
>
>
>-------------------------------------------------------
>This SF.Net email sponsored by: Free pre-built ASP.NET sites including
>Data Reports, E-commerce, Portals, and Forums are available now.
>Download today and enter to win an XBOX or Visual Studio .NET.
>http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
>_______________________________________________
>Nmock-general mailing list
>Nmo...@li...
>https://lists.sourceforge.net/lists/listinfo/nmock-general
>
>
|
|
From: Vaughn, C. <Va...@va...> - 2003-07-25 16:36:09
|
I tried the following test case and i get a wierd error:
public interface ITestStruct
{
System.Drawing.Point getPoint();
void setPoint( System.Drawing.Point pt );
}
public void TestStruct()
{
DynamicMock foo = new DynamicMock( typeof(
ITestStruct ));
ITestStruct ifoo = (ITestStruct)foo.MockInstance;
System.Drawing.Point p1 = new
System.Drawing.Point(1,2);
foo.ExpectAndReturn( "getPoint", p1 );
foo.Expect( "setPoint", p1 );
ifoo.setPoint( ifoo.getPoint() );
foo.Verify();
}
c:\documents and settings\vaughnc.vci\my
documents\dev\media\tests\tnfwmarketscontroller.cs(52):
TargetNavigator.Tests.TNfwMarketsController.TestStruct: setPoint() called
with incorrect parameter (1)
expected:<{X=1,Y=2}>
but was:<{X=322283128,Y=0}>
This also happens with DateTime. Any ideas?
cliff
|
|
From: <sm...@us...> - 2003-07-24 23:09:26
|
Update of /cvsroot/nmock/nmock
In directory sc8-pr-cvs1:/tmp/cvs-serv24184
Modified Files:
nmock.sln
Log Message:
Index: nmock.sln
===================================================================
RCS file: /cvsroot/nmock/nmock/nmock.sln,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** nmock.sln 13 Mar 2003 19:52:44 -0000 1.2
--- nmock.sln 24 Jul 2003 23:09:23 -0000 1.3
***************
*** 1,15 ****
! 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
! Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample", "sample\sample.csproj", "{F0E405D5-9850-432F-853F-2DC7F1378CCC}"
EndProject
Global
! GlobalSection(SolutionConfiguration) = preSolution
! ConfigName.0 = Debug
! ConfigName.1 = Release
EndGlobalSection
! GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
--- 1,36 ----
! Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "src", "src\src.csproj", "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{2735C01B-475D-4B75-AF30-C00D9A977E58}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
EndProject
! Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample", "sample\sample.csproj", "{77AB0622-D9F4-4D60-9A13-73703FE41788}"
! ProjectSection(ProjectDependencies) = postProject
! EndProjectSection
EndProject
Global
! GlobalSection(SourceCodeControl) = preSolution
! SccNumberOfProjects = 4
! SccProjectName0 = Perforce\u0020Project
! SccLocalPath0 = .
! SccProvider0 = MSSCCI:Perforce\u0020SCM
! CanCheckoutShared = true
! SolutionUniqueID = {D1A7C12C-013C-4686-A687-CEC9585CDE0D}
! SccProjectUniqueName1 = src\\src.csproj
! SccLocalPath1 = src
! CanCheckoutShared = true
! SccProjectUniqueName2 = test\\test.csproj
! SccLocalPath2 = test
! CanCheckoutShared = true
! SccProjectUniqueName3 = sample\\sample.csproj
! SccLocalPath3 = sample
! CanCheckoutShared = true
EndGlobalSection
! GlobalSection(SolutionConfiguration) = preSolution
! Debug = Debug
! Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
***************
*** 22,29 ****
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Release.ActiveCfg = Release|.NET
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Release.Build.0 = Release|.NET
! {F0E405D5-9850-432F-853F-2DC7F1378CCC}.Debug.ActiveCfg = Debug|.NET
! {F0E405D5-9850-432F-853F-2DC7F1378CCC}.Debug.Build.0 = Debug|.NET
! {F0E405D5-9850-432F-853F-2DC7F1378CCC}.Release.ActiveCfg = Release|.NET
! {F0E405D5-9850-432F-853F-2DC7F1378CCC}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
--- 43,50 ----
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Release.ActiveCfg = Release|.NET
{2735C01B-475D-4B75-AF30-C00D9A977E58}.Release.Build.0 = Release|.NET
! {77AB0622-D9F4-4D60-9A13-73703FE41788}.Debug.ActiveCfg = Debug|.NET
! {77AB0622-D9F4-4D60-9A13-73703FE41788}.Debug.Build.0 = Debug|.NET
! {77AB0622-D9F4-4D60-9A13-73703FE41788}.Release.ActiveCfg = Release|.NET
! {77AB0622-D9F4-4D60-9A13-73703FE41788}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
From: <sm...@us...> - 2003-07-24 23:09:22
|
Update of /cvsroot/nmock/nmock/test
In directory sc8-pr-cvs1:/tmp/cvs-serv24164/test
Modified Files:
test.csproj
Log Message:
Index: test.csproj
===================================================================
RCS file: /cvsroot/nmock/nmock/test/test.csproj,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test.csproj 13 Jul 2003 13:27:06 -0000 1.4
--- test.csproj 24 Jul 2003 23:09:16 -0000 1.5
***************
*** 2,8 ****
<CSHARP
ProjectType = "Local"
! ProductVersion = "7.0.9466"
! SchemaVersion = "1.0"
ProjectGuid = "{2735C01B-475D-4B75-AF30-C00D9A977E58}"
>
<Build>
--- 2,11 ----
<CSHARP
ProjectType = "Local"
! ProductVersion = "7.10.3077"
! SchemaVersion = "2.0"
ProjectGuid = "{2735C01B-475D-4B75-AF30-C00D9A977E58}"
+ SccProjectName = "Perforce Project"
+ SccLocalPath = "."
+ SccProvider = "MSSCCI:Perforce SCM"
>
<Build>
***************
*** 17,21 ****
DelaySign = "false"
OutputType = "Library"
! RootNamespace = ""
StartupObject = ""
>
--- 20,27 ----
DelaySign = "false"
OutputType = "Library"
! PreBuildEvent = ""
! PostBuildEvent = ""
! RootNamespace = "NMock"
! RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
***************
*** 31,34 ****
--- 37,42 ----
FileAlignment = "4096"
IncrementalBuild = "true"
+ NoStdLib = "false"
+ NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
***************
*** 36,40 ****
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
! WarningLevel = "3"
/>
<Config
--- 44,48 ----
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
! WarningLevel = "4"
/>
<Config
***************
*** 49,52 ****
--- 57,62 ----
FileAlignment = "4096"
IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
***************
*** 74,82 ****
/>
<Reference
- Name = "src"
- Project = "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
- />
- <Reference
Name = "nunit.util"
AssemblyName = "nunit.util"
--- 84,87 ----
***************
*** 89,95 ****
/>
<Reference
! Name = "System.Runtime.Remoting"
! AssemblyName = "System.Runtime.Remoting"
! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Runtime.Remoting.dll"
/>
</References>
--- 94,100 ----
/>
<Reference
! Name = "src"
! Project = "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
! Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
***************
*** 128,152 ****
/>
<File
- RelPath = "NMock\Constraints\IsArrayEqualTest.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
RelPath = "NMock\Dynamic\ClassGeneratorTest.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NMock\Dynamic\InterfaceListerTest.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NMock\Remoting\MockServerTest.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NMock\Remoting\RemotingMockTest.cs"
SubType = "Code"
BuildAction = "Compile"
--- 133,137 ----
|
|
From: <sm...@us...> - 2003-07-24 23:09:09
|
Update of /cvsroot/nmock/nmock/test/NMock/Constraints
In directory sc8-pr-cvs1:/tmp/cvs-serv24112/test/NMock/Constraints
Modified Files:
ConstraintsTest.cs
Log Message:
Index: ConstraintsTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/Constraints/ConstraintsTest.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ConstraintsTest.cs 10 Feb 2003 13:26:17 -0000 1.5
--- ConstraintsTest.cs 24 Jul 2003 23:09:05 -0000 1.6
***************
*** 1,5 ****
using NUnit.Framework;
using System.Text.RegularExpressions;
!
namespace NMock.Constraints
{
--- 1,5 ----
using NUnit.Framework;
using System.Text.RegularExpressions;
! using System.Collections;
namespace NMock.Constraints
{
***************
*** 47,50 ****
--- 47,62 ----
Assertion.Assert(!c.Eval(i2));
Assertion.Assert(!c.Eval(2));
+ }
+
+ [Test]
+ public void IsEqualWhenArray()
+ {
+ object[] o1 = new object[] { 1, 2, 3 };
+ object[] o2 = new object[] { 1, 2, 4 };
+
+ c = new IsEqual(new object[] { 1, 2, 3 });
+ Assertion.Assert("should be equal", c.Eval(o1));
+ Assertion.Assert("shouldn't be equal", !c.Eval(o2));
+ Assertion.Assert("it ain't null", !c.Eval(null));
}
|
|
From: <sm...@us...> - 2003-07-24 23:09:09
|
Update of /cvsroot/nmock/nmock/test/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv24112/test/NMock
Modified Files:
FastErrorHandlingTest.cs DynamicMockTest.cs MockTest.cs
Log Message:
Index: FastErrorHandlingTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/FastErrorHandlingTest.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FastErrorHandlingTest.cs 13 Mar 2003 21:54:59 -0000 1.2
--- FastErrorHandlingTest.cs 24 Jul 2003 23:09:05 -0000 1.3
***************
*** 81,85 ****
try
{
! full.Expect("Bar");
Fail();
}
--- 81,85 ----
try
{
! full.Expect("Bar", "test");
Fail();
}
Index: DynamicMockTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/DynamicMockTest.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DynamicMockTest.cs 1 Jun 2003 09:48:49 -0000 1.7
--- DynamicMockTest.cs 24 Jul 2003 23:09:05 -0000 1.8
***************
*** 2,5 ****
--- 2,6 ----
using System;
using System.Collections;
+ using NMock.Constraints;
namespace NMock
***************
*** 65,70 ****
DynamicMock mock = new DynamicMock(typeof(SameClass));
mock.Ignore("A");
SameClass sc = (SameClass)mock.MockInstance;
!
mock.SetupResult("b", "hello");
--- 66,72 ----
DynamicMock mock = new DynamicMock(typeof(SameClass));
mock.Ignore("A");
+ mock.Ignore("c");
SameClass sc = (SameClass)mock.MockInstance;
!
mock.SetupResult("b", "hello");
***************
*** 76,80 ****
public virtual string A()
{
! return b();
}
--- 78,89 ----
public virtual string A()
{
! if(c())
! {
! return b();
! }
! else
! {
! return "Default";
! }
}
***************
*** 83,89 ****
--- 92,135 ----
throw new Exception("Ouch");
}
+
+ protected virtual bool c()
+ {
+ return true;
+ }
}
+
[Test]
+ public void MockingOnlyPartsOfACalledObjectWithNoExpectation()
+ {
+ DynamicMock mock = new DynamicMock(typeof(SameClass));
+ mock.Ignore("A");
+ SameClass sc = (SameClass)mock.MockInstance;
+ SomeCallingClass caller = new SomeCallingClass(sc);
+
+ mock.ExpectAndReturn("c", true);
+ mock.SetupResult("b", "hello");
+
+ Assertion.AssertEquals("hello", caller.CallSomeClass());
+
+ mock.Verify();
+ }
+
+ public class SomeCallingClass
+ {
+ SameClass _sameClass;
+
+ public SomeCallingClass(SameClass sc)
+ {
+ _sameClass = sc;
+ }
+
+ public virtual string CallSomeClass()
+ {
+ return _sameClass.A();
+ }
+ }
+
+ [Test]
public void MockOfClassUsedAsExpectation()
{
***************
*** 144,147 ****
--- 190,249 ----
{
public void X() {}
+ }
+
+ // [Test]
+ // public void ItIsPossibleToMockMembersWithAParamsArgument()
+ // {
+ // IMock mock = new DynamicMock(typeof(IWithParams));
+ // mock.Expect("DoStuff", new Object[] {1, 2, 3});
+ //
+ // IWithParams p = (IWithParams)mock.MockInstance;
+ // p.DoStuff(1, 2, 3);
+ //
+ // mock.Verify();
+ // }
+ //
+ // interface IWithParams
+ // {
+ // void DoStuff(params object[] args);
+ // }
+
+ interface IOverloadedMethods
+ {
+ void DoStuff(string one, int two);
+ void DoStuff(string one);
+ }
+
+ [Test]
+ public void CanMockOverloadedMethods()
+ {
+ IMock mock = new DynamicMock(typeof(IOverloadedMethods));
+ mock.Expect("DoStuff", "one", 2);
+ mock.Expect("DoStuff", "one");
+
+ IOverloadedMethods instance = (IOverloadedMethods)mock.MockInstance;
+ instance.DoStuff("one", 2);
+ instance.DoStuff("one");
+ mock.Verify();
+ }
+
+ [Test]
+ public void CanMockMethodWithConstraint()
+ {
+ IMock mock = new DynamicMock(typeof(SomeTestInterface));
+ mock.Expect("Foo", new StartsWith("Hello"));
+ mock.ExpectAndReturn("Bar", 5, new NotNull());
+
+ SomeTestInterface instance = (SomeTestInterface)mock.MockInstance;
+ instance.Foo("Hello World");
+ Assertion.AssertEquals("Should get a result", 5, instance.Bar("not null"));
+
+ mock.Verify();
+ }
+
+ interface SomeTestInterface
+ {
+ void Foo(String a);
+ int Bar(String a);
}
}
Index: MockTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/MockTest.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MockTest.cs 13 Mar 2003 22:22:13 -0000 1.7
--- MockTest.cs 24 Jul 2003 23:09:05 -0000 1.8
***************
*** 428,432 ****
IMock Constraint = new DynamicMock(typeof(IConstraint));
Constraint.SetupResult("Message", "wee woo");
! Constraint.SetupResult("Eval", false);
mock.Expect("x", new IsAnything(), (IConstraint)Constraint.MockInstance);
--- 428,432 ----
IMock Constraint = new DynamicMock(typeof(IConstraint));
Constraint.SetupResult("Message", "wee woo");
! Constraint.SetupResult("Eval", false, typeof(object));
mock.Expect("x", new IsAnything(), (IConstraint)Constraint.MockInstance);
***************
*** 440,443 ****
--- 440,453 ----
Assertion.AssertEquals("world", e.Actual);
}
+ }
+
+ [Test]
+ public void ArgTypes()
+ {
+ MockCall call = new MockCall(null, null, new object[] {1, "string",
+ new bool[] {true, false}});
+ Assertion.AssertEquals("Parameter one", typeof(int), call.ArgTypes[0]);
+ Assertion.AssertEquals("Parameter two", typeof(string), call.ArgTypes[1]);
+ Assertion.AssertEquals("Parameter three", typeof(bool[]), call.ArgTypes[2]);
}
|
|
From: <sm...@us...> - 2003-07-24 23:09:09
|
Update of /cvsroot/nmock/nmock/test/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv24112/test/NMock/Dynamic
Modified Files:
ClassGeneratorTest.cs
Log Message:
Index: ClassGeneratorTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/Dynamic/ClassGeneratorTest.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ClassGeneratorTest.cs 27 Jun 2003 21:15:54 -0000 1.7
--- ClassGeneratorTest.cs 24 Jul 2003 23:09:05 -0000 1.8
***************
*** 18,22 ****
void WithOtherArgs(int x, bool y, object o, IList list);
void WithParams(int i, params string[] extra);
- void WithLongParam(long l);
object simpleReturn();
string stringReturn();
--- 18,21 ----
***************
*** 212,223 ****
mock.Expect("WithOtherArgs", new IsEqual(6), new IsEqual(true), new IsNull(), new IsEqual(l));
thingy.WithOtherArgs(6, true, null, l);
- mock.Verify();
- }
-
- [Test]
- public void CallMethodWithLongParam()
- {
- mock.Expect("WithLongParam", 5L);
- thingy.WithLongParam(5L);
mock.Verify();
}
--- 211,214 ----
|
|
From: <sm...@us...> - 2003-07-24 23:08:58
|
Update of /cvsroot/nmock/nmock/src
In directory sc8-pr-cvs1:/tmp/cvs-serv24075/src
Added Files:
NMock.csproj
Log Message:
--- NEW FILE: NMock.csproj ---
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
SccProjectName = "Perforce Project"
SccLocalPath = "."
SccProvider = "MSSCCI:Perforce SCM"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "NMock"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "NMock"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
NoStdLib = "false"
NoWarn = ""
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"
NoStdLib = "false"
NoWarn = ""
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\CallMethodWithoutExpectation.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\DynamicMock.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "NMock\IMethod.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\SingleMethod.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"
/>
<File
RelPath = "NMock\Dynamic\InterfaceLister.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
|
Update of /cvsroot/nmock/nmock/src/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv24022/src/NMock
Modified Files:
Mock.cs IMock.cs DynamicMock.cs MockCall.cs SingleMethod.cs
Added Files:
CallMethodWithoutExpectation.cs
Log Message:
--- NEW FILE: CallMethodWithoutExpectation.cs ---
using System;
namespace NMock
{
public class CallMethodWithoutExpectation : IMethod
{
private string name;
private MockCall call;
public CallMethodWithoutExpectation(string name)
{
this.name = name;
}
public string Name
{
get { return name; }
}
public virtual void SetExpectation(MockCall call)
{
this.call = call;
}
public virtual object Call(params object[] parameters)
{
return call.Call(name, parameters);
}
public virtual void Verify()
{
// noop
}
}
}
Index: Mock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Mock.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Mock.cs 13 Mar 2003 22:22:11 -0000 1.8
--- Mock.cs 24 Jul 2003 23:08:42 -0000 1.9
***************
*** 1,4 ****
--- 1,5 ----
using System;
using System.Collections;
+ using System.Reflection;
using NMock.Constraints;
***************
*** 11,15 ****
private bool strict;
private IDictionary methods;
!
public Mock(string name)
{
--- 12,16 ----
private bool strict;
private IDictionary methods;
!
public Mock(string name)
{
***************
*** 41,47 ****
}
! public virtual void ExpectNoCall(string methodName)
{
! addExpectation(methodName, new MockNoCall());
}
--- 42,48 ----
}
! public virtual void ExpectNoCall(string methodName, params Type[] argTypes)
{
! addExpectation(methodName, new MockNoCall(argTypes));
}
***************
*** 58,62 ****
private void addExpectation(string methodName, MockCall call)
{
! IMethod method = getMethod(methodName);
if (method == null)
{
--- 59,63 ----
private void addExpectation(string methodName, MockCall call)
{
! IMethod method = getMethod(methodName, call.ArgTypes);
if (method == null)
{
***************
*** 67,84 ****
}
! public virtual void SetupResult(string methodName, object returnVal)
{
! IMethod method = getMethod(methodName);
if (method == null)
{
! method = new SingleMethod(methodName);
methods[methodName] = method;
}
! method.SetExpectation(new MockCall(returnVal, null, null));
}
public virtual object Call(string methodName, params object[] args)
{
! IMethod method = getMethod(methodName);
if (method == null)
{
--- 68,91 ----
}
! // public virtual void SetupResult(string methodName, object returnVal)
! // {
! // SetupResult(methodName, new Type[0], returnVal);
! // }
!
! public virtual void SetupResult(string methodName, object returnVal, params Type[] argTypes)
{
! IMethod method = getMethod(methodName, argTypes);
if (method == null)
{
! method = new CallMethodWithoutExpectation(methodName);
methods[methodName] = method;
}
! method.SetExpectation(new MockCall( returnVal, null, null));
}
public virtual object Call(string methodName, params object[] args)
{
! Type[] argTypes = MockCall.GetArgTypes(args);
! IMethod method = getMethod(methodName, argTypes);
if (method == null)
{
***************
*** 100,104 ****
}
! protected virtual IMethod getMethod(string methodName)
{
return (IMethod)methods[methodName];
--- 107,111 ----
}
! protected virtual IMethod getMethod(string methodName, Type[] argTypes)
{
return (IMethod)methods[methodName];
Index: IMock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/IMock.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** IMock.cs 12 Dec 2002 21:39:43 -0000 1.3
--- IMock.cs 24 Jul 2003 23:08:42 -0000 1.4
***************
*** 34,38 ****
/// Expect no call to this method.
/// </summary>
! void ExpectNoCall(string methodName);
/// <summary>
--- 34,38 ----
/// Expect no call to this method.
/// </summary>
! void ExpectNoCall(string methodName, params Type[] argTypes);
/// <summary>
***************
*** 53,57 ****
/// each time. Useful for getter style methods.
/// </summary>
! void SetupResult(string methodName, object returnVal);
/// <summary>
--- 53,58 ----
/// each time. Useful for getter style methods.
/// </summary>
! void SetupResult(string methodName, object returnVal, params Type[] argTypes);
!
/// <summary>
Index: DynamicMock.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/DynamicMock.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** DynamicMock.cs 13 Jul 2003 13:27:06 -0000 1.10
--- DynamicMock.cs 24 Jul 2003 23:08:42 -0000 1.11
***************
*** 3,6 ****
--- 3,7 ----
using System.Reflection;
using NMock.Dynamic;
+ using NMock.Constraints;
namespace NMock
***************
*** 30,34 ****
if (obj == null)
{
! obj = generate();
}
return obj;
--- 31,35 ----
if (obj == null)
{
! generate();
}
return obj;
***************
*** 44,70 ****
}
! protected virtual object generate()
{
! ClassGenerator cg = createClassGenerator();
! return cg.Generate(type, this, ignore);
}
! protected virtual ClassGenerator createClassGenerator()
! {
! return new ClassGenerator();
! }
!
! protected override IMethod getMethod(string methodName)
{
! checkMethodIsValid(methodName);
! return base.getMethod(methodName);
}
! public override void SetupResult(string methodName, object returnVal)
{
! checkMethodIsValid(methodName);
checkReturnTypeIsValid(methodName, returnVal);
! base.SetupResult(methodName, returnVal);
}
--- 45,66 ----
}
! private void generate()
{
! ClassGenerator cg = new ClassGenerator();
! obj = cg.Generate(type, this, ignore);
}
! protected override IMethod getMethod(string methodName, Type[] argTypes)
{
! checkMethodIsValidIfNoConstraints(methodName, argTypes);
! return base.getMethod(methodName, argTypes);
}
! public override void SetupResult(string methodName, object returnVal, params Type[] argTypes)
{
! checkMethodIsValidIfNoConstraints(methodName, argTypes);
checkReturnTypeIsValid(methodName, returnVal);
! base.SetupResult(methodName, returnVal, argTypes);
}
***************
*** 98,108 ****
}
! void checkMethodIsValid(string methodName)
{
!
Type[] allTypes = new InterfaceLister().List(type);
foreach (Type t in allTypes)
{
! MethodInfo method = t.GetMethod(methodName, ClassGenerator.ALL_INSTANCE_METHODS);
PropertyInfo property = t.GetProperty(methodName, ClassGenerator.ALL_INSTANCE_METHODS);
if (property != null)
--- 94,109 ----
}
! void checkMethodIsValidIfNoConstraints(string methodName, Type[] argTypes)
{
! foreach(Type argType in argTypes)
! {
! if(typeof(IConstraint).IsAssignableFrom(argType)) return;
! }
!
Type[] allTypes = new InterfaceLister().List(type);
foreach (Type t in allTypes)
{
! MethodInfo method = t.GetMethod(methodName, ClassGenerator.ALL_INSTANCE_METHODS, null,
! argTypes, null);
PropertyInfo property = t.GetProperty(methodName, ClassGenerator.ALL_INSTANCE_METHODS);
if (property != null)
Index: MockCall.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/MockCall.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MockCall.cs 31 Dec 2002 21:36:39 -0000 1.2
--- MockCall.cs 24 Jul 2003 23:08:42 -0000 1.3
***************
*** 6,9 ****
--- 6,10 ----
public class MockCall
{
+ protected Type[] argTypes;
private IConstraint[] expectedArgs;
private object returnValue;
***************
*** 12,15 ****
--- 13,17 ----
public MockCall(object returnValue, Exception e, object[] expectedArgs)
{
+ this.argTypes = argsAsTypes(expectedArgs);
this.expectedArgs = argsAsConstraints(expectedArgs);
this.returnValue = returnValue;
***************
*** 22,25 ****
--- 24,40 ----
}
+ public Type[] ArgTypes
+ {
+ get
+ {
+ return argTypes;
+ }
+ }
+
+ private Type[] argsAsTypes(object[] args)
+ {
+ return MockCall.GetArgTypes(args);
+ }
+
private IConstraint[] argsAsConstraints(object[] args)
{
***************
*** 82,91 ****
}
}
}
public class MockNoCall : MockCall
{
! public MockNoCall() : base(null, null, null)
{
}
--- 97,130 ----
}
}
+
+ public static Type[] GetArgTypes(object[] args)
+ {
+ if (null == args)
+ {
+ return new Type[0];
+ }
+
+ Type[] result = new Type[args.Length];
+ for (int i = 0; i < result.Length; ++i)
+ {
+ if (args[i] == null)
+ {
+ result[i] = typeof(object);
+ }
+ else
+ {
+ result[i] = args[i].GetType();
+ }
+ }
+
+ return result;
+ }
}
public class MockNoCall : MockCall
{
! public MockNoCall(Type[] argTypes) : base(null, null, null)
{
+ this.argTypes = argTypes;
}
Index: SingleMethod.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/SingleMethod.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SingleMethod.cs 13 Mar 2003 22:22:12 -0000 1.1
--- SingleMethod.cs 24 Jul 2003 23:08:42 -0000 1.2
***************
*** 3,6 ****
--- 3,7 ----
namespace NMock
{
+ //TODO: should be renamed to CallMethodAtLeastOnce
public class SingleMethod : IMethod
{
|
|
From: <sm...@us...> - 2003-07-24 23:08:45
|
Update of /cvsroot/nmock/nmock/src/NMock/Constraints
In directory sc8-pr-cvs1:/tmp/cvs-serv24022/src/NMock/Constraints
Modified Files:
Constraints.cs
Log Message:
Index: Constraints.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Constraints/Constraints.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Constraints.cs 10 Feb 2003 13:26:17 -0000 1.6
--- Constraints.cs 24 Jul 2003 23:08:42 -0000 1.7
***************
*** 3,6 ****
--- 3,7 ----
using System.Text.RegularExpressions;
using System.Reflection;
+ using System.Collections;
namespace NMock.Constraints
***************
*** 105,109 ****
public override bool Eval(object val)
{
! return compare.Equals(ExtractActualValue(val));
}
--- 106,127 ----
public override bool Eval(object val)
{
! if ((val != null) && (val.GetType().IsArray) && (compare.GetType().IsArray))
! {
! return ArrayCompare((System.Array)val, (System.Array)compare);
! }
! else
! {
! return compare.Equals(ExtractActualValue(val));
! }
! }
!
! private bool ArrayCompare(System.Array a1, System.Array a2)
! {
! if(a1.Length != a2.Length) return false;
! for(int i=0; i < a1.Length; i++)
! {
! if(!a1.GetValue(i).Equals(a2.GetValue(i))) return false;
! }
! return true;
}
***************
*** 373,376 ****
--- 391,415 ----
{
get { return "<" + expected + ">"; }
+ }
+ }
+
+ public class StartsWith : BaseConstraint
+ {
+
+ private string expected;
+
+ public StartsWith(string startsWithPattern)
+ {
+ this.expected = startsWithPattern;
+ }
+
+ public override bool Eval(object val)
+ {
+ return ((string)val).StartsWith(expected);
+ }
+
+ public override string Message
+ {
+ get { return "StartsWith<" + expected + ">"; }
}
}
|
|
From: <sm...@us...> - 2003-07-24 23:08:45
|
Update of /cvsroot/nmock/nmock/src/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv24022/src/NMock/Dynamic
Modified Files:
ClassGenerator.cs
Log Message:
Index: ClassGenerator.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/src/NMock/Dynamic/ClassGenerator.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ClassGenerator.cs 13 Jul 2003 13:27:06 -0000 1.12
--- ClassGenerator.cs 24 Jul 2003 23:08:42 -0000 1.13
***************
*** 53,67 ****
AssemblyBuilder assemblyBuilder = appDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("MockModule");
! return moduleBuilder.DefineType(name, TypeAttributes.Public, getSuperClass(originalType), getInterfaces(originalType));
! }
!
! protected virtual Type getSuperClass(Type originalType)
! {
! return (originalType.IsInterface) ? null : originalType;
! }
!
! protected virtual Type[] getInterfaces(Type originalType)
! {
! return (originalType.IsInterface) ? new Type[] { originalType } : new Type[0];
}
--- 53,69 ----
AssemblyBuilder assemblyBuilder = appDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("MockModule");
! Type superClass;
! Type[] interfaces;
! if (originalType.IsInterface)
! {
! superClass = null;
! interfaces = new Type[] {originalType};
! }
! else
! {
! superClass = originalType;
! interfaces = new Type[0];
! }
! return moduleBuilder.DefineType(name, TypeAttributes.Public, superClass, interfaces);
}
***************
*** 123,127 ****
private void EmitMethodSignature(MethodInfo methodInfo, Type[] paramTypes, ILGenerator il)
{
! il.DeclareLocal( typeof(object) );
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Ldfld, mockFieldBuilder);
--- 125,133 ----
private void EmitMethodSignature(MethodInfo methodInfo, Type[] paramTypes, ILGenerator il)
{
! foreach (Type paramType in paramTypes)
! {
! il.DeclareLocal(paramType);
! }
!
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Ldfld, mockFieldBuilder);
***************
*** 169,177 ****
}
il.DeclareLocal(returnType);
! il.Emit(OpCodes.Stloc_1);
Label l = il.DefineLabel();
il.Emit(OpCodes.Br_S, l);
il.MarkLabel(l);
! il.Emit(OpCodes.Ldloc_1);
}
il.Emit(OpCodes.Ret);
--- 175,183 ----
}
il.DeclareLocal(returnType);
! il.Emit(OpCodes.Stloc_0);
Label l = il.DefineLabel();
il.Emit(OpCodes.Br_S, l);
il.MarkLabel(l);
! il.Emit(OpCodes.Ldloc_0);
}
il.Emit(OpCodes.Ret);
|
|
From: <sm...@us...> - 2003-07-24 23:08:32
|
Update of /cvsroot/nmock/nmock/sample
In directory sc8-pr-cvs1:/tmp/cvs-serv23904/sample
Added Files:
sample.csproj
Log Message:
--- NEW FILE: sample.csproj ---
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{77AB0622-D9F4-4D60-9A13-73703FE41788}"
SccProjectName = "Perforce Project"
SccLocalPath = "."
SccProvider = "MSSCCI:Perforce SCM"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "sample"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "sample"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
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"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "..\..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "..\..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "..\..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "src"
Project = "{4859B9E5-3F65-4517-878C-AFC58B9D0035}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "System.Web"
AssemblyName = "System.Web"
HintPath = "..\..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Web.dll"
/>
<Reference
Name = "nunit.framework"
AssemblyName = "nunit.framework"
HintPath = "..\lib\nunit.framework.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "order\Notifier.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "order\Order.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "order\OrderProcessor.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "order\OrderProcessorTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "random\Weather.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "random\WeatherTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
|
|
From: Vaughn, C. <Va...@va...> - 2003-07-22 12:49:33
|
Thanx Joe,
I've been hacking at it, but my change required using the "get_/set_"
prefix. I've discovered some more things and I've hacked the code to try to
address them. Here are both the tests and the hacked code. I'm sure you'll
discover other bugs as I did when I tried to get this to work. One is in
MockCall.checkArguments. Your HasExpectations is only true if you expect
args. This is bad if you're testing a function with no args. If you have
any questions on anything, just let me know.
cliff
cliff
-----Original Message-----
From: Joe Walnes [mailto:jo...@tr...]
Sent: Tuesday, July 22, 2003 4:16 AM
To: Vaughn, Clifton
Cc: 'Nmo...@li...'
Subject: Re: [Nmock-general] properties
Cliff,
This is an awkward little bug you've discovered. It's caused by the fact
that NMock has no support for overloads and treats the following two
methods as the same:
void Name(string name);
String Name();
I shall try to get a fix together asap.
Thanks
-Joe
Vaughn, Clifton wrote:
>Hello all,
>
>Any reason why this test doesn't pass? I think it should.
>
>
> public interface IFoo
> {
> string Name { get; set; }
> }
>
> public void TestInit()
> {
> DynamicMock foo = new DynamicMock( typeof( IFoo ) );
> IFoo ifoo = ((IFoo)foo.MockInstance);
> foo.SetupResult( "Name", "bob" );
> foo.Expect( "Name", "bill" );
>
> System.Diagnostics.Debug.Write( ifoo.Name );
> ifoo.Name = "bill";
> foo.Verify();
> }
>
>cliff
>
>This message may have included proprietary or protected information. This
>message and the information contained herein are not to be further
>communicated without my express written consent.
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: VM Ware
>With VMware you can run multiple operating systems on a single machine.
>WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
>same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
>_______________________________________________
>Nmock-general mailing list
>Nmo...@li...
>https://lists.sourceforge.net/lists/listinfo/nmock-general
>
>
|
|
From: Joe W. <jo...@tr...> - 2003-07-22 08:15:59
|
Cliff,
This is an awkward little bug you've discovered. It's caused by the fact
that NMock has no support for overloads and treats the following two
methods as the same:
void Name(string name);
String Name();
I shall try to get a fix together asap.
Thanks
-Joe
Vaughn, Clifton wrote:
>Hello all,
>
>Any reason why this test doesn't pass? I think it should.
>
>
> public interface IFoo
> {
> string Name { get; set; }
> }
>
> public void TestInit()
> {
> DynamicMock foo = new DynamicMock( typeof( IFoo ) );
> IFoo ifoo = ((IFoo)foo.MockInstance);
> foo.SetupResult( "Name", "bob" );
> foo.Expect( "Name", "bill" );
>
> System.Diagnostics.Debug.Write( ifoo.Name );
> ifoo.Name = "bill";
> foo.Verify();
> }
>
>cliff
>
>This message may have included proprietary or protected information. This
>message and the information contained herein are not to be further
>communicated without my express written consent.
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: VM Ware
>With VMware you can run multiple operating systems on a single machine.
>WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
>same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
>_______________________________________________
>Nmock-general mailing list
>Nmo...@li...
>https://lists.sourceforge.net/lists/listinfo/nmock-general
>
>
|
|
From: Vaughn, C. <Va...@va...> - 2003-07-21 16:42:41
|
Hello all,
Any reason why this test doesn't pass? I think it should.
public interface IFoo
{
string Name { get; set; }
}
public void TestInit()
{
DynamicMock foo = new DynamicMock( typeof( IFoo ) );
IFoo ifoo = ((IFoo)foo.MockInstance);
foo.SetupResult( "Name", "bob" );
foo.Expect( "Name", "bill" );
System.Diagnostics.Debug.Write( ifoo.Name );
ifoo.Name = "bill";
foo.Verify();
}
cliff
This message may have included proprietary or protected information. This
message and the information contained herein are not to be further
communicated without my express written consent.
|
|
From: <sm...@us...> - 2003-07-20 20:33:30
|
Update of /cvsroot/nmock/nmock/src/NMock/Constraints In directory sc8-pr-cvs1:/tmp/cvs-serv32741/src/NMock/Constraints Modified Files: IConstraint.cs Log Message: *** keyword substitution change *** Index: IConstraint.cs =================================================================== RCS file: /cvsroot/nmock/nmock/src/NMock/Constraints/IConstraint.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 |
|
From: Steve F. <st...@m3...> - 2003-07-17 21:17:43
|
Owen Rogers wrote: > the scenario for using a remotable mock is when writing the stub code > to communicate with a remote server. it enables you to mock out the > behaviour of the server without needing to hit the server. you can > verify that the data passed back and forth can be correctly > marshalled, that your remoting configuration is being properly > loaded, and that (when you use RemotingConfiguration) you are > actually hitting the remote instance -- not simply a local instance. This is the sort of thing we tried to avoid in the old days on the grounds that we didn't want unit tests to check the platform (marshalling) or configuration. Now we've suffered so much pain from configuration issues, maybe we should change our tune, as long as the test is really meaningful. If you're in the same building, it might be worth slogging the issue out with TimM. S. |
|
From: Owen R. <OR...@th...> - 2003-07-15 20:23:28
|
> Looks cool, but I think I'm missing something. Can you give me a > scenario of when it would be preferable to host a mock in a remote > server? the scenario for using a remotable mock is when writing the stub code to communicate with a remote server. it enables you to mock out the behaviour of the server without needing to hit the server. you can verify that the data passed back and forth can be correctly marshalled, that your remoting configuration is being properly loaded, and that (when you use RemotingConfiguration) you are actually hitting the remote instance -- not simply a local instance. > One of the reasons we started mocks in the first > place was to get away from testing against servers -- just > too many failure modes. it's hard to see what the failure modes are? the mock server is hosted locally. you are simply opening sockets on the local machine and passing data back and forth. if this doesn't work on your development/integration machine then there is probably something wrong with your environment. i can see the concern if the server is remote or requires installing and configuring some external bit of software. part of the reason that i really like it is that it enables you to simulate and test your failure modes: what happens if the server throws this exception from this method. oh ok, let me write some code to handle that. > Would this be better as an extension to a core library? this depends on how you define an extension. the code is located in a separate folder/namespace (NMock.Remoting). i think that this is a reasonable location for it. it has no impact on existing nmock users and it introduces no new dependencies into the nmock assemblies. i can't see any criticism of including it, unless you think that it is somehow polluting the core intentions of the library. o. --- R. Owen Rogers ThoughtWorks Ltd Peek House 20, Eastcheap London EC3M 1EB tel: +44 (0) 207 090 7400 mobile: +44 (0) 787 673 8898 ThoughtWorks - Deliver with passion! |---------+-----------------------------------------> | | Steve Freeman | | | <st...@m3...> | | | Sent by: | | | nmo...@li...| | | ceforge.net | | | | | | | | | 07/13/2003 08:26 PM | |---------+-----------------------------------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| | | | To: Joe Walnes <jo...@tr...> | | cc: Owen Rogers <OR...@th...>, nmo...@li... | | Subject: Re: [Nmock-general] remotable mocks | >--------------------------------------------------------------------------------------------------------------------------------------------------| I'm also concerned. One of the reasons we started mocks in the first place was to get away from testing against servers -- just too many failure modes. Would this be better as an extension to a core library? S. Joe Walnes wrote: > Looks cool, but I think I'm missing something. Can you give me a > scenario of when it would be preferable to host a mock in a remote server? ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps1 _______________________________________________ Nmock-general mailing list Nmo...@li... https://lists.sourceforge.net/lists/listinfo/nmock-general |
|
From: <sm...@us...> - 2003-07-13 21:36:11
|
Update of /cvsroot/nmock/nmock/test In directory sc8-pr-cvs1:/tmp/cvs-serv29148/test Modified Files: .cvsignore Log Message: updated .cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/nmock/nmock/test/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 14 Jun 2003 23:30:18 -0000 1.1 --- .cvsignore 13 Jul 2003 21:36:07 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- bin obj + test.csproj.user |
|
From: <sm...@us...> - 2003-07-13 21:36:10
|
Update of /cvsroot/nmock/nmock/src In directory sc8-pr-cvs1:/tmp/cvs-serv29148/src Modified Files: .cvsignore Log Message: updated .cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/nmock/nmock/src/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 14 Jun 2003 23:29:49 -0000 1.1 --- .cvsignore 13 Jul 2003 21:36:07 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- bin obj + src.csproj.user |
|
From: Steve F. <st...@m3...> - 2003-07-13 19:26:38
|
I'm also concerned. One of the reasons we started mocks in the first place was to get away from testing against servers -- just too many failure modes. Would this be better as an extension to a core library? S. Joe Walnes wrote: > Looks cool, but I think I'm missing something. Can you give me a > scenario of when it would be preferable to host a mock in a remote server? |
|
From: Joe W. <jo...@tr...> - 2003-07-13 16:12:34
|
Looks cool, but I think I'm missing something. Can you give me a
scenario of when it would be preferable to host a mock in a remote server?
-joe
Owen Rogers wrote:
>
>
>as i've been doing a bunch of work lately with remoting, i wanted a way to
>test my remotable interfaces and the code that called them. to facilitate
>this, i've augmented nmock to serve remotable mocks. this basically
>entails two things:
>1) generating dynamic mocks that extend MarshalByRef so that they can be
>serialised and proxy'ed.
>2) providing a simple server to host the mocks
>
>here's a sample test to show you how it works:
>
> [Test]
> public void MarshalRemotingMock()
> {
> RemotingMock mock = new RemotingMock(typeof(Foo));
> mock.Expect("Bar");
>
> TcpChannel channel = new TcpChannel(1234);
> using (MockServer server = new
>MockServer(mock.MarshalByRefInstance, channel, "mock.rem"))
> {
> Foo foo =
>(Foo)RemotingServices.Connect(typeof(Foo),
>"tcp://localhost:1234/mock.rem");
> foo.Bar();
> }
>
> mock.Verify();
> }
>
> interface Foo
> {
> void Bar();
> }
>
>- as you can see, #1 is accomplished by creating a new instance of
>RemotingMock and passing in the type to mock (done in a similar fashion to
>working with DynamicMock).
>- for #2, create an instance of a MockServer (in a using block). the mock
>server will install your remotable mock on the specified channel and uri.
>- next, you can retrieve a proxy of your mock using RemotingServices and
>invoke methods on it to your mocking-hearts' content.
>simple, yet very powerful IMO!
>
>here's another example from the CC.NET source:
>
> [Test]
> public void SendScheduleToCruiseManager()
> {
> CollectingConstraint projectNameConstraint = new
>CollectingConstraint();
> CollectingConstraint scheduleConstraint = new
>CollectingConstraint();
> RemotingMock cc = new RemotingMock(typeof
>(ICruiseManager));
> cc.Expect("Run", projectNameConstraint,
>scheduleConstraint);
>
> TcpChannel channel = new TcpChannel(2334);
> using (MockServer server = new
>MockServer(cc.MarshalByRefInstance, channel, "MockCruise.rem"))
> {
> Runner runner = new Runner();
> runner.Url = "tcp://localhost:2334/MockCruise.rem";
> runner.Run("myProject");
> }
>
> AssertEquals("myProject",
>projectNameConstraint.Parameter);
> AssertEquals(new Schedule(),
>scheduleConstraint.Parameter);
> cc.Verify();
> }
>
>thoughts? comments?
>cheers,
>owen.
>
>---
>R. Owen Rogers
>ThoughtWorks Ltd
>
>ThoughtWorks - Deliver with passion!
>
>
>
>-------------------------------------------------------
>This SF.Net email sponsored by: Parasoft
>Error proof Web apps, automate testing & more.
>Download & eval WebKing and get a free book.
>www.parasoft.com/bulletproofapps1
>_______________________________________________
>Nmock-general mailing list
>Nmo...@li...
>https://lists.sourceforge.net/lists/listinfo/nmock-general
>
>
|
|
From: Owen R. <OR...@th...> - 2003-07-13 13:46:33
|
as i've been doing a bunch of work lately with remoting, i wanted a way to
test my remotable interfaces and the code that called them. to facilitate
this, i've augmented nmock to serve remotable mocks. this basically
entails two things:
1) generating dynamic mocks that extend MarshalByRef so that they can be
serialised and proxy'ed.
2) providing a simple server to host the mocks
here's a sample test to show you how it works:
[Test]
public void MarshalRemotingMock()
{
RemotingMock mock = new RemotingMock(typeof(Foo));
mock.Expect("Bar");
TcpChannel channel = new TcpChannel(1234);
using (MockServer server = new
MockServer(mock.MarshalByRefInstance, channel, "mock.rem"))
{
Foo foo =
(Foo)RemotingServices.Connect(typeof(Foo),
"tcp://localhost:1234/mock.rem");
foo.Bar();
}
mock.Verify();
}
interface Foo
{
void Bar();
}
- as you can see, #1 is accomplished by creating a new instance of
RemotingMock and passing in the type to mock (done in a similar fashion to
working with DynamicMock).
- for #2, create an instance of a MockServer (in a using block). the mock
server will install your remotable mock on the specified channel and uri.
- next, you can retrieve a proxy of your mock using RemotingServices and
invoke methods on it to your mocking-hearts' content.
simple, yet very powerful IMO!
here's another example from the CC.NET source:
[Test]
public void SendScheduleToCruiseManager()
{
CollectingConstraint projectNameConstraint = new
CollectingConstraint();
CollectingConstraint scheduleConstraint = new
CollectingConstraint();
RemotingMock cc = new RemotingMock(typeof
(ICruiseManager));
cc.Expect("Run", projectNameConstraint,
scheduleConstraint);
TcpChannel channel = new TcpChannel(2334);
using (MockServer server = new
MockServer(cc.MarshalByRefInstance, channel, "MockCruise.rem"))
{
Runner runner = new Runner();
runner.Url = "tcp://localhost:2334/MockCruise.rem";
runner.Run("myProject");
}
AssertEquals("myProject",
projectNameConstraint.Parameter);
AssertEquals(new Schedule(),
scheduleConstraint.Parameter);
cc.Verify();
}
thoughts? comments?
cheers,
owen.
---
R. Owen Rogers
ThoughtWorks Ltd
ThoughtWorks - Deliver with passion!
|