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
(52) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Michael M. <mg...@us...> - 2006-02-03 17:08:29
|
Update of /cvsroot/nmock/nmock2/src/NMock2.AcceptanceTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28182/src/NMock2.AcceptanceTests Added Files: MockeryAcceptanceTest.cs Log Message: Add forgotten file. --- NEW FILE: MockeryAcceptanceTest.cs --- using NUnit.Framework; using System; namespace NMock2.AcceptanceTests { [TestFixture] public class MockeryAcceptanceTest { [Test] public void CallingVerifyOnMockeryShouldEnableMockeryToBeUsedSuccessfullyForOtherTests() { Mockery mocks = new Mockery(); IKissable kissableWithUninvokedExpectations = (IKissable) mocks.NewMock(typeof(IKissable)); Expect.Once.On(kissableWithUninvokedExpectations).Method("Kiss").With("a frog"); try { mocks.VerifyAllExpectationsHaveBeenMet(); Assert.Fail("Expected ExpectationException to be thrown"); } catch(NMock2.Internal.ExpectationException expected) { Assert.IsTrue(expected.Message.IndexOf("not all expected invocations were performed") != -1); } IKissable kissableWithInvokedExpectations = (IKissable) mocks.NewMock(typeof(IKissable)); Expect.Once.On(kissableWithInvokedExpectations).Method("Kiss").With("a prince"); kissableWithInvokedExpectations.Kiss("a prince"); mocks.VerifyAllExpectationsHaveBeenMet(); } } public interface IKissable { void Kiss(object o); } } |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:58:30
|
Update of /cvsroot/nmock/nmock2/tools/lib/net/1.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30963/tools/lib/net/1.1 Added Files: NDoc.Core.dll NDoc.Documenter.Msdn.dll NDoc.ExtendedUI.dll nunit.core.dll nunit.framework.dll nunit.util.dll Log Message: Rename build file to nmock2.build, add cruise target, add Nant so Cruise can build the project. --- NEW FILE: NDoc.Documenter.Msdn.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: nunit.core.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: nunit.util.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NDoc.ExtendedUI.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: Michael M. <mg...@us...> - 2006-02-02 22:58:30
|
Update of /cvsroot/nmock/nmock2/tools/lib/net/2.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30963/tools/lib/net/2.0 Added Files: NDoc.Core.dll NDoc.Documenter.Msdn.dll NDoc.ExtendedUI.dll nunit.core.dll nunit.framework.dll nunit.util.dll Log Message: Rename build file to nmock2.build, add cruise target, add Nant so Cruise can build the project. --- NEW FILE: NDoc.Documenter.Msdn.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: nunit.core.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: nunit.util.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NDoc.ExtendedUI.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: Michael M. <mg...@us...> - 2006-02-02 22:58:30
|
Update of /cvsroot/nmock/nmock2/tools/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30963/tools/lib Added Files: ICSharpCode.SharpCvsLib.Console.dll ICSharpCode.SharpCvsLib.dll ICSharpCode.SharpZipLib.dll NUnitCore.dll Log Message: Rename build file to nmock2.build, add cruise target, add Nant so Cruise can build the project. --- NEW FILE: ICSharpCode.SharpCvsLib.Console.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ICSharpCode.SharpZipLib.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: ICSharpCode.SharpCvsLib.dll --- (This appears to be a binary file; contents omitted.) |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:58:30
|
Update of /cvsroot/nmock/nmock2/tools/lib/net/1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30963/tools/lib/net/1.0 Added Files: NDoc.Core.dll NDoc.Documenter.Msdn.dll NDoc.ExtendedUI.dll nunit.core.dll nunit.framework.dll nunit.util.dll Log Message: Rename build file to nmock2.build, add cruise target, add Nant so Cruise can build the project. --- NEW FILE: NDoc.Documenter.Msdn.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: nunit.core.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: nunit.util.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NDoc.ExtendedUI.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: Michael M. <mg...@us...> - 2006-02-02 22:58:30
|
Update of /cvsroot/nmock/nmock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30963 Added Files: nmock2.build Removed Files: nant.build Log Message: Rename build file to nmock2.build, add cruise target, add Nant so Cruise can build the project. --- NEW FILE: nmock2.build --- <project name="NMock2" default="all"> <property name="configuration" value="Debug"/> <target name="clean" description="Delete all previously compiled binaries."> <delete> <fileset> <include name="build/**" /> <include name="**/obj/**" /> </fileset> </delete> </target> <target name="all" depends="clean, build, test" description="Build and run tests" /> <target name="cruise" depends="for-1.1, clean, build, test, dist, dist.publish" description="CruiseControl build target" /> <target name="build" description="Build all targets."> <solution configuration="${configuration}" solutionfile="NMock2.sln" /> <property name="expected.output" value="build/NMock2/${configuration}/NMock2.dll"/> <fail unless="${file::exists(expected.output)}">Output file doesn't exist in ${expected.output}</fail> </target> <target name="test" description="Run tests" depends="build"> <nunit2> <formatter type="Plain" /> <formatter type="Xml" usefile="true" extension=".xml" outputdir="build/testresults" /> <test> <assemblies> <include name="build/**/*Test*.dll" /> </assemblies> </test> </nunit2> </target> <target name="dist" depends="build, test" description="Build distribution"> <mkdir dir="dist" /> <zip zipfile="dist/nmock2-${nant.settings.currentframework}.zip" ziplevel="9"> <fileset basedir="build/NMock2/Debug" prefix="bin"> <include name="*.dll" /> <include name="*.pdb" /> </fileset> <fileset basedir="doc" prefix="doc"> <include name="**/*" /> </fileset> </zip> </target> <target name="dist.publish"> <if test="${property::exists('CCNetLabel')}"> <property name="publish.dir" value="e:\download-area\NMock2-Builds\${CCNetLabel}" /> <mkdir dir="${publish.dir}" /> <copy todir="${publish.dir}"> <fileset basedir="dist"> <include name="*"/> </fileset> </copy> </if> </target> <target name="for-1.1" depends="set-net-1.1-framework-configuration" description="Use version 1.1 of the .NET framework"> <echo>Using .NET 1.1 framework</echo> </target> <target name="for-2.0" depends="set-net-2.0-framework-configuration" description="Use version 2.0 of the .NET framework"> <echo>Using .NET 2.0 framework</echo> </target> <target name="set-net-1.1-framework-configuration"> <property name="nant.settings.currentframework" value="net-1.1" /> <property name="current.build.defines" value="${build.defines}NET,NET_1_1" dynamic="true" /> <property name="link.sdkdoc.version" value="SDK_v1_1" /> <property name="link.sdkdoc.web" value="true" /> </target> <target name="set-net-2.0-framework-configuration"> <property name="nant.settings.currentframework" value="net-2.0" /> <property name="current.build.defines" value="${build.defines}NET,NET_2_0" dynamic="true" /> <property name="link.sdkdoc.version" value="SDK_v1_1" /> <property name="link.sdkdoc.web" value="true" /> </target> </project> --- nant.build DELETED --- |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:58:29
|
Update of /cvsroot/nmock/nmock2/tools/lib/mono/1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30963/tools/lib/mono/1.0 Added Files: NDoc.Core.dll NDoc.Documenter.Msdn.dll NDoc.ExtendedUI.dll nunit.core.dll nunit.framework.dll nunit.util.dll Log Message: Rename build file to nmock2.build, add cruise target, add Nant so Cruise can build the project. --- NEW FILE: NDoc.Documenter.Msdn.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: nunit.core.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: nunit.util.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NDoc.ExtendedUI.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: Michael M. <mg...@us...> - 2006-02-02 22:58:29
|
Update of /cvsroot/nmock/nmock2/tools/lib/mono/2.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30963/tools/lib/mono/2.0 Added Files: NDoc.Core.dll NDoc.Documenter.Msdn.dll NDoc.ExtendedUI.dll nunit.core.dll nunit.framework.dll nunit.util.dll Log Message: Rename build file to nmock2.build, add cruise target, add Nant so Cruise can build the project. --- NEW FILE: NDoc.Documenter.Msdn.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: nunit.core.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: nunit.util.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NDoc.ExtendedUI.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: Michael M. <mg...@us...> - 2006-02-02 22:56:29
|
Update of /cvsroot/nmock/nmock2/tools/lib/net/1.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30463/1.1 Log Message: Directory /cvsroot/nmock/nmock2/tools/lib/net/1.1 added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:29
|
Update of /cvsroot/nmock/nmock2/tools/lib/net/2.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30463/2.0 Log Message: Directory /cvsroot/nmock/nmock2/tools/lib/net/2.0 added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:28
|
Update of /cvsroot/nmock/nmock2/tools/lib/net/1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30463/1.0 Log Message: Directory /cvsroot/nmock/nmock2/tools/lib/net/1.0 added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:20
|
Update of /cvsroot/nmock/nmock2/tools/lib/net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30207/net Log Message: Directory /cvsroot/nmock/nmock2/tools/lib/net added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:20
|
Update of /cvsroot/nmock/nmock2/tools/lib/mono/1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30382/1.0 Log Message: Directory /cvsroot/nmock/nmock2/tools/lib/mono/1.0 added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:20
|
Update of /cvsroot/nmock/nmock2/tools/lib/mono/2.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30382/2.0 Log Message: Directory /cvsroot/nmock/nmock2/tools/lib/mono/2.0 added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:13
|
Update of /cvsroot/nmock/nmock2/tools/lib/mono In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30207/mono Log Message: Directory /cvsroot/nmock/nmock2/tools/lib/mono added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:05
|
Update of /cvsroot/nmock/nmock2/tools/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30149/lib Log Message: Directory /cvsroot/nmock/nmock2/tools/lib added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:56:01
|
Update of /cvsroot/nmock/nmock2/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30124/tools Log Message: Directory /cvsroot/nmock/nmock2/tools added to the repository |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:37:49
|
Update of /cvsroot/nmock/nmock2/src/NMock2.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23654/src/NMock2.Test Modified Files: MockeryTest.cs Log Message: Fix "recycling" of Mockery after Verify(). If someone mistakenly doesn't create a new mockery in their SetUp() method, old expectations won't pollute the next test. Index: MockeryTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.Test/MockeryTest.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MockeryTest.cs 27 Sep 2005 18:57:38 -0000 1.5 --- MockeryTest.cs 2 Feb 2006 22:37:41 -0000 1.6 *************** *** 1,4 **** ! #undef NET20 ! using System; using System.IO; using System.Reflection; using NUnit.Framework; using NMock2.Internal; using NMock2.Monitoring; namespace NMock2.Test --- 1,8 ---- ! using System; ! using System.IO; ! using System.Reflection; ! using NUnit.Framework; ! using NMock2.Internal; ! using NMock2.Monitoring; namespace NMock2.Test *************** *** 25,28 **** --- 29,35 ---- private Mockery mockery; + IMockedType mock; + MockExpectation expectation1; + MockExpectation expectation2; [SetUp] *************** *** 30,35 **** --- 37,53 ---- { mockery = new Mockery(); + mock = (IMockedType)mockery.NewMock(typeof(IMockedType), "mock"); + + expectation1 = new MockExpectation(); + expectation2 = new MockExpectation(); } + private void AddExpectationsToMockery() + { + IMockObject mockObjectControl = (IMockObject)mock; + mockObjectControl.AddExpectation(expectation1); + mockObjectControl.AddExpectation(expectation2); + } + [Test] public void CreatesMocksThatCanBeCastToMockedType() *************** *** 45,48 **** --- 63,67 ---- { IMockedType mock = mockery.NewMock<IMockedType>(); + Console.WriteLine("NET20 test ran"); } #endif *************** *** 96,122 **** public void DispatchesInvocationBySearchingForMatchingExpectationInOrderOfAddition() { ! IMockedType mock = (IMockedType)mockery.NewMock(typeof(IMockedType), "mock"); ! IMockObject mockObjectControl = (IMockObject)mock; ! ! MockExpectation e1 = new MockExpectation(); ! MockExpectation e2 = new MockExpectation(); ! mockObjectControl.AddExpectation(e1); ! mockObjectControl.AddExpectation(e2); ! e2.Previous = e1; ! e1.ExpectedInvokedObject = e2.ExpectedInvokedObject = mock; ! e1.ExpectedInvokedMethod = e2.ExpectedInvokedMethod = typeof(IMockedType).GetMethod("DoStuff", new Type[0]); ! e1.Matches_Result = false; ! e2.Matches_Result = true; mock.DoStuff(); ! Assert.IsTrue(e1.Matches_HasBeenCalled, "should have tried to match e1"); ! Assert.IsFalse(e1.Perform_HasBeenCalled, "should not have performed e1"); ! Assert.IsTrue(e2.Matches_HasBeenCalled, "should have tried to match e2"); ! Assert.IsTrue(e2.Perform_HasBeenCalled, "should have performed e2"); } --- 115,135 ---- public void DispatchesInvocationBySearchingForMatchingExpectationInOrderOfAddition() { ! AddExpectationsToMockery(); ! expectation2.Previous = expectation1; ! expectation1.ExpectedInvokedObject = expectation2.ExpectedInvokedObject = mock; ! expectation1.ExpectedInvokedMethod = expectation2.ExpectedInvokedMethod = typeof(IMockedType).GetMethod("DoStuff", new Type[0]); ! expectation1.Matches_Result = false; ! expectation2.Matches_Result = true; mock.DoStuff(); ! Assert.IsTrue(expectation1.Matches_HasBeenCalled, "should have tried to match expectation1"); ! Assert.IsFalse(expectation1.Perform_HasBeenCalled, "should not have performed expectation1"); ! Assert.IsTrue(expectation2.Matches_HasBeenCalled, "should have tried to match expectation2"); ! Assert.IsTrue(expectation2.Perform_HasBeenCalled, "should have performed expectation2"); } *************** *** 124,221 **** public void StopsSearchingForMatchingExpectationAsSoonAsOneMatches() { ! IMockedType mock = (IMockedType)mockery.NewMock(typeof(IMockedType), "mock"); ! IMockObject mockObjectControl = (IMockObject)mock; ! ! MockExpectation e1 = new MockExpectation(); ! MockExpectation e2 = new MockExpectation(); ! ! mockObjectControl.AddExpectation(e1); ! mockObjectControl.AddExpectation(e2); ! ! e2.Previous = e1; ! e1.ExpectedInvokedObject = e2.ExpectedInvokedObject = mock; ! e1.ExpectedInvokedMethod = e2.ExpectedInvokedMethod = typeof(IMockedType).GetMethod("DoStuff", new Type[0]); ! e1.Matches_Result = true; mock.DoStuff(); ! Assert.IsTrue(e1.Matches_HasBeenCalled, "should have tried to match e1"); ! Assert.IsTrue(e1.Perform_HasBeenCalled, "should have performed e1"); ! Assert.IsFalse(e2.Matches_HasBeenCalled, "should not have tried to match e2"); ! Assert.IsFalse(e2.Perform_HasBeenCalled, "should not have performed e2"); } ! [Test] public void FailsTestIfNoExpectationsMatch() { ! IMockedType mock = (IMockedType)mockery.NewMock(typeof(IMockedType), "mock"); ! IMockObject mockObjectControl = (IMockObject)mock; ! ! MockExpectation e1 = new MockExpectation(); ! MockExpectation e2 = new MockExpectation(); ! ! mockObjectControl.AddExpectation(e1); ! mockObjectControl.AddExpectation(e2); ! ! e1.Matches_Result = false; ! e2.Matches_Result = false; ! ! try ! { ! mock.DoStuff(); ! } ! catch (ExpectationException) ! { ! return; ! } ! Assert.Fail("expected ExpectationException"); } [Test] ! public void VerifiesThatAllExpectationsHaveBeenMet() { ! bool assertionFailed; ! ! IMockedType mock = (IMockedType)mockery.NewMock(typeof(IMockedType), "mock"); ! IMockObject mockObjectControl = (IMockObject)mock; ! ! MockExpectation e1 = new MockExpectation(); ! MockExpectation e2 = new MockExpectation(); ! ! mockObjectControl.AddExpectation(e1); ! mockObjectControl.AddExpectation(e2); ! ! e1.HasBeenMet = true; ! e2.HasBeenMet = true; mockery.VerifyAllExpectationsHaveBeenMet(); ! ! e1.HasBeenMet = true; ! e2.HasBeenMet = false; ! try ! { ! assertionFailed = false; ! mockery.VerifyAllExpectationsHaveBeenMet(); ! } ! catch (ExpectationException) ! { ! assertionFailed = true; ! } ! Assert.IsTrue(assertionFailed, "should have failed when e2 was not met"); ! ! e1.HasBeenMet = false; ! e2.HasBeenMet = true; ! try ! { ! assertionFailed = false; ! mockery.VerifyAllExpectationsHaveBeenMet(); ! } ! catch (ExpectationException) ! { ! assertionFailed = true; ! } ! Assert.IsTrue(assertionFailed, "should have failed when e1 was not met"); } --- 137,191 ---- public void StopsSearchingForMatchingExpectationAsSoonAsOneMatches() { ! AddExpectationsToMockery(); ! expectation2.Previous = expectation1; ! expectation1.ExpectedInvokedObject = expectation2.ExpectedInvokedObject = mock; ! expectation1.ExpectedInvokedMethod = expectation2.ExpectedInvokedMethod = typeof(IMockedType).GetMethod("DoStuff", new Type[0]); ! expectation1.Matches_Result = true; mock.DoStuff(); ! Assert.IsTrue(expectation1.Matches_HasBeenCalled, "should have tried to match expectation1"); ! Assert.IsTrue(expectation1.Perform_HasBeenCalled, "should have performed expectation1"); ! Assert.IsFalse(expectation2.Matches_HasBeenCalled, "should not have tried to match expectation2"); ! Assert.IsFalse(expectation2.Perform_HasBeenCalled, "should not have performed expectation2"); } ! [Test, ExpectedException(typeof(NMock2.Internal.ExpectationException))] public void FailsTestIfNoExpectationsMatch() { ! AddExpectationsToMockery(); ! expectation1.Matches_Result = false; ! expectation2.Matches_Result = false; ! mock.DoStuff(); } [Test] ! public void VerifiesWhenAllExpectationsHaveBeenMet() { ! AddExpectationsToMockery(); ! expectation1.HasBeenMet = true; ! expectation2.HasBeenMet = true; mockery.VerifyAllExpectationsHaveBeenMet(); ! } ! ! [Test, ExpectedException(typeof(NMock2.Internal.ExpectationException))] ! public void DetectsWhenSecondExpectationHasNotBeenMet() ! { ! AddExpectationsToMockery(); ! expectation1.HasBeenMet = true; ! expectation2.HasBeenMet = false; ! mockery.VerifyAllExpectationsHaveBeenMet(); ! } ! ! [Test, ExpectedException(typeof(NMock2.Internal.ExpectationException))] ! public void DetectsWhenFirstExpectationHasNotBeenMet() ! { ! AddExpectationsToMockery(); ! expectation1.HasBeenMet = false; ! expectation2.HasBeenMet = true; ! mockery.VerifyAllExpectationsHaveBeenMet(); } *************** *** 223,246 **** public void AssertionExceptionThrownWhenSomeExpectationsHaveNotBeenMetContainsDescriptionOfUnMetExpectations() { - IMockedType mock = (IMockedType)mockery.NewMock(typeof(IMockedType), "mock"); IMockObject mockObjectControl = (IMockObject)mock; ! MockExpectation e1 = new MockExpectation(); ! MockExpectation e2 = new MockExpectation(); ! MockExpectation e3 = new MockExpectation(); ! e1.Description = "e1"; ! e1.HasBeenMet = false; ! e1.IsActive = true; ! e2.Description = "e2"; ! e2.HasBeenMet = true; ! e2.IsActive = true; ! e3.Description = "e3"; ! e3.HasBeenMet = false; ! e3.IsActive = true; ! mockObjectControl.AddExpectation(e1); ! mockObjectControl.AddExpectation(e2); ! mockObjectControl.AddExpectation(e3); try --- 193,213 ---- public void AssertionExceptionThrownWhenSomeExpectationsHaveNotBeenMetContainsDescriptionOfUnMetExpectations() { IMockObject mockObjectControl = (IMockObject)mock; ! MockExpectation expectation3 = new MockExpectation(); ! expectation1.Description = "expectation1"; ! expectation1.HasBeenMet = false; ! expectation1.IsActive = true; ! expectation2.Description = "expectation2"; ! expectation2.HasBeenMet = true; ! expectation2.IsActive = true; ! expectation3.Description = "expectation3"; ! expectation3.HasBeenMet = false; ! expectation3.IsActive = true; ! mockObjectControl.AddExpectation(expectation1); ! mockObjectControl.AddExpectation(expectation2); ! mockObjectControl.AddExpectation(expectation3); try *************** *** 255,260 **** "not all expected invocations were performed" + newLine + "Expected:" + newLine + ! " e1" + newLine + ! " e3" + newLine, e.Message); --- 222,227 ---- "not all expected invocations were performed" + newLine + "Expected:" + newLine + ! " expectation1" + newLine + ! " expectation3" + newLine, e.Message); *************** *** 265,287 **** public void AssertionExceptionThrownWhenNoExpectationsMatchContainsDescriptionOfActiveExpectations() { - IMockedType mock = (IMockedType)mockery.NewMock(typeof(IMockedType), "mock"); IMockObject mockObjectControl = (IMockObject)mock; ! MockExpectation e1 = new MockExpectation(); ! MockExpectation e2 = new MockExpectation(); ! MockExpectation e3 = new MockExpectation(); ! e1.Description = "e1"; ! e1.IsActive = true; ! e1.Matches_Result = false; ! e2.IsActive = false; ! e2.Matches_Result = false; ! e3.Description = "e3"; ! e3.IsActive = true; ! e3.Matches_Result = false; ! mockObjectControl.AddExpectation(e1); ! mockObjectControl.AddExpectation(e2); ! mockObjectControl.AddExpectation(e3); try --- 232,251 ---- public void AssertionExceptionThrownWhenNoExpectationsMatchContainsDescriptionOfActiveExpectations() { IMockObject mockObjectControl = (IMockObject)mock; ! MockExpectation expectation3 = new MockExpectation(); ! expectation1.Description = "expectation1"; ! expectation1.IsActive = true; ! expectation1.Matches_Result = false; ! expectation2.IsActive = false; ! expectation2.Matches_Result = false; ! expectation3.Description = "expectation3"; ! expectation3.IsActive = true; ! expectation3.Matches_Result = false; ! mockObjectControl.AddExpectation(expectation1); ! mockObjectControl.AddExpectation(expectation2); ! mockObjectControl.AddExpectation(expectation3); try *************** *** 296,301 **** "unexpected invocation of mock.DoStuff()" + newLine + "Expected:" + newLine + ! " e1" + newLine + ! " e3" + newLine, e.Message); } --- 260,265 ---- "unexpected invocation of mock.DoStuff()" + newLine + "Expected:" + newLine + ! " expectation1" + newLine + ! " expectation3" + newLine, e.Message); } *************** *** 387,389 **** } } ! } \ No newline at end of file --- 351,353 ---- } } ! } |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:37:49
|
Update of /cvsroot/nmock/nmock2/src/NMock2.AcceptanceTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23654/src/NMock2.AcceptanceTests Modified Files: NMock2.AcceptanceTests.csproj Log Message: Fix "recycling" of Mockery after Verify(). If someone mistakenly doesn't create a new mockery in their SetUp() method, old expectations won't pollute the next test. Index: NMock2.AcceptanceTests.csproj =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.AcceptanceTests/NMock2.AcceptanceTests.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NMock2.AcceptanceTests.csproj 26 May 2005 20:51:40 -0000 1.1 --- NMock2.AcceptanceTests.csproj 2 Feb 2006 22:37:41 -0000 1.2 *************** *** 1,160 **** ! <VisualStudioProject> ! <CSHARP ! ProjectType = "Local" ! ProductVersion = "7.10.3077" ! SchemaVersion = "2.0" ! ProjectGuid = "{B4EED566-0F75-443F-9990-FBD7E489B9BD}" ! > ! <Build> ! <Settings ! ApplicationIcon = "" ! AssemblyKeyContainerName = "" ! AssemblyName = "NMock2.AcceptanceTests" ! AssemblyOriginatorKeyFile = "" ! DefaultClientScript = "JScript" ! DefaultHTMLPageLayout = "Grid" ! DefaultTargetSchema = "IE50" ! DelaySign = "false" ! OutputType = "Library" ! PreBuildEvent = "" ! PostBuildEvent = "" ! RootNamespace = "NMock2.AcceptanceTests" ! 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 = "..\..\build\NMock2.AcceptanceTests\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 = "..\..\build\NMock2.AcceptanceTests\Release\" ! RegisterForComInterop = "false" ! RemoveIntegerChecks = "false" ! TreatWarningsAsErrors = "false" ! WarningLevel = "4" ! /> ! </Settings> ! <References> ! <Reference ! Name = "System" ! AssemblyName = "System" ! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll" ! /> ! <Reference ! Name = "System.Data" ! AssemblyName = "System.Data" ! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" ! /> ! <Reference ! Name = "System.XML" ! AssemblyName = "System.Xml" ! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" ! /> ! <Reference ! Name = "nunit.framework" ! AssemblyName = "nunit.framework" ! HintPath = "..\..\lib\nunit.framework.dll" ! /> ! <Reference ! Name = "NMock2" ! Project = "{CEE959FE-C3AF-4B51-8F1A-CCB32BAA1E98}" ! Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" ! /> ! </References> ! </Build> ! <Files> ! <Include> ! <File ! RelPath = "AssemblyInfo.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "ErrorCheckingAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "ErrorMessageDemo.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "EventsAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "Example.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "ExpectationsAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "IHelloWorld.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "IndexersAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "OrderedCallsAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "PropertiesAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "StubAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "UsingBlockAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! </Include> ! </Files> ! </CSHARP> ! </VisualStudioProject> ! --- 1,165 ---- ! <VisualStudioProject> ! <CSHARP ! ProjectType = "Local" ! ProductVersion = "7.10.3077" ! SchemaVersion = "2.0" ! ProjectGuid = "{B4EED566-0F75-443F-9990-FBD7E489B9BD}" ! > ! <Build> ! <Settings ! ApplicationIcon = "" ! AssemblyKeyContainerName = "" ! AssemblyName = "NMock2.AcceptanceTests" ! AssemblyOriginatorKeyFile = "" ! DefaultClientScript = "JScript" ! DefaultHTMLPageLayout = "Grid" ! DefaultTargetSchema = "IE50" ! DelaySign = "false" ! OutputType = "Library" ! PreBuildEvent = "" ! PostBuildEvent = "" ! RootNamespace = "NMock2.AcceptanceTests" ! 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 = "..\..\build\NMock2.AcceptanceTests\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 = "..\..\build\NMock2.AcceptanceTests\Release\" ! RegisterForComInterop = "false" ! RemoveIntegerChecks = "false" ! TreatWarningsAsErrors = "false" ! WarningLevel = "4" ! /> ! </Settings> ! <References> ! <Reference ! Name = "System" ! AssemblyName = "System" ! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll" ! /> ! <Reference ! Name = "System.Data" ! AssemblyName = "System.Data" ! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" ! /> ! <Reference ! Name = "System.XML" ! AssemblyName = "System.Xml" ! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" ! /> ! <Reference ! Name = "nunit.framework" ! AssemblyName = "nunit.framework" ! HintPath = "..\..\lib\nunit.framework.dll" ! /> ! <Reference ! Name = "NMock2" ! Project = "{CEE959FE-C3AF-4B51-8F1A-CCB32BAA1E98}" ! Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" ! /> ! </References> ! </Build> ! <Files> ! <Include> ! <File ! RelPath = "AssemblyInfo.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "ErrorCheckingAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "ErrorMessageDemo.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "EventsAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "Example.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "ExpectationsAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "IHelloWorld.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "IndexersAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "MockeryAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "OrderedCallsAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "PropertiesAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "StubAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "UsingBlockAcceptanceTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! </Include> ! </Files> ! </CSHARP> ! </VisualStudioProject> ! |
|
From: Michael M. <mg...@us...> - 2006-02-02 22:37:49
|
Update of /cvsroot/nmock/nmock2/src/NMock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23654/src/NMock2 Modified Files: Mockery.cs Log Message: Fix "recycling" of Mockery after Verify(). If someone mistakenly doesn't create a new mockery in their SetUp() method, old expectations won't pollute the next test. Index: Mockery.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2/Mockery.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Mockery.cs 27 Sep 2005 18:57:38 -0000 1.5 --- Mockery.cs 2 Feb 2006 22:37:41 -0000 1.6 *************** *** 1,6 **** ! #undef NET20 ! using System; using System.Reflection; using System.Collections; ! using NMock2.Internal; using NMock2.Monitoring; namespace NMock2 --- 1,7 ---- ! using System; ! using System.Reflection; using System.Collections; ! using NMock2.Internal; ! using NMock2.Monitoring; namespace NMock2 *************** *** 16,23 **** public Mockery() { ! depth = 1; expectations = new UnorderedExpectations(); topOrdering = expectations; ! } public object NewMock(Type mockedType) --- 17,29 ---- public Mockery() { ! ClearExpectations(); ! } ! ! private void ClearExpectations() ! { ! depth = 1; expectations = new UnorderedExpectations(); topOrdering = expectations; ! } public object NewMock(Type mockedType) *************** *** 120,124 **** if (!expectations.HasBeenMet) { ! FailUnmetExpectations(); } } --- 126,130 ---- if (!expectations.HasBeenMet) { ! FailUnmetExpectations(); } } *************** *** 129,132 **** --- 135,139 ---- writer.WriteLine("not all expected invocations were performed"); expectations.DescribeUnmetExpectationsTo(writer); + ClearExpectations(); throw new ExpectationException(writer.ToString()); } |
|
From: Michael M. <mg...@us...> - 2006-02-02 21:42:23
|
Update of /cvsroot/nmock/nmock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32201 Modified Files: nant.build Log Message: Add new "dist" target for building a zip file, and "for-1.1" and "for-2.0" targets to deliberately target a particular framework version. Index: nant.build =================================================================== RCS file: /cvsroot/nmock/nmock2/nant.build,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nant.build 2 Feb 2006 19:02:11 -0000 1.2 --- nant.build 2 Feb 2006 21:42:15 -0000 1.3 *************** *** 31,33 **** --- 31,70 ---- </target> + <target name="dist" depends="build, test" description="Build distribution"> + <mkdir dir="dist" /> + <zip zipfile="dist/nmock2-${nant.settings.currentframework}.zip" ziplevel="9"> + <fileset basedir="build/NMock2/Debug" prefix="bin"> + <include name="*.dll" /> + <include name="*.pdb" /> + </fileset> + <fileset basedir="doc" prefix="doc"> + <include name="**/*" /> + </fileset> + </zip> + </target> + + <target name="for-1.1" depends="set-net-1.1-framework-configuration" + description="Use version 1.1 of the .NET framework"> + <echo>Using .NET 1.1 framework</echo> + </target> + + <target name="for-2.0" depends="set-net-2.0-framework-configuration" + description="Use version 2.0 of the .NET framework"> + <echo>Using .NET 2.0 framework</echo> + </target> + + <target name="set-net-1.1-framework-configuration"> + <property name="nant.settings.currentframework" value="net-1.1" /> + <property name="current.build.defines" value="${build.defines}NET,NET_1_1" dynamic="true" /> + <property name="link.sdkdoc.version" value="SDK_v1_1" /> + <property name="link.sdkdoc.web" value="true" /> + </target> + + <target name="set-net-2.0-framework-configuration"> + <property name="nant.settings.currentframework" value="net-2.0" /> + <property name="current.build.defines" value="${build.defines}NET,NET_2_0" dynamic="true" /> + <property name="link.sdkdoc.version" value="SDK_v1_1" /> + <property name="link.sdkdoc.web" value="true" /> + </target> + </project> |
|
From: Michael M. <mg...@us...> - 2006-02-02 19:02:27
|
Update of /cvsroot/nmock/nmock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18910 Modified Files: nant.build Log Message: Add test target to nant build script. Index: nant.build =================================================================== RCS file: /cvsroot/nmock/nmock2/nant.build,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** nant.build 26 May 2005 20:51:41 -0000 1.1 --- nant.build 2 Feb 2006 19:02:11 -0000 1.2 *************** *** 1,20 **** ! <project name="SharpMock" default="build"> ! <property name="configuration" value="Debug"/> ! ! <target name="clean" description="Delete all previously compiled binaries."> ! <delete> ! <fileset> ! <include name="build/**" /> ! <include name="**/obj/**" /> ! </fileset> ! </delete> ! </target> ! ! <target name="build" description="Build all targets."> ! <solution configuration="${configuration}" solutionfile="NMock2.sln" /> ! <property name="expected.output" value="build/NMock2/${configuration}/NMock2.dll"/> ! <fail unless="${file::exists(expected.output)}">Output file doesn't exist in ${expected.output}</fail> ! </target> ! ! <target name="rebuild" depends="clean, build" /> ! </project> --- 1,33 ---- ! <project name="NMock2" default="all"> ! <property name="configuration" value="Debug"/> ! ! <target name="clean" description="Delete all previously compiled binaries."> ! <delete> ! <fileset> ! <include name="build/**" /> ! <include name="**/obj/**" /> ! </fileset> ! </delete> ! </target> ! ! <target name="all" depends="clean, build, test" description="Build and run tests" /> ! ! <target name="build" description="Build all targets."> ! <solution configuration="${configuration}" solutionfile="NMock2.sln" /> ! <property name="expected.output" value="build/NMock2/${configuration}/NMock2.dll"/> ! <fail unless="${file::exists(expected.output)}">Output file doesn't exist in ${expected.output}</fail> ! </target> ! ! <target name="test" description="Run tests" depends="build"> ! <nunit2> ! <formatter type="Plain" /> ! <formatter type="Xml" usefile="true" extension=".xml" outputdir="build/testresults" /> ! <test> ! <assemblies> ! <include name="build/**/*Test*.dll" /> ! </assemblies> ! </test> ! </nunit2> ! </target> ! ! </project> |
|
From: Michael M. <mg...@us...> - 2006-02-02 19:01:54
|
Update of /cvsroot/nmock/nmock2/src/NMock2.AcceptanceTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18438/src/NMock2.AcceptanceTests Modified Files: ErrorMessageDemo.cs IndexersAcceptanceTest.cs PropertiesAcceptanceTest.cs Log Message: Enable acceptance tests by defining their expected exceptions. Fix a couple of problems running under X-Develop by setting interfaces to be public. Index: ErrorMessageDemo.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.AcceptanceTests/ErrorMessageDemo.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ErrorMessageDemo.cs 2 Feb 2006 17:36:10 -0000 1.2 --- ErrorMessageDemo.cs 2 Feb 2006 19:01:34 -0000 1.3 *************** *** 18,22 **** } ! [Test, Explicit] public void VerifyFailure() { --- 18,22 ---- } ! [Test, ExpectedException(typeof(NMock2.Internal.ExpectationException))] public void VerifyFailure() { *************** *** 36,40 **** } ! [Test, Explicit] public void UnexpectedInvocation() { --- 36,40 ---- } ! [Test, ExpectedException(typeof(NMock2.Internal.ExpectationException))] public void UnexpectedInvocation() { *************** *** 51,59 **** helloWorld.Ask("What color is the fish?"); helloWorld.Ask("What color is the hippo?"); - - mocks.VerifyAllExpectationsHaveBeenMet(); } ! [Test, Explicit] public void IndexerSet() { --- 51,57 ---- helloWorld.Ask("What color is the fish?"); helloWorld.Ask("What color is the hippo?"); } ! [Test, ExpectedException(typeof(NMock2.Internal.ExpectationException))] public void IndexerSet() { *************** *** 66,70 **** } ! [Test, Explicit] public void EventAdd() { --- 64,68 ---- } ! [Test, ExpectedException(typeof(NMock2.Internal.ExpectationException))] public void EventAdd() { Index: IndexersAcceptanceTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.AcceptanceTests/IndexersAcceptanceTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IndexersAcceptanceTest.cs 2 Feb 2006 17:36:10 -0000 1.2 --- IndexersAcceptanceTest.cs 2 Feb 2006 19:01:34 -0000 1.3 *************** *** 5,9 **** namespace NMock2.AcceptanceTests { ! interface Indexed { string this[string s, string t] { get; set; } --- 5,9 ---- namespace NMock2.AcceptanceTests { ! public interface Indexed { string this[string s, string t] { get; set; } Index: PropertiesAcceptanceTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.AcceptanceTests/PropertiesAcceptanceTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PropertiesAcceptanceTest.cs 2 Feb 2006 17:36:10 -0000 1.2 --- PropertiesAcceptanceTest.cs 2 Feb 2006 19:01:34 -0000 1.3 *************** *** 5,9 **** namespace NMock2.AcceptanceTests { ! interface PersonRecord { string FirstName { get; set; } --- 5,9 ---- namespace NMock2.AcceptanceTests { ! public interface PersonRecord { string FirstName { get; set; } |
|
From: Michael M. <mg...@us...> - 2006-02-01 23:11:51
|
Update of /cvsroot/nmock/nmock2/src/NMock2.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14774/src/NMock2.Test Modified Files: AssemblyInfo.cs AssertDescription.cs NamedObject.cs VerifyTest.cs Log Message: Fix for double line-spacing. Index: VerifyTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.Test/VerifyTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VerifyTest.cs 26 May 2005 20:51:41 -0000 1.1 --- VerifyTest.cs 1 Feb 2006 23:11:31 -0000 1.2 *************** *** 1,65 **** ! using NMock2.Internal; ! using NUnit.Framework; ! ! namespace NMock2.Test ! { ! [TestFixture] ! public class VerifyTest ! { ! [Test] ! public void VerifyThatPassesIfMatcherMatchesValue() ! { ! object value = new NamedObject("value"); ! ! Verify.That(value, Is.Same(value)); ! } ! ! [Test] ! public void VerifyThatFailsIfMatcherDoesNotMatchValue() ! { ! object expected = new NamedObject("expected"); ! object actual = new NamedObject("actual"); ! Matcher matcher = Is.Same(expected); ! ! try ! { ! Verify.That(actual, matcher); ! } ! catch (ExpectationException e) ! { ! Assert.AreEqual( ! System.Environment.NewLine + ! "Expected: "+matcher.ToString()+System.Environment.NewLine + ! "Actual: <"+actual.ToString()+">", ! e.Message); ! return; ! } ! ! Assert.Fail("Verify.That should have failed"); ! } ! ! [Test] ! public void CanPrependCustomMessageToDescriptionOfFailure() ! { ! object expected = new NamedObject("expected"); ! object actual = new NamedObject("actual"); ! Matcher matcher = Is.Same(expected); ! ! try ! { ! Verify.That(actual, matcher, "message {0} {1}", "0", 1); ! } ! catch (ExpectationException e) ! { ! Assert.AreEqual( ! "message 0 1" + System.Environment.NewLine + ! "Expected: "+matcher.ToString()+ System.Environment.NewLine + ! "Actual: <"+actual.ToString()+">", ! e.Message); ! return; ! } ! ! Assert.Fail("Verify.That should have failed"); ! } ! } ! } --- 1,65 ---- ! using NMock2.Internal; ! using NUnit.Framework; ! ! namespace NMock2.Test ! { ! [TestFixture] ! public class VerifyTest ! { ! [Test] ! public void VerifyThatPassesIfMatcherMatchesValue() ! { ! object value = new NamedObject("value"); ! ! Verify.That(value, Is.Same(value)); ! } ! ! [Test] ! public void VerifyThatFailsIfMatcherDoesNotMatchValue() ! { ! object expected = new NamedObject("expected"); ! object actual = new NamedObject("actual"); ! Matcher matcher = Is.Same(expected); ! ! try ! { ! Verify.That(actual, matcher); ! } ! catch (ExpectationException e) ! { ! Assert.AreEqual( ! System.Environment.NewLine + ! "Expected: "+matcher.ToString()+System.Environment.NewLine + ! "Actual: <"+actual.ToString()+">", ! e.Message); ! return; ! } ! ! Assert.Fail("Verify.That should have failed"); ! } ! ! [Test] ! public void CanPrependCustomMessageToDescriptionOfFailure() ! { ! object expected = new NamedObject("expected"); ! object actual = new NamedObject("actual"); ! Matcher matcher = Is.Same(expected); ! ! try ! { ! Verify.That(actual, matcher, "message {0} {1}", "0", 1); ! } ! catch (ExpectationException e) ! { ! Assert.AreEqual( ! "message 0 1" + System.Environment.NewLine + ! "Expected: "+matcher.ToString()+ System.Environment.NewLine + ! "Actual: <"+actual.ToString()+">", ! e.Message); ! return; ! } ! ! Assert.Fail("Verify.That should have failed"); ! } ! } ! } Index: NamedObject.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.Test/NamedObject.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NamedObject.cs 26 May 2005 20:51:41 -0000 1.1 --- NamedObject.cs 1 Feb 2006 23:11:31 -0000 1.2 *************** *** 1,30 **** ! using System; ! ! namespace NMock2.Test ! { ! public class NamedObject : ICloneable ! { ! private readonly string id; ! private readonly int cloneId; ! ! public NamedObject(string id) : this(id, 0) ! { ! } ! ! public NamedObject(string id, int cloneId) ! { ! this.id = id; ! this.cloneId = cloneId; ! } ! ! public override string ToString() ! { ! return id + (cloneId > 0 ? " (clone " + cloneId + ")" : ""); ! } ! ! public object Clone() ! { ! return new NamedObject(id, cloneId+1); ! } ! } ! } --- 1,30 ---- ! using System; ! ! namespace NMock2.Test ! { ! public class NamedObject : ICloneable ! { ! private readonly string id; ! private readonly int cloneId; ! ! public NamedObject(string id) : this(id, 0) ! { ! } ! ! public NamedObject(string id, int cloneId) ! { ! this.id = id; ! this.cloneId = cloneId; ! } ! ! public override string ToString() ! { ! return id + (cloneId > 0 ? " (clone " + cloneId + ")" : ""); ! } ! ! public object Clone() ! { ! return new NamedObject(id, cloneId+1); ! } ! } ! } Index: AssertDescription.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.Test/AssertDescription.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssertDescription.cs 26 May 2005 20:51:41 -0000 1.1 --- AssertDescription.cs 1 Feb 2006 23:11:31 -0000 1.2 *************** *** 1,34 **** ! using System; ! using System.IO; ! using NUnit.Framework; ! using NMock2.Internal; ! ! namespace NMock2.Test ! { ! public abstract class AssertDescription ! { ! public static void IsEqual(ISelfDescribing selfDescribing, string expectedDescription) ! { ! Assert.AreEqual(expectedDescription, DescriptionOf(selfDescribing), "description"); ! } ! ! private static string DescriptionOf(ISelfDescribing selfDescribing) ! { ! TextWriter writer = new DescriptionWriter(); ! ! selfDescribing.DescribeTo(writer); ! return writer.ToString(); ! } ! ! public static void IsComposed(ISelfDescribing selfDescribing, string format, params ISelfDescribing[] components) ! { ! string[] componentDescriptions = new string[components.Length]; ! for (int i = 0; i < components.Length; i++) ! { ! componentDescriptions[i] = DescriptionOf(components[i]); ! } ! ! AssertDescription.IsEqual(selfDescribing, String.Format(format, componentDescriptions)); ! } ! } ! } --- 1,34 ---- ! using System; ! using System.IO; ! using NUnit.Framework; ! using NMock2.Internal; ! ! namespace NMock2.Test ! { ! public abstract class AssertDescription ! { ! public static void IsEqual(ISelfDescribing selfDescribing, string expectedDescription) ! { ! Assert.AreEqual(expectedDescription, DescriptionOf(selfDescribing), "description"); ! } ! ! private static string DescriptionOf(ISelfDescribing selfDescribing) ! { ! TextWriter writer = new DescriptionWriter(); ! ! selfDescribing.DescribeTo(writer); ! return writer.ToString(); ! } ! ! public static void IsComposed(ISelfDescribing selfDescribing, string format, params ISelfDescribing[] components) ! { ! string[] componentDescriptions = new string[components.Length]; ! for (int i = 0; i < components.Length; i++) ! { ! componentDescriptions[i] = DescriptionOf(components[i]); ! } ! ! AssertDescription.IsEqual(selfDescribing, String.Format(format, componentDescriptions)); ! } ! } ! } Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.Test/AssemblyInfo.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssemblyInfo.cs 26 May 2005 20:51:41 -0000 1.1 --- AssemblyInfo.cs 1 Feb 2006 23:11:31 -0000 1.2 *************** *** 1,56 **** ! using System.Reflection; ! // ! // 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("")] --- 1,56 ---- ! using System.Reflection; ! // ! // 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: Michael M. <mg...@us...> - 2006-02-01 23:11:51
|
Update of /cvsroot/nmock/nmock2/src/NMock2.Test/Internal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14774/src/NMock2.Test/Internal Modified Files: BuildableExpectationTest.cs DescriptionWriterTest.cs Log Message: Fix for double line-spacing. Index: DescriptionWriterTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.Test/Internal/DescriptionWriterTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DescriptionWriterTest.cs 26 May 2005 20:51:42 -0000 1.1 --- DescriptionWriterTest.cs 1 Feb 2006 23:11:31 -0000 1.2 *************** *** 1,42 **** ! using NUnit.Framework; ! using NMock2.Internal; ! ! namespace NMock2.Internal.Test ! { ! [TestFixture] ! public class DescriptionWriterTest ! { ! DescriptionWriter writer; ! ! [SetUp] ! public void InitialiseWriter() ! { ! writer = new DescriptionWriter(); ! } ! ! [Test] ! public void FormatsStringsInCSharpSyntaxWhenWrittenAsObject() ! { ! object aString = "hello \"world\""; ! writer.Write(aString); ! ! Assert.AreEqual("\"hello \\\"world\\\"\"", writer.ToString()); ! } ! ! [Test] ! public void FormatsNullAsNull() ! { ! writer.Write((object)null); ! Assert.AreEqual("null", writer.ToString()); ! } ! ! [Test] ! public void HighlightsOtherValuesWhenWrittenAsObject() ! { ! object anInt = 1; ! writer.Write(anInt); ! ! Assert.AreEqual("<1>", writer.ToString()); ! } ! } ! } --- 1,42 ---- ! using NUnit.Framework; ! using NMock2.Internal; ! ! namespace NMock2.Internal.Test ! { ! [TestFixture] ! public class DescriptionWriterTest ! { ! DescriptionWriter writer; ! ! [SetUp] ! public void InitialiseWriter() ! { ! writer = new DescriptionWriter(); ! } ! ! [Test] ! public void FormatsStringsInCSharpSyntaxWhenWrittenAsObject() ! { ! object aString = "hello \"world\""; ! writer.Write(aString); ! ! Assert.AreEqual("\"hello \\\"world\\\"\"", writer.ToString()); ! } ! ! [Test] ! public void FormatsNullAsNull() ! { ! writer.Write((object)null); ! Assert.AreEqual("null", writer.ToString()); ! } ! ! [Test] ! public void HighlightsOtherValuesWhenWrittenAsObject() ! { ! object anInt = 1; ! writer.Write(anInt); ! ! Assert.AreEqual("<1>", writer.ToString()); ! } ! } ! } Index: BuildableExpectationTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock2/src/NMock2.Test/Internal/BuildableExpectationTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BuildableExpectationTest.cs 26 May 2005 20:51:42 -0000 1.1 --- BuildableExpectationTest.cs 1 Feb 2006 23:11:31 -0000 1.2 *************** *** 1,293 **** ! using System.IO; ! using NMock2.Matchers; ! using NMock2.Monitoring; ! using NMock2.Test.Monitoring; ! using NUnit.Framework; ! ! namespace NMock2.Internal.Test ! { ! [TestFixture] ! public class BuildableExpectationTest ! { ! private Invocation invocation; ! ! [SetUp] ! public void SetUp() ! { ! invocation = new Invocation("receiver", new MethodInfoStub("method"), new object[] { "arg" }); ! } ! ! [Test] ! public void MatchesIfAllMatchersMatch() ! { ! BuildableExpectation e = BuildExpectation(true, true, true, true, true, true, true); ! Assert.IsTrue( e.Matches(this.invocation), "should match"); ! } ! ! [Test] ! public void DoesNotMatchIfAnyMatcherDoesNotMatch() ! { ! const bool ignoreRequiredCallCount = true; ! ! for (int i = 1; i < 64; i++) ! { ! BuildableExpectation e = BuildExpectation( ! ignoreRequiredCallCount, ! (i & 1) == 0, ! (i & 2) == 0, ! (i & 4) == 0, ! (i & 8) == 0, ! (i & 16) == 0, ! (i & 32) == 0); ! ! Assert.IsFalse(e.Matches(this.invocation), "should not match (iteration "+i+")"); ! } ! } ! ! [Test] ! public void InvokesAListOfActionsToPerformAnInvocation() ! { ! BuildableExpectation e = BuildExpectation(true,true,true,true,true,true,true); ! MockAction action1 = new MockAction(); ! MockAction action2 = new MockAction(); ! ! e.AddAction(action1); ! e.AddAction(action2); ! ! e.Perform(invocation); ! ! Assert.AreSame( invocation, action1.Received, "action1 received"); ! Assert.AreSame( invocation, action2.Received, "action1 received"); ! } ! ! [Test] ! public void MatchesCallCountWhenMatchingInvocation() ! { ! Matcher irrelevant = Is.Anything; ! ! BuildableExpectation expectation = BuildExpectation( ! "description", ! irrelevant, ! Is.AtMost(4), ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant); ! ! AssertIsActive(expectation, "should be active before any invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 1st invocation"); ! expectation.Perform(invocation); ! ! AssertIsActive(expectation, "should be active before 2nd invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 2nd invocation"); ! expectation.Perform(invocation); ! ! AssertIsActive(expectation, "should be active before 3rd invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 3rd invocation"); ! expectation.Perform(invocation); ! ! AssertIsActive(expectation, "should be active before 4th invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 4th invocation"); ! expectation.Perform(invocation); ! ! AssertIsNotActive(expectation, "should not be active after 4th invocation"); ! Assert.IsFalse(expectation.Matches(invocation), "should not match 5th invocation"); ! } ! ! [Test] ! public void ChecksCallCountToAssertThatItHasBeenMet() ! { ! Matcher irrelevant = Is.Anything; ! ! BuildableExpectation expectation = BuildExpectation( ! "description", ! Is.AtLeast(2), ! Is.AtMost(4), ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant); ! ! AssertHasNotBeenMet(expectation, "should not have been met after no invocations"); ! ! expectation.Perform(invocation); ! AssertHasNotBeenMet(expectation, "should not have been met after 1 invocation"); ! ! expectation.Perform(invocation); ! AssertHasBeenMet(expectation, "should have been met after 2 invocations"); ! ! expectation.Perform(invocation); ! AssertHasBeenMet(expectation, "should have been met after 3 invocations"); ! ! expectation.Perform(invocation); ! AssertHasBeenMet(expectation, "should have been met after 4 invocations"); ! } ! ! [Test] ! public void HasReadableDescription() ! { ! BuildableExpectation expectation = BuildExpectation( ! "expectation", ! "required call count description is ignored", ! "matching call count description is ignored", ! "receiver", ! "method", ! "(arguments)", ! "extra matcher 1", "extra matcher 2" ! ); ! ! expectation.AddAction(new MockAction("action 1")); ! expectation.AddAction(new MockAction("action 2")); ! ! AssertDescriptionIsEqual(expectation, ! "expectation: receiver.method(arguments), extra matcher 1, extra matcher 2, will action 1, action 2 [called 0 times]"); ! } ! ! [Test] ! public void WillNotPrintAPeriodBetweenReceiverAndMethodIfToldToDescribeItselfAsAnIndexer() ! { ! BuildableExpectation expectation = BuildExpectation( ! "expectation", ! "required call count description is ignored", ! "matching call count description is ignored", ! "receiver", ! "", ! "[arguments]", ! "extra matcher 1", "extra matcher 2" ! ); ! ! expectation.AddAction(new MockAction("action 1")); ! expectation.AddAction(new MockAction("action 2")); ! expectation.DescribeAsIndexer(); ! ! AssertDescriptionIsEqual(expectation, ! "expectation: receiver[arguments], extra matcher 1, extra matcher 2, will action 1, action 2 [called 0 times]"); ! } ! ! private static BuildableExpectation BuildExpectation( ! bool matchRequiredCallCount, ! bool matchMatchingCallCount, ! bool matchReceiver, ! bool matchMethod, ! bool matchArguments, ! params bool[] matchExtraMatchers) ! { ! Matcher[] extraMatchers = new Matcher[matchExtraMatchers.Length]; ! for (int i = 0; i < extraMatchers.Length; i++) ! { ! extraMatchers[i] = new AlwaysMatcher(matchExtraMatchers[i], "extra matcher "+(i+1)); ! } ! ! return BuildExpectation( ! "description", ! new AlwaysMatcher(matchRequiredCallCount, "required call count"), ! new AlwaysMatcher(matchMatchingCallCount, "matching call count"), ! new AlwaysMatcher(matchReceiver, "receiver"), ! new AlwaysMatcher(matchMethod, "method"), ! new AlwaysMatcher(matchArguments, "argument"), ! extraMatchers ); ! } ! ! private static BuildableExpectation BuildExpectation( ! string expectationDescription, ! string matchRequiredCallCountDescription, ! string matchMatchingCallCountDescription, ! string matchReceiverDescription, ! string matchMethodDescription, ! string matchArgumentsDescription, ! params string[] extraMatcherDescriptions) ! { ! bool irrelevant = true; ! ! Matcher[] extraMatchers = new Matcher[extraMatcherDescriptions.Length]; ! for (int i = 0; i < extraMatchers.Length; i++) ! { ! extraMatchers[i] = new AlwaysMatcher(irrelevant, extraMatcherDescriptions[i]); ! } ! ! return BuildExpectation( ! expectationDescription, ! new AlwaysMatcher(irrelevant, matchRequiredCallCountDescription), ! new AlwaysMatcher(irrelevant, matchMatchingCallCountDescription), ! new AlwaysMatcher(irrelevant, matchReceiverDescription), ! new AlwaysMatcher(irrelevant, matchMethodDescription), ! new AlwaysMatcher(irrelevant, matchArgumentsDescription), ! extraMatchers); ! } ! ! private static BuildableExpectation BuildExpectation( ! string description, ! Matcher requiredCallCountMatcher, ! Matcher matchingCallCountMatcher, ! Matcher receiverMatcher, ! Matcher methodMatcher, ! Matcher argumentsMatcher, ! params Matcher[] extraMatchers) ! { ! BuildableExpectation e = ! new BuildableExpectation(description, requiredCallCountMatcher, matchingCallCountMatcher); ! e.ArgumentsMatcher = argumentsMatcher; ! e.MethodMatcher = methodMatcher; ! e.ReceiverMatcher = receiverMatcher; ! foreach (Matcher extraMatcher in extraMatchers) e.AddInvocationMatcher(extraMatcher); ! return e; ! } ! ! private void AssertIsActive(IExpectation expectation, string message) ! { ! Assert.IsTrue(expectation.IsActive, message); ! } ! ! private void AssertHasBeenMet(IExpectation expectation, string message) ! { ! Assert.IsTrue(expectation.HasBeenMet, message); ! } ! ! private void AssertHasNotBeenMet(IExpectation expectation, string message) ! { ! Assert.IsFalse(expectation.HasBeenMet, message); ! } ! ! private void AssertIsNotActive(IExpectation expectation, string message) ! { ! Assert.IsFalse(expectation.IsActive, message); ! } ! ! private void AssertDescriptionIsEqual(BuildableExpectation expectation, string expected) ! { ! DescriptionWriter writer = new DescriptionWriter(); ! expectation.DescribeActiveExpectationsTo(writer); ! ! Assert.AreEqual(expected, writer.ToString()); ! } ! } ! ! class MockAction : IAction ! { ! public Invocation Received = null; ! public MockAction Previous = null; ! public string Description; ! ! public MockAction() : this("MockAction") ! { ! } ! ! public MockAction(string description) ! { ! this.Description = description; ! } ! ! public void Invoke(Invocation invocation) ! { ! if (Previous != null) Assert.IsNotNull(Previous.Received, "called out of order"); ! Received = invocation; ! } ! ! public void DescribeTo(TextWriter writer) ! { ! writer.Write(Description); ! } ! } ! } --- 1,293 ---- ! using System.IO; ! using NMock2.Matchers; ! using NMock2.Monitoring; ! using NMock2.Test.Monitoring; ! using NUnit.Framework; ! ! namespace NMock2.Internal.Test ! { ! [TestFixture] ! public class BuildableExpectationTest ! { ! private Invocation invocation; ! ! [SetUp] ! public void SetUp() ! { ! invocation = new Invocation("receiver", new MethodInfoStub("method"), new object[] { "arg" }); ! } ! ! [Test] ! public void MatchesIfAllMatchersMatch() ! { ! BuildableExpectation e = BuildExpectation(true, true, true, true, true, true, true); ! Assert.IsTrue( e.Matches(this.invocation), "should match"); ! } ! ! [Test] ! public void DoesNotMatchIfAnyMatcherDoesNotMatch() ! { ! const bool ignoreRequiredCallCount = true; ! ! for (int i = 1; i < 64; i++) ! { ! BuildableExpectation e = BuildExpectation( ! ignoreRequiredCallCount, ! (i & 1) == 0, ! (i & 2) == 0, ! (i & 4) == 0, ! (i & 8) == 0, ! (i & 16) == 0, ! (i & 32) == 0); ! ! Assert.IsFalse(e.Matches(this.invocation), "should not match (iteration "+i+")"); ! } ! } ! ! [Test] ! public void InvokesAListOfActionsToPerformAnInvocation() ! { ! BuildableExpectation e = BuildExpectation(true,true,true,true,true,true,true); ! MockAction action1 = new MockAction(); ! MockAction action2 = new MockAction(); ! ! e.AddAction(action1); ! e.AddAction(action2); ! ! e.Perform(invocation); ! ! Assert.AreSame( invocation, action1.Received, "action1 received"); ! Assert.AreSame( invocation, action2.Received, "action1 received"); ! } ! ! [Test] ! public void MatchesCallCountWhenMatchingInvocation() ! { ! Matcher irrelevant = Is.Anything; ! ! BuildableExpectation expectation = BuildExpectation( ! "description", ! irrelevant, ! Is.AtMost(4), ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant); ! ! AssertIsActive(expectation, "should be active before any invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 1st invocation"); ! expectation.Perform(invocation); ! ! AssertIsActive(expectation, "should be active before 2nd invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 2nd invocation"); ! expectation.Perform(invocation); ! ! AssertIsActive(expectation, "should be active before 3rd invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 3rd invocation"); ! expectation.Perform(invocation); ! ! AssertIsActive(expectation, "should be active before 4th invocation"); ! Assert.IsTrue(expectation.Matches(invocation), "should match 4th invocation"); ! expectation.Perform(invocation); ! ! AssertIsNotActive(expectation, "should not be active after 4th invocation"); ! Assert.IsFalse(expectation.Matches(invocation), "should not match 5th invocation"); ! } ! ! [Test] ! public void ChecksCallCountToAssertThatItHasBeenMet() ! { ! Matcher irrelevant = Is.Anything; ! ! BuildableExpectation expectation = BuildExpectation( ! "description", ! Is.AtLeast(2), ! Is.AtMost(4), ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant, ! irrelevant); ! ! AssertHasNotBeenMet(expectation, "should not have been met after no invocations"); ! ! expectation.Perform(invocation); ! AssertHasNotBeenMet(expectation, "should not have been met after 1 invocation"); ! ! expectation.Perform(invocation); ! AssertHasBeenMet(expectation, "should have been met after 2 invocations"); ! ! expectation.Perform(invocation); ! AssertHasBeenMet(expectation, "should have been met after 3 invocations"); ! ! expectation.Perform(invocation); ! AssertHasBeenMet(expectation, "should have been met after 4 invocations"); ! } ! ! [Test] ! public void HasReadableDescription() ! { ! BuildableExpectation expectation = BuildExpectation( ! "expectation", ! "required call count description is ignored", ! "matching call count description is ignored", ! "receiver", ! "method", ! "(arguments)", ! "extra matcher 1", "extra matcher 2" ! ); ! ! expectation.AddAction(new MockAction("action 1")); ! expectation.AddAction(new MockAction("action 2")); ! ! AssertDescriptionIsEqual(expectation, ! "expectation: receiver.method(arguments), extra matcher 1, extra matcher 2, will action 1, action 2 [called 0 times]"); ! } ! ! [Test] ! public void WillNotPrintAPeriodBetweenReceiverAndMethodIfToldToDescribeItselfAsAnIndexer() ! { ! BuildableExpectation expectation = BuildExpectation( ! "expectation", ! "required call count description is ignored", ! "matching call count description is ignored", ! "receiver", ! "", ! "[arguments]", ! "extra matcher 1", "extra matcher 2" ! ); ! ! expectation.AddAction(new MockAction("action 1")); ! expectation.AddAction(new MockAction("action 2")); ! expectation.DescribeAsIndexer(); ! ! AssertDescriptionIsEqual(expectation, ! "expectation: receiver[arguments], extra matcher 1, extra matcher 2, will action 1, action 2 [called 0 times]"); ! } ! ! private static BuildableExpectation BuildExpectation( ! bool matchRequiredCallCount, ! bool matchMatchingCallCount, ! bool matchReceiver, ! bool matchMethod, ! bool matchArguments, ! params bool[] matchExtraMatchers) ! { ! Matcher[] extraMatchers = new Matcher[matchExtraMatchers.Length]; ! for (int i = 0; i < extraMatchers.Length; i++) ! { ! extraMatchers[i] = new AlwaysMatcher(matchExtraMatchers[i], "extra matcher "+(i+1)); ! } ! ! return BuildExpectation( ! "description", ! new AlwaysMatcher(matchRequiredCallCount, "required call count"), ! new AlwaysMatcher(matchMatchingCallCount, "matching call count"), ! new AlwaysMatcher(matchReceiver, "receiver"), ! new AlwaysMatcher(matchMethod, "method"), ! new AlwaysMatcher(matchArguments, "argument"), ! extraMatchers ); ! } ! ! private static BuildableExpectation BuildExpectation( ! string expectationDescription, ! string matchRequiredCallCountDescription, ! string matchMatchingCallCountDescription, ! string matchReceiverDescription, ! string matchMethodDescription, ! string matchArgumentsDescription, ! params string[] extraMatcherDescriptions) ! { ! bool irrelevant = true; ! ! Matcher[] extraMatchers = new Matcher[extraMatcherDescriptions.Length]; ! for (int i = 0; i < extraMatchers.Length; i++) ! { ! extraMatchers[i] = new AlwaysMatcher(irrelevant, extraMatcherDescriptions[i]); ! } ! ! return BuildExpectation( ! expectationDescription, ! new AlwaysMatcher(irrelevant, matchRequiredCallCountDescription), ! new AlwaysMatcher(irrelevant, matchMatchingCallCountDescription), ! new AlwaysMatcher(irrelevant, matchReceiverDescription), ! new AlwaysMatcher(irrelevant, matchMethodDescription), ! new AlwaysMatcher(irrelevant, matchArgumentsDescription), ! extraMatchers); ! } ! ! private static BuildableExpectation BuildExpectation( ! string description, ! Matcher requiredCallCountMatcher, ! Matcher matchingCallCountMatcher, ! Matcher receiverMatcher, ! Matcher methodMatcher, ! Matcher argumentsMatcher, ! params Matcher[] extraMatchers) ! { ! BuildableExpectation e = ! new BuildableExpectation(description, requiredCallCountMatcher, matchingCallCountMatcher); ! e.ArgumentsMatcher = argumentsMatcher; ! e.MethodMatcher = methodMatcher; ! e.ReceiverMatcher = receiverMatcher; ! foreach (Matcher extraMatcher in extraMatchers) e.AddInvocationMatcher(extraMatcher); ! return e; ! } ! ! private void AssertIsActive(IExpectation expectation, string message) ! { ! Assert.IsTrue(expectation.IsActive, message); ! } ! ! private void AssertHasBeenMet(IExpectation expectation, string message) ! { ! Assert.IsTrue(expectation.HasBeenMet, message); ! } ! ! private void AssertHasNotBeenMet(IExpectation expectation, string message) ! { ! Assert.IsFalse(expectation.HasBeenMet, message); ! } ! ! private void AssertIsNotActive(IExpectation expectation, string message) ! { ! Assert.IsFalse(expectation.IsActive, message); ! } ! ! private void AssertDescriptionIsEqual(BuildableExpectation expectation, string expected) ! { ! DescriptionWriter writer = new DescriptionWriter(); ! expectation.DescribeActiveExpectationsTo(writer); ! ! Assert.AreEqual(expected, writer.ToString()); ! } ! } ! ! class MockAction : IAction ! { ! public Invocation Received = null; ! public MockAction Previous = null; ! public string Description; ! ! public MockAction() : this("MockAction") ! { ! } ! ! public MockAction(string description) ! { ! this.Description = description; ! } ! ! public void Invoke(Invocation invocation) ! { ! if (Previous != null) Assert.IsNotNull(Previous.Received, "called out of order"); ! Received = invocation; ! } ! ! public void DescribeTo(TextWriter writer) ! { ! writer.Write(Description); ! } ! } ! } |