This list is closed, nobody may subscribe to it.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Chu V. <vin...@ax...> - 2005-06-10 05:09:31
|
Hi all, I am currently using MockCommand and MockDbConnection to test a component that expects some values to be returned from a stored procedure call. The problem I am facing here is that when MockCommand.ExecuteNonQuery() is called, there's no way for me to setup mock result values and any code that expects return values from the stored procedure call will fail. I wish to have MockCommand setup the output parameter values when ExecuteNonQuery() or ExecuteScalar() are called. Here's an example in the ideal situation: // My test code public void TestFindStatus() { MockCommand cmd = new MockCommand(); cmd.SetExpectedParameter(new MockDataParameter("StatusCode", ParameterDirection.Output, 0)); cmd.SetExpectedParameter(new MockDataParameter("StatusText", ParameterDirection.Output, "ok")); Assert.IsTrue(FindStatus(cmd)); } // My production code public bool FindStatus(IDbCommand cmd) { cmd.ExecuteNonQuery(); if ((cmd.Parameters["StatusCode"].Value == 0) && (cmd.Parameters["StatusText"].Value == "ok")) return true; return false; } Two things to note here: 1. MockDataParameter allows me to specify a parameter direction. 2. When MockCommand.ExecuteNonQuery() is called, it should check the actual parameters (_parameters._actualCollection) for output parameters. If such parameters exist, then check the expected parameters for matches and populate the actual parameter values accordingly. Since MockCommand's job is to pretend that a command has been executed (ExecuteNonQuery, ExecuteScalar), any expected output parameter value should be copied to actual parameter's value. As a bonus, MockCommand can have a method SetExpectedBehavior() which takes a delegate and calls that delegate when ExecuteNonQuery() etc are called. This allows us to mock database stored procedures easily when we are really interested in testing the behavior of code that relies on the results of the database SPs. In fact, if SetExpectedBehavior() is implemented as a feature, it could setup the actual parameter values when triggered. Am I making sense ? Barking up the wrong tree ? Maybe there's a better way of approaching this kind of test ? If what I propose is reasonable, I'll post a RFE. I've studied MockCommand.cs and other sources carefully and can even perform the change myself if the authors don't mind :) Thanks for reading, Vincent Chu |
From: <jmc...@gt...> - 2004-07-27 05:29:20
|
Can somebody give me a sample with .NET Mock Objects of a multiple=20 update to a database inside a transaction? I don=B4t know how to use the MockTransaction Class to verify commits=20 or rollbacks in the update. =20 =20 This is a sample of what I am trying to do. I would like had writen "InsertWidgets" method with TDD, but I could`t = got it. I dont=B4t know how to test that the inserts are made inside the = transaction, and even I have nunit frozen sometimes. =20 Other thing is how to test for the parameters of the insert sentence. I have try with MockParameterCollection but I don=B4t know how to use it =20 Thanks. Juan M. Cervera =20 =20 =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D using System.Collections; using System.Data; using System.Data.SqlClient; =20 namespace Sample { public class SampleProcess { =20 public static readonly string INSERTION_SQL =3D @" INSERT INTO table1 (id, name) VALUES (@id, @name) "; =20 private IDbConnection myConnection; private ArrayList myCollection =3D new ArrayList(); =20 public SampleProcess(IDbConnection cnn) { myConnection =3D cnn; =20 myCollection.Add(new Widget(1, "One")); myCollection.Add(new Widget(2, "Two")); myCollection.Add(new Widget(3, "Three")); myCollection.Add(new Widget(4, "Four")); myCollection.Add(new Widget(5, "Five")); } =20 public void InsertWidgets() { IDbTransaction trn =3D null; try { myConnection.Open(); trn =3D myConnection.BeginTransaction(); foreach (Widget widget in myCollection) { InsertOneWidget(widget, trn); } trn.Commit(); } catch { trn.Rollback(); } finally { myConnection.Close(); trn =3D null; } } =20 private void InsertOneWidget(Widget widget, IDbTransaction trn) { IDbCommand cmd =3D myConnection.CreateCommand(); cmd.Transaction =3D trn; cmd.CommandText =3D INSERTION_SQL; cmd.Parameters.Add(new SqlParameter("@Id", widget.id)); cmd.Parameters.Add(new SqlParameter("@Name", widget.name)); cmd.ExecuteNonQuery(); } } =20 public class Widget { public int id; public string name; =20 public Widget(int id, string name) { this.id =3D id; this.name =3D name; } } =20 } =20 =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 =20 using System; using DotNetMock.Framework.Data; using NUnit.Framework; using Sample; =20 namespace Sample { [TestFixture] public class TestSampleFixture { =20 private MockDbConnection cnn; =20 [SetUp] public void SetUp() { cnn =3D new MockDbConnection(); } =20 [TearDown] public void TearDown() { cnn.Verify(); } =20 =20 [Test] public void TestInsertWidgets() { =20 MockCommand cmd =3D new MockCommand(); cnn.SetExpectedCommand(cmd); cmd.SetExpectedCommandText(SampleProcess.INSERTION_SQL); cmd.SetExpectedExecuteCalls(5); =20 SampleProcess process =3D new SampleProcess(cnn); // MockTransaction txn =3D (MockTransaction) cmd.Transaction; // txn.ExpectCommitCall(true); process.InsertWidgets(); // txn.Verify(); // cmd.Verify(); =20 } =20 } =20 } =20 =20 =20 =20 =20 =20 =20 |
From: Griffin C. <gri...@ma...> - 2004-07-23 21:57:41
|
This is fixed in CVS and will be included in the 0.7.0 release. Just make sure to set your expectation correctly: expectAndReturn( return, param1, new string[] { param2, param3} ) For example. -Griffin On Jun 29, 2004, at 10:51 PM, Kliment Mamykin wrote: > Hi all, > I have an interface that takes ParamArray as parameters, but I can not=20= > make DotNetMock mock it up correctly - it throws a verification=20 > exception. > Is it a bug or=A0am I doing something wrong? > Thanks, - Kliment > Here is the code: > > Private _database As IDatabase ' mock object to emulate DB access > Private _mockDatabase As IMock ' object to control the mock > > <Test()> Public Sub DotNetMockFailing() > _mockDatabase =3D New DynamicMock(GetType(IDatabase)) > _database =3D CType(_mockDatabase.Object, IDatabase) > > _mockDatabase.ExpectAndReturn("ExecuteNonQuery", 1, "SQL", 2) > _database.ExecuteNonQuery("SQL", 2) ' verification exception here !!!! > End Sub > > Public Interface IDatabase > Function ExecuteNonQuery(ByVal sql As String, ByVal ParamArray=20 > params() As Object) As Integer > Function ExecuteScalar(ByVal sql As String, ByVal ParamArray params()=20= > As Object) As Object > End Interface |
From: Griffin C. <gri...@ma...> - 2004-06-30 12:59:19
|
you know, that's a good question. I am not sure if DynamicMock was ever setup to handle variable length=20 parameters. I will check on this tonight and get back to you tonight or tomorrow. Thanks, Griffin On Jun 29, 2004, at 10:51 PM, Kliment Mamykin wrote: > Hi all, > I have an interface that takes ParamArray as parameters, but I can not=20= > make DotNetMock mock it up correctly - it throws a verification=20 > exception. > Is it a bug or=A0am I doing something wrong? > Thanks, - Kliment > Here is the code: > > Private _database As IDatabase ' mock object to emulate DB access > Private _mockDatabase As IMock ' object to control the mock > > <Test()> Public Sub DotNetMockFailing() > _mockDatabase =3D New DynamicMock(GetType(IDatabase)) > _database =3D CType(_mockDatabase.Object, IDatabase) > > _mockDatabase.ExpectAndReturn("ExecuteNonQuery", 1, "SQL", 2) > _database.ExecuteNonQuery("SQL", 2) ' verification exception here !!!! > End Sub > > Public Interface IDatabase > Function ExecuteNonQuery(ByVal sql As String, ByVal ParamArray=20 > params() As Object) As Integer > Function ExecuteScalar(ByVal sql As String, ByVal ParamArray params()=20= > As Object) As Object > End Interface |
From: Kliment M. <km...@ya...> - 2004-06-30 03:52:05
|
Hi all, I have an interface that takes ParamArray as parameters, but I can not make DotNetMock mock it up correctly - it throws a verification exception. Is it a bug or am I doing something wrong? Thanks, - Kliment Here is the code: Private _database As IDatabase ' mock object to emulate DB access Private _mockDatabase As IMock ' object to control the mock <Test()> Public Sub DotNetMockFailing() _mockDatabase = New DynamicMock(GetType(IDatabase)) _database = CType(_mockDatabase.Object, IDatabase) _mockDatabase.ExpectAndReturn("ExecuteNonQuery", 1, "SQL", 2) _database.ExecuteNonQuery("SQL", 2) ' verification exception here !!!! End Sub Public Interface IDatabase Function ExecuteNonQuery(ByVal sql As String, ByVal ParamArray params() As Object) As Integer Function ExecuteScalar(ByVal sql As String, ByVal ParamArray params() As Object) As Object End Interface |
From: Jonathan de H. <deh...@au...> - 2004-05-21 06:04:26
|
>Any chance of slimming do the MbUnit.Core? Or is everything absolutely >needed for MbUnit.Core to function? Nope, MbUnit uses QuickGraph at all levels. Everything is absolutely needed for MbUnit.Core. Cheers, Jonathan At 16:21 20/05/2004 -0500, you wrote: >You know, I was adding the MbUnit classes to the build file, and i noticed >that MbUnit.Core depends on several QuickGraph classes. >Normally, i like to add a version of the test framework to the DotNetMock >distro, so it's completely self contained, but I am leery of including 9 >more files, in addition to the MbUnit.Core.dll, with the DotNetMock distro. > >Any chance of slimming do the MbUnit.Core? Or is everything absolutely >needed for MbUnit.Core to function? > >Thanks, > >Griffin >On May 20, 2004, at 4:14 PM, Griffin Caprio wrote: > >>Support for MbUnit has been added to DotNetMock in cvs. It will go out >>this week sometime in the new release. >> >>-Griffin >>On May 13, 2004, at 12:57 PM, Griffin Caprio wrote: >> >>> >>>On May 12, 2004, at 10:15 AM, Jonathan de Halleux wrote: >>> >>>>Hi, >>>> >>>>I am working on (yet) another unit test framework for .NET called >>>>MbUnit. I am currently looking for Mock objects and your project looks >>>>like to be good one. :) >>> >>>Thanks. >>> >>>>Is there a way to integrate dotnetmock with other test framework that >>>>csUnit ? I have attached an updated version of csUnitTestFramework to >>>>work with the MbUnit classes. >>> >>>Of course. I will add the TestFramework file to the DotNetMock distro >>>in the new released, 0.5.1. >>> >>>>Cheers, >>>>Jonathan >>>If there is anything else, let me know. >>> >>>-Griffin >>> >>> >>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by: SourceForge.net Broadband >>>Sign-up now for SourceForge Broadband and get the fastest >>>6.0/768 connection for only $19.95/mo for the first 3 months! >>>http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click >>>_______________________________________________ >>>Dotnetmock-users mailing list >>>Dot...@li... >>>https://lists.sourceforge.net/lists/listinfo/dotnetmock-users >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: Oracle 10g >>Get certified on the hottest thing ever to hit the market... Oracle 10g. >>Take an Oracle 10g class now, and we'll give you the exam FREE. >>http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click >>_______________________________________________ >>Dotnetmock-users mailing list >>Dot...@li... >>https://lists.sourceforge.net/lists/listinfo/dotnetmock-users > > > >------------------------------------------------------- >This SF.Net email is sponsored by: Oracle 10g >Get certified on the hottest thing ever to hit the market... Oracle 10g. >Take an Oracle 10g class now, and we'll give you the exam FREE. >http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click >_______________________________________________ >Dotnetmock-users mailing list >Dot...@li... >https://lists.sourceforge.net/lists/listinfo/dotnetmock-users ----------------------------------------------------------------------------------- Jonathan de Halleux, Research Assistant Center for Systems Engineering and Applied Mechanics (CESAME) Universite catholique de Louvain Batiment Euler , Av. Georges Lemaitre, 4 Tel : +32-10-47 2595 B-1348 Louvain-la-Neuve Belgium E-mail : deh...@au... ----------------------------------------------------------------------------------- |
From: Griffin C. <gri...@ma...> - 2004-05-20 21:21:06
|
You know, I was adding the MbUnit classes to the build file, and i noticed that MbUnit.Core depends on several QuickGraph classes. Normally, i like to add a version of the test framework to the DotNetMock distro, so it's completely self contained, but I am leery of including 9 more files, in addition to the MbUnit.Core.dll, with the DotNetMock distro. Any chance of slimming do the MbUnit.Core? Or is everything absolutely needed for MbUnit.Core to function? Thanks, Griffin On May 20, 2004, at 4:14 PM, Griffin Caprio wrote: > Support for MbUnit has been added to DotNetMock in cvs. It will go > out this week sometime in the new release. > > -Griffin > On May 13, 2004, at 12:57 PM, Griffin Caprio wrote: > >> >> On May 12, 2004, at 10:15 AM, Jonathan de Halleux wrote: >> >>> Hi, >>> >>> I am working on (yet) another unit test framework for .NET called >>> MbUnit. I am currently looking for Mock objects and your project >>> looks like to be good one. :) >> >> Thanks. >> >>> Is there a way to integrate dotnetmock with other test framework >>> that csUnit ? I have attached an updated version of >>> csUnitTestFramework to work with the MbUnit classes. >> >> Of course. I will add the TestFramework file to the DotNetMock >> distro in the new released, 0.5.1. >> >>> Cheers, >>> Jonathan >>> >> If there is anything else, let me know. >> >> -Griffin >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by: SourceForge.net Broadband >> Sign-up now for SourceForge Broadband and get the fastest >> 6.0/768 connection for only $19.95/mo for the first 3 months! >> http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click >> _______________________________________________ >> Dotnetmock-users mailing list >> Dot...@li... >> https://lists.sourceforge.net/lists/listinfo/dotnetmock-users > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle > 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Dotnetmock-users mailing list > Dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetmock-users |
From: Griffin C. <gri...@ma...> - 2004-05-20 21:14:46
|
Support for MbUnit has been added to DotNetMock in cvs. It will go out this week sometime in the new release. -Griffin On May 13, 2004, at 12:57 PM, Griffin Caprio wrote: > > On May 12, 2004, at 10:15 AM, Jonathan de Halleux wrote: > >> Hi, >> >> I am working on (yet) another unit test framework for .NET called >> MbUnit. I am currently looking for Mock objects and your project >> looks like to be good one. :) > > Thanks. > >> Is there a way to integrate dotnetmock with other test framework that >> csUnit ? I have attached an updated version of csUnitTestFramework to >> work with the MbUnit classes. > > Of course. I will add the TestFramework file to the DotNetMock distro > in the new released, 0.5.1. > >> Cheers, >> Jonathan >> > If there is anything else, let me know. > > -Griffin > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: SourceForge.net Broadband > Sign-up now for SourceForge Broadband and get the fastest > 6.0/768 connection for only $19.95/mo for the first 3 months! > http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click > _______________________________________________ > Dotnetmock-users mailing list > Dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetmock-users |
From: Griffin C. <gri...@ma...> - 2004-05-13 17:57:27
|
On May 12, 2004, at 10:15 AM, Jonathan de Halleux wrote: > Hi, > > I am working on (yet) another unit test framework for .NET called > MbUnit. I am currently looking for Mock objects and your project looks > like to be good one. :) Thanks. > Is there a way to integrate dotnetmock with other test framework that > csUnit ? I have attached an updated version of csUnitTestFramework to > work with the MbUnit classes. Of course. I will add the TestFramework file to the DotNetMock distro in the new released, 0.5.1. > Cheers, > Jonathan > If there is anything else, let me know. -Griffin |
From: Jonathan de H. <deh...@au...> - 2004-05-12 18:06:48
|
I've create a CodeSmith template for generating the outline of a Mock class given an interface See http://blog.dotnetwiki.org/archive/2004/05/12/204.aspx ----------------------------------------------------------------------------------- Jonathan de Halleux, Research Assistant Center for Systems Engineering and Applied Mechanics (CESAME) Universite catholique de Louvain Batiment Euler , Av. Georges Lemaitre, 4 Tel : +32-10-47 2595 B-1348 Louvain-la-Neuve Belgium E-mail : deh...@au... ----------------------------------------------------------------------------------- |
From: Jonathan de H. <deh...@au...> - 2004-05-12 15:15:05
|
Hi, I am working on (yet) another unit test framework for .NET called MbUnit. I am currently looking for Mock objects and your project looks like to be good one. :) Is there a way to integrate dotnetmock with other test framework that csUnit ? I have attached an updated version of csUnitTestFramework to work with the MbUnit classes. Cheers, Jonathan ----------------------------------------------------------------------------------- Jonathan de Halleux, Research Assistant Center for Systems Engineering and Applied Mechanics (CESAME) Universite catholique de Louvain Batiment Euler , Av. Georges Lemaitre, 4 Tel : +32-10-47 2595 B-1348 Louvain-la-Neuve Belgium E-mail : deh...@au... ----------------------------------------------------------------------------------- |
From: <her...@ec...> - 2004-01-28 18:18:00
|
Hi DotNetMock's developers! Just ported DotNetMock to csUnit. I did it because that's what we use here. Are you still supporting it or is it an abandoned project? Regards, -Hernan ________________________________________________________________________________________ Este mensaje ha sido analizado y protegido por la tecnologia antivirus www.trendmicro.es |
From: Griffin C. <gri...@ya...> - 2003-04-14 00:35:39
|
Hello all! This is a announcement of the new DotNetMock has been released, version 0.4. Below is the change log: MockObject.cs - Marked Fail(), AssertTrue(), AssertEquals() Obsolete MockObject.cs - Added MockName Property for name variable MockObject.cs - Changed to implement IMockObject interface NullObject.cs - Added Name property for name variable IMockObject.cs - Added IMockObject interface for custom MockObjects MockDataReader.cs - Fixed indexing bug MockDataParameterCollection - Fixed Verify() bug AbstractExpectationCollection.cs - Fixed ClearActual() bug. was really ClearExpected() MockDbConnection.cs - State, ConnectionTimeout, & Command setups were fixed MockXPathNodeIterator.cs - Added XPathNodeIterator MockXPathDocument.cs - Added XPathDocument MockXPathNodeIterator.cs - Added XPathNodeIterator IMockObject.cs - Changed className to methodName in NotImplemented() MockXPathNavigator.cs - Added XPathNavigator Added VisualStudioTemplates for C# MockDataParameterCollection.cs - Changed Verify() method to not fail for no expected parameters. ExpectationCounter.cs - Changed Verify() method to only Verify if the object HasExpectations Plus other minor fixes.... Check it out if you get a chance and throw some feedback my way if you get a chance. Thanks, Griffin ===== Griffin Caprio "Your child against mine. The winner will be hailed, the loser will be booed until my throat hurts!" - Homer Simpson to Marge __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com |
From: <ob...@sy...> - 2002-10-31 09:42:10
|
Dear all, Could someone tell me how to use the Mock Object or point the reference for me, I=A1=A6m appreciated. Thanks in advance. =20 Best Regards, oblin=20 =20 |