This list is closed, nobody may subscribe to it.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(13) |
Oct
(49) |
Nov
(1) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(12) |
Feb
(42) |
Mar
(61) |
Apr
(36) |
May
(20) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(7) |
2004 |
Jan
(29) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2005 |
Jan
(12) |
Feb
(5) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(15) |
Nov
(89) |
Dec
(85) |
2006 |
Jan
(17) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gc...@us...> - 2003-01-13 04:04:01
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data In directory sc8-pr-cvs1:/tmp/cvs-serv6875/DotNetMock/Data Modified Files: MockDataReader.cs Log Message: Index: MockDataReader.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data/MockDataReader.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MockDataReader.cs 6 Jan 2003 03:51:27 -0000 1.3 --- MockDataReader.cs 13 Jan 2003 04:03:57 -0000 1.4 *************** *** 82,89 **** #endregion #region Implementation of IDataReader - - /// <summary> - /// Increments the CloseCalls counter & sets IsClosed property to true - /// </summary> public void Close() { --- 82,85 ---- *************** *** 109,116 **** return true; } - /// <summary> - /// Increments ReadCalls counter & increments current row of the Data Reader - /// </summary> - /// <returns>True if there are more results, False if there are no more records</returns> public bool Read() { --- 105,108 ---- |
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock In directory sc8-pr-cvs1:/tmp/cvs-serv6875/DotNetMock Modified Files: AbstractExpectation.cs AbstractExpectationCollection.cs AssemblyInfo.cs ExpectationArrayList.cs ExpectationCounter.cs ExpectationString.cs ExpectationValue.cs IExpectation.cs IExpectationCollection.cs IVerifiable.cs MockObject.cs ReturnValue.cs Verifier.cs verifyException.cs Log Message: Index: AbstractExpectation.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/AbstractExpectation.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractExpectation.cs 25 Oct 2002 03:02:25 -0000 1.7 --- AbstractExpectation.cs 13 Jan 2003 04:03:56 -0000 1.8 *************** *** 4,9 **** { /// <summary> ! /// Summary description for Abstract Expectation. /// </summary> public abstract class AbstractExpectation : IExpectation { --- 4,10 ---- { /// <summary> ! /// Abstract class that implements the <c>IExpectation</c> interface /// </summary> + /// <remarks/> public abstract class AbstractExpectation : IExpectation { *************** *** 11,20 **** private bool _verifyImmediate = false; protected string name = null; protected AbstractExpectation(string name) { this.name = name; } - /// <summary> /// Clears Actual field. --- 12,27 ---- private bool _verifyImmediate = false; + /// <summary> + /// Name of this Expectation + /// </summary> protected string name = null; + /// <summary> + /// Default Constructor for AbstractExpectation + /// </summary> + /// <param name="name">Name of this Expectation</param> protected AbstractExpectation(string name) { this.name = name; } /// <summary> /// Clears Actual field. Index: AbstractExpectationCollection.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/AbstractExpectationCollection.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractExpectationCollection.cs 28 Dec 2002 21:36:34 -0000 1.5 --- AbstractExpectationCollection.cs 13 Jan 2003 04:03:57 -0000 1.6 *************** *** 6,11 **** { /// <summary> ! /// Summary description for AbstractExpectationCollection. /// </summary> public abstract class AbstractExpectationCollection : AbstractExpectation, IExpectationCollection { --- 6,12 ---- { /// <summary> ! /// Abstract class that implements the <c>IExpectationCollection</c> interface and extends <c>AbstractExpectation</c> /// </summary> + /// <remarks/> public abstract class AbstractExpectationCollection : AbstractExpectation, IExpectationCollection { *************** *** 43,47 **** } /// <summary> ! /// Adds serveral values to the actual collection /// </summary> /// <param name="actualMany">Values to add</param> --- 44,48 ---- } /// <summary> ! /// Adds array of values to the actual collection /// </summary> /// <param name="actualMany">Values to add</param> *************** *** 54,58 **** } /// <summary> ! /// Adds several values to the actual collection /// </summary> /// <param name="actualMany">Values to add</param> --- 55,59 ---- } /// <summary> ! /// Adds enumeration of values to the actual collection /// </summary> /// <param name="actualMany">Values to add</param> *************** *** 66,70 **** } /// <summary> ! /// Adds several values to the actual collection /// </summary> /// <param name="actualMany">Values to add</param> --- 67,71 ---- } /// <summary> ! /// Adds a list values to the actual collection /// </summary> /// <param name="actualMany">Values to add</param> Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/AssemblyInfo.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AssemblyInfo.cs 25 Oct 2002 03:02:25 -0000 1.5 --- AssemblyInfo.cs 13 Jan 2003 04:03:57 -0000 1.6 *************** *** 34,38 **** // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.1.0.*")] // --- 34,38 ---- // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.3.0.*")] // *************** *** 63,65 **** [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] ! [assembly: AssemblyKeyName("")] --- 63,65 ---- [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] ! [assembly: AssemblyKeyName("")] \ No newline at end of file Index: ExpectationArrayList.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/ExpectationArrayList.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ExpectationArrayList.cs 25 Oct 2002 03:02:25 -0000 1.7 --- ExpectationArrayList.cs 13 Jan 2003 04:03:57 -0000 1.8 *************** *** 4,9 **** using System.Collections; /// <summary> ! /// Expectation ArrayList implementation. Extends AbstractExpectationCollection /// </summary> public class ExpectationArrayList : AbstractExpectationCollection { --- 4,10 ---- using System.Collections; /// <summary> ! /// Expectation ArrayList implementation. Extends <c>AbstractExpectationCollection</c> /// </summary> + /// <remarks/> public class ExpectationArrayList : AbstractExpectationCollection { Index: ExpectationCounter.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/ExpectationCounter.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExpectationCounter.cs 25 Oct 2002 03:02:25 -0000 1.6 --- ExpectationCounter.cs 13 Jan 2003 04:03:57 -0000 1.7 *************** *** 3,13 **** using NUnit.Framework; /// <summary> ! /// Expectation Counter implementation. Extends AbstractExpectation /// </summary> public class ExpectationCounter : AbstractExpectation { private int _expectedCalls = 0; private int _actualCalls = 0; ! public ExpectationCounter(String name) : base(name) {} /// <summary> --- 3,17 ---- using NUnit.Framework; /// <summary> ! /// Expectation Counter implementation. Extends <c>AbstractExpectation</c> /// </summary> + /// <remarks/> public class ExpectationCounter : AbstractExpectation { private int _expectedCalls = 0; private int _actualCalls = 0; ! /// <summary> ! /// Default Constructor. Sets the name of this Expectation ! /// </summary> ! /// <param name="name">Name of this Expectation</param> public ExpectationCounter(String name) : base(name) {} /// <summary> Index: ExpectationString.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/ExpectationString.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExpectationString.cs 29 Sep 2002 23:15:57 -0000 1.4 --- ExpectationString.cs 13 Jan 2003 04:03:57 -0000 1.5 *************** *** 3,13 **** using System; /// <summary> ! /// Summary description for String Expectation. /// </summary> public class ExpectationString : AbstractExpectation { private string _actualString = null; private string _expectedString = null; - public ExpectationString(string name) : base(name) { --- 3,13 ---- using System; /// <summary> ! /// Expectation String implementation. Extends <c>AbstractExpectaion</c> /// </summary> + /// <remarks/> public class ExpectationString : AbstractExpectation { private string _actualString = null; private string _expectedString = null; public ExpectationString(string name) : base(name) { Index: ExpectationValue.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/ExpectationValue.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ExpectationValue.cs 11 Oct 2002 03:07:59 -0000 1.8 --- ExpectationValue.cs 13 Jan 2003 04:03:57 -0000 1.9 *************** *** 3,8 **** using System; /// <summary> ! /// Expectation Value implementation. /// </summary> public class ExpectationValue : AbstractExpectation { --- 3,9 ---- using System; /// <summary> ! /// Expectation Value implementation. Extends <c>AbstractExpectation</c> /// </summary> + /// <remarks/> public class ExpectationValue : AbstractExpectation { Index: IExpectation.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/IExpectation.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IExpectation.cs 25 Oct 2002 03:02:25 -0000 1.1 --- IExpectation.cs 13 Jan 2003 04:03:57 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- /// Interface that all expectation implement. Also implements the Verifiable interface /// </summary> + /// <remarks/> public interface IExpectation : IVerifiable { Index: IExpectationCollection.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/IExpectationCollection.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IExpectationCollection.cs 25 Oct 2002 03:02:25 -0000 1.1 --- IExpectationCollection.cs 13 Jan 2003 04:03:57 -0000 1.2 *************** *** 4,9 **** using System.Collections; /// <summary> ! /// Summary description for Expectation Collection Interface. /// </summary> public interface IExpectationCollection : IExpectation { --- 4,10 ---- using System.Collections; /// <summary> ! /// IExpectationCollection interface. Interface for all collection based Expectations. Implements <c>IExpectation</c> interface /// </summary> + /// <remarks/> public interface IExpectationCollection : IExpectation { Index: IVerifiable.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/IVerifiable.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IVerifiable.cs 25 Oct 2002 03:02:25 -0000 1.1 --- IVerifiable.cs 13 Jan 2003 04:03:57 -0000 1.2 *************** *** 6,11 **** --- 6,15 ---- /// the correct behvaiour has occurred. /// </summary> + /// <remarks/> public interface IVerifiable { + /// <summary> + /// Verifies object + /// </summary> void Verify(); } Index: MockObject.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/MockObject.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MockObject.cs 30 Oct 2002 04:16:32 -0000 1.7 --- MockObject.cs 13 Jan 2003 04:03:57 -0000 1.8 *************** *** 6,18 **** /// Base Mock Object. All custom Mock Objects should extend this object. /// </summary> ! // TODO: Extend MarshalByRefObject to take care of remoting issues. public class MockObject : IVerifiable { protected string name = null; ! public MockObject(string name) { name = name; } public MockObject() { --- 6,28 ---- /// Base Mock Object. All custom Mock Objects should extend this object. /// </summary> ! /// <remarks/> ! // TODO: Extend MarshalByRefObject to take care of remoting issues. public class MockObject : IVerifiable { + /// <summary> + /// Field to hold the name of this MockObject + /// </summary> protected string name = null; ! /// <summary> ! /// Constructor. Sets the name of this MockObject ! /// </summary> ! /// <param name="name">Name of this MockObject</param> public MockObject(string name) { name = name; } + /// <summary> + /// Default Constructor. Sets this MockObject's name to "MockObject" + /// </summary> public MockObject() { Index: ReturnValue.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/ReturnValue.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReturnValue.cs 23 Sep 2002 20:16:00 -0000 1.3 --- ReturnValue.cs 13 Jan 2003 04:03:57 -0000 1.4 *************** *** 5,8 **** --- 5,12 ---- using System; + /// <summary> + /// Represent a queue of expected Return Values. + /// </summary> + /// <remarks/> public class ReturnValue { *************** *** 10,22 **** private bool hasReturnValues; private Queue returnValues = new Queue(); ! private string name = "Unnamed ReturnValue"; public ReturnValue() { } public ReturnValue(string newName) : base() { this.name = newName; } ! public bool RepeatFinalValue { --- 14,36 ---- private bool hasReturnValues; private Queue returnValues = new Queue(); ! private string name = ""; + /// <summary> + /// Default constructor. Sets name to "Unamed ReturnValue" + /// </summary> public ReturnValue() { + this.name = "Unnamed ReturnValue"; } + /// <summary> + /// Constructor. Sets the name of this Return Value to the given name. + /// </summary> + /// <param name="newName">Name of this Return Value</param> public ReturnValue(string newName) : base() { this.name = newName; } ! /// <summary> ! /// Gets/Sets if the Return Value should repeat the last value of the the group ! /// </summary> public bool RepeatFinalValue { *************** *** 30,34 **** } } ! public bool HasValues { --- 44,50 ---- } } ! /// <summary> ! /// Gets/Sets if this group has any return values ! /// </summary> public bool HasValues { *************** *** 42,46 **** } } ! public void Add(object nextReturnValue) { --- 58,65 ---- } } ! /// <summary> ! /// Adds a value to the group of return values ! /// </summary> ! /// <param name="nextReturnValue">Object to add</param> public void Add(object nextReturnValue) { *************** *** 48,52 **** this.returnValues.Enqueue(nextReturnValue); } ! public void AddCollection(ICollection values) { --- 67,74 ---- this.returnValues.Enqueue(nextReturnValue); } ! /// <summary> ! /// Adds a collection of values to the group of return values ! /// </summary> ! /// <param name="values">Collection to add</param> public void AddCollection(ICollection values) { *************** *** 56,60 **** } } ! public object Next() { --- 78,85 ---- } } ! /// <summary> ! /// Pop's the next value off the queue of return values. ! /// </summary> ! /// <returns>Next return value</returns> public object Next() { Index: Verifier.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Verifier.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Verifier.cs 25 Oct 2002 03:02:26 -0000 1.5 --- Verifier.cs 13 Jan 2003 04:03:57 -0000 1.6 *************** *** 5,10 **** /// <summary> ! /// Summary description for Verifier. /// </summary> public class Verifier { --- 5,11 ---- /// <summary> ! /// Verifies objects that implement the IVerifiable interface. /// </summary> + /// <remarks/> public class Verifier { *************** *** 36,41 **** /// each field. /// </summary> ! /// <param name="anObject">Object to verify.</param> ! /// <param name="aType">Current Type.</param> protected internal static void Verify(Object verifiableObject, Type currentType) { --- 37,42 ---- /// each field. /// </summary> ! /// <param name="verifiableObject">Object to verify.</param> ! /// <param name="currentType">Current Type.</param> protected internal static void Verify(Object verifiableObject, Type currentType) { *************** *** 57,62 **** /// Sets the object to the Verifiable interface, then calls verify(). /// </summary> ! /// <param name="aField">Current Field.</param> ! /// <param name="anObject">Current Object.</param> protected internal static void VerifyField(FieldInfo verifiableField, Object verifiableObject) { --- 58,63 ---- /// Sets the object to the Verifiable interface, then calls verify(). /// </summary> ! /// <param name="verifiableField">Current Field.</param> ! /// <param name="verifiableObject">Current Object.</param> protected internal static void VerifyField(FieldInfo verifiableField, Object verifiableObject) { Index: verifyException.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/verifyException.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** verifyException.cs 30 Oct 2002 04:16:32 -0000 1.1 --- verifyException.cs 13 Jan 2003 04:03:57 -0000 1.2 *************** *** 4,13 **** --- 4,34 ---- namespace DotNetMock { + /// <summary> + /// Exception thrown for errors in Verify() + /// </summary> [Serializable()] public class VerifyException : ApplicationException { + /// <summary> + /// Default constructor + /// </summary> public VerifyException() : base() {} + /// <summary> + /// Constructs a VerifyException with the provided message + /// </summary> + /// <param name="message">Message for this exception</param> public VerifyException(string message) : base(message) {} + /// <summary> + /// Constructs a VerifyException with the provided message and a reference to the inner + /// exception that caused this exception + /// </summary> + /// <param name="message">Message for this exception</param> + /// <param name="innerException">Inner exception for this exception</param> public VerifyException(string message, Exception innerException) : base(message, innerException) {} + /// <summary> + /// Constructs a VerifyException with serialized data + /// </summary> + /// <param name="serialInfo">Object that holds the serialized object data</param> + /// <param name="streamingContext">The contextual information about the source or destination</param> protected VerifyException(SerializationInfo serialInfo, StreamingContext streamingContext) : base(serialInfo, streamingContext) {} } |
From: <gc...@us...> - 2003-01-13 04:04:01
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv6875/DotNetMock/Dynamic Modified Files: Mock.cs Log Message: Index: Mock.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Mock.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mock.cs 30 Oct 2002 04:16:32 -0000 1.2 --- Mock.cs 13 Jan 2003 04:03:57 -0000 1.3 *************** *** 5,12 **** namespace DotNetMock.Dynamic { - public class Mock : IMock { - private string name; private object obj; --- 5,10 ---- |
From: <gc...@us...> - 2003-01-06 03:55:35
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data In directory sc8-pr-cvs1:/tmp/cvs-serv26752/DotNetMock/Data Removed Files: mockTransaction.cs Log Message: --- mockTransaction.cs DELETED --- |
From: <gc...@us...> - 2003-01-06 03:51:30
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data In directory sc8-pr-cvs1:/tmp/cvs-serv25791/DotNetMock/Data Modified Files: MockDataReader.cs Log Message: Index: MockDataReader.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data/MockDataReader.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockDataReader.cs 29 Dec 2002 02:47:39 -0000 1.2 --- MockDataReader.cs 6 Jan 2003 03:51:27 -0000 1.3 *************** *** 6,10 **** { /// <summary> ! /// Summary description for MockDataReader. /// </summary> public class MockDataReader : MockObject, IDataReader --- 6,10 ---- { /// <summary> ! /// This Mock Object implements the IDataReader interface. /// </summary> public class MockDataReader : MockObject, IDataReader *************** *** 24,51 **** --- 24,79 ---- #region Mock Methods + /// <summary> + /// Set records affected count to return from RecordsAffected property + /// </summary> + /// <param name="count">Count to expect</param> public void SetRecordsAffectedCount(int count) { _recordsAffectedCount = count; } + /// <summary> + /// Set number of Close() calls to expect + /// </summary> + /// <param name="calls">Count to expect</param> public void SetExpectedCloseCalls(int calls) { _closeCalls.Expected = calls; } + /// <summary> + /// Sets Schema Table to used + /// </summary> + /// <param name="schemaTable">DataTable to describe columns</param> public void SetSchemaTable(DataTable schemaTable) { _schemaTable = schemaTable; } + /// <summary> + /// Set number of Read() calls to expect + /// </summary> + /// <param name="readCalls">Count to expect</param> public void SetExpectedReadCalls(int readCalls) { _readCalls.Expected = readCalls; } + /// <summary> + /// Set value of IsClosed property + /// </summary> + /// <param name="isClosed">True/False</param> public void SetIsClosedValue(bool isClosed) { _isClosed = isClosed; } + /// <summary> + /// Set data to use for all get calls + /// </summary> + /// <param name="rows">Two-Dimensional array to read data from. Format: [Row,Column]</param> public void SetRows(object[,] rows) { _rows = rows; } + /// <summary> + /// Set exception to throw on any GetXXX() calls + /// </summary> + /// <param name="exception">Exception to throw</param> public void SetGetException(Exception exception) { *************** *** 54,57 **** --- 82,89 ---- #endregion #region Implementation of IDataReader + + /// <summary> + /// Increments the CloseCalls counter & sets IsClosed property to true + /// </summary> public void Close() { *************** *** 59,68 **** _isClosed = true; } ! public System.Data.DataTable GetSchemaTable() { return _schemaTable; } ! public bool NextResult() { --- 91,107 ---- _isClosed = true; } ! /// <summary> ! /// Gets SchemaTable ! /// </summary> ! /// <returns></returns> public System.Data.DataTable GetSchemaTable() { return _schemaTable; } ! /// <summary> ! /// Advances the data reader to the next result, when reading the result batch SQL statements ! /// Currently Not Implemented ! /// </summary> ! /// <returns>True</returns> public bool NextResult() { *************** *** 70,74 **** return true; } ! public bool Read() { --- 109,116 ---- return true; } ! /// <summary> ! /// Increments ReadCalls counter & increments current row of the Data Reader ! /// </summary> ! /// <returns>True if there are more results, False if there are no more records</returns> public bool Read() { *************** *** 81,85 **** return true; } ! public int Depth { --- 123,130 ---- return true; } ! /// <summary> ! /// Gets a value indicating the depth of nesting for the current row. ! /// Currently Not Implemented ! /// </summary> public int Depth { *************** *** 90,94 **** } } ! public bool IsClosed { --- 135,141 ---- } } ! /// <summary> ! /// Gets a value indicating whether the data reader is closed ! /// </summary> public bool IsClosed { *************** *** 98,102 **** } } ! public int RecordsAffected { --- 145,152 ---- } } ! /// <summary> ! /// Gets the number of rows changed, inserted, or deleted by executing the SQL statement ! /// Returns the value set by SetRecordsAffectedCount() ! /// </summary> public int RecordsAffected { *************** *** 113,121 **** #endregion #region Implementation of IDataRecord public int GetInt32(int i) { return Convert.ToInt32(GetValue(i)); } ! public object GetValue(int i) { --- 163,180 ---- #endregion #region Implementation of IDataRecord + /// <summary> + /// Gets the 32-bit signed integer value of the specified field + /// </summary> + /// <param name="i">Index of the field to find</param> + /// <returns>The 32-bit signed integer value of the specified field.</returns> public int GetInt32(int i) { return Convert.ToInt32(GetValue(i)); } ! /// <summary> ! /// Returns the value of the specified field ! /// </summary> ! /// <param name="i">Index of the field to find</param> ! /// <returns>The Object which will contain the field value upon return.</returns> public object GetValue(int i) { *************** *** 126,130 **** return _rows[_currentRow, i - 1]; } ! public bool IsDBNull(int i) { --- 185,193 ---- return _rows[_currentRow, i - 1]; } ! /// <summary> ! /// Return whether the specified field is set to null ! /// </summary> ! /// <param name="i">Index of the field to find</param> ! /// <returns>true if the specified field is set to null, otherwise false.</returns> public bool IsDBNull(int i) { *************** *** 136,140 **** return result; } ! public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) { --- 199,211 ---- return result; } ! /// <summary> ! /// Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset. Currently Not Implemented ! /// </summary> ! /// <param name="i">The zero-based column ordinal. </param> ! /// <param name="fieldOffset">The index within the field from which to begin the read operation. </param> ! /// <param name="buffer">The buffer into which to read the stream of bytes.</param> ! /// <param name="bufferoffset">The index for buffer to begin the read operation.</param> ! /// <param name="length">The number of bytes to read.</param> ! /// <returns>The actual number of bytes read.</returns> public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) { *************** *** 142,151 **** return 0; } ! public byte GetByte(int i) { return Convert.ToByte(GetValue(i)); } ! public System.Type GetFieldType(int i) { --- 213,230 ---- return 0; } ! /// <summary> ! /// Gets the 8-bit unsigned integer value of the specified column. ! /// </summary> ! /// <param name="i">The zero-based column ordinal.</param> ! /// <returns>The 8-bit unsigned integer value of the specified column.</returns> public byte GetByte(int i) { return Convert.ToByte(GetValue(i)); } ! /// <summary> ! /// Gets the Type information corresponding to the type of Object that would be returned from GetValue. Currently Not Implemented ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The Type information corresponding to the type of Object that would be returned from GetValue.</returns> public System.Type GetFieldType(int i) { *************** *** 153,162 **** return null; } ! public decimal GetDecimal(int i) { return Convert.ToDecimal(GetValue(i)); } ! public int GetValues(object[] values) { --- 232,249 ---- return null; } ! /// <summary> ! /// Gets the fixed-position numeric value of the specified field. ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The fixed-position numeric value of the specified field.</returns> public decimal GetDecimal(int i) { return Convert.ToDecimal(GetValue(i)); } ! /// <summary> ! /// Gets all the attribute fields in the collection for the current record. ! /// </summary> ! /// <param name="values">An array of Object to copy the attribute fields into. </param> ! /// <returns>The number of instances of Object in the array.</returns> public int GetValues(object[] values) { *************** *** 164,168 **** return 0; } ! public string GetName(int i) { --- 251,259 ---- return 0; } ! /// <summary> ! /// Gets the name for the field to find. Currently Not Implemented ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The name of the field or the empty string (""), if there is no value to return.</returns> public string GetName(int i) { *************** *** 170,189 **** return null; } ! public long GetInt64(int i) { return Convert.ToInt64(GetValue(i)); } ! public double GetDouble(int i) { return Convert.ToDouble(GetValue(i)); } ! public bool GetBoolean(int i) { return Convert.ToBoolean(GetValue(i)); } ! public System.Guid GetGuid(int i) { --- 261,296 ---- return null; } ! /// <summary> ! /// Gets the 64-bit signed integer value of the specified field. ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The 64-bit signed integer value of the specified field.</returns> public long GetInt64(int i) { return Convert.ToInt64(GetValue(i)); } ! /// <summary> ! /// Gets the double-precision floating point number of the specified field. ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The double-precision floating point number of the specified field.</returns> public double GetDouble(int i) { return Convert.ToDouble(GetValue(i)); } ! /// <summary> ! /// Gets the value of the specified column as a Boolean. ! /// </summary> ! /// <param name="i">The zero-based column ordinal. </param> ! /// <returns>The value of the column.</returns> public bool GetBoolean(int i) { return Convert.ToBoolean(GetValue(i)); } ! /// <summary> ! /// Returns the guid value of the specified field. Currently Not Implemented ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The guid value of the specified field.</returns> public System.Guid GetGuid(int i) { *************** *** 191,200 **** return new System.Guid(); } ! public System.DateTime GetDateTime(int i) { return Convert.ToDateTime(GetValue(i)); } ! public int GetOrdinal(string name) { --- 298,315 ---- return new System.Guid(); } ! /// <summary> ! /// Gets the date and time data value of the spcified field. ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The date and time data value of the spcified field.</returns> public System.DateTime GetDateTime(int i) { return Convert.ToDateTime(GetValue(i)); } ! /// <summary> ! /// Return the index of the named field. Currently Not Implemented ! /// </summary> ! /// <param name="name">The name of the field to find. </param> ! /// <returns>The index of the named field.</returns> public int GetOrdinal(string name) { *************** *** 202,206 **** return 0; } ! public string GetDataTypeName(int i) { --- 317,325 ---- return 0; } ! /// <summary> ! /// Gets the data type information for the specified field. Currently Not Implemented ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The data type information for the specified field.</returns> public string GetDataTypeName(int i) { *************** *** 208,218 **** return null; } ! public float GetFloat(int i) ! { this.NotImplemented("MockDataReader.GetFloat"); return 0; } ! public System.Data.IDataReader GetData(int i) { --- 327,345 ---- return null; } ! /// <summary> ! /// Gets the single-precision floating point number of the specified field. Currently Not Implemented ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The single-precision floating point number of the specified field.</returns> public float GetFloat(int i) ! { this.NotImplemented("MockDataReader.GetFloat"); return 0; } ! /// <summary> ! /// Gets an IDataReader to be used when the field points to more remote structured data. Currently Not Implemented ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>An IDataReader to be used when the field points to more remote structured data.</returns> public System.Data.IDataReader GetData(int i) { *************** *** 220,224 **** return null; } ! public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) { --- 347,359 ---- return null; } ! /// <summary> ! /// Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset. ! /// </summary> ! /// <param name="i">The zero-based column ordinal. </param> ! /// <param name="fieldoffset">The index within the row from which to begin the read operation. </param> ! /// <param name="buffer">The buffer into which to read the stream of bytes. </param> ! /// <param name="bufferoffset">The index for buffer to begin the read operation. </param> ! /// <param name="length">The number of bytes to read. </param> ! /// <returns></returns> public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) { *************** *** 226,245 **** return 0; } ! public string GetString(int i) { return Convert.ToString(GetValue(i)); } ! public char GetChar(int i) { return Convert.ToChar(GetValue(i)); } ! public short GetInt16(int i) { return Convert.ToInt16(GetValue(i)); } ! public object this[string name] { --- 361,394 ---- return 0; } ! /// <summary> ! /// Gets the string value of the specified field. ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The string value of the specified field.</returns> public string GetString(int i) { return Convert.ToString(GetValue(i)); } ! /// <summary> ! /// Gets the character value of the specified column. ! /// </summary> ! /// <param name="i">The zero-based column ordinal. </param> ! /// <returns>The character value of the specified column.</returns> public char GetChar(int i) { return Convert.ToChar(GetValue(i)); } ! /// <summary> ! /// Gets the 16-bit signed integer value of the specified field. ! /// </summary> ! /// <param name="i">The index of the field to find. </param> ! /// <returns>The 16-bit signed integer value of the specified field.</returns> public short GetInt16(int i) { return Convert.ToInt16(GetValue(i)); } ! /// <summary> ! /// Gets the specified column by name. ! /// </summary> public object this[string name] { *************** *** 249,253 **** } } ! public object this[int i] { --- 398,404 ---- } } ! /// <summary> ! /// Gets the specified column by index ! /// </summary> public object this[int i] { *************** *** 257,261 **** } } ! public int FieldCount { --- 408,414 ---- } } ! /// <summary> ! /// Gets the number of columns in the current row. Currently Not Implemented ! /// </summary> public int FieldCount { *************** *** 268,271 **** --- 421,429 ---- #endregion #endregion + /// <summary> + /// Finds the index of the given name + /// </summary> + /// <param name="name">Name of the column to find</param> + /// <returns>Column index of the given name</returns> private int findColumnIndexForName(string name) { |
From: <gc...@us...> - 2003-01-06 03:51:30
|
Update of /cvsroot/dotnetmock/dotnetmock In directory sc8-pr-cvs1:/tmp/cvs-serv25791 Modified Files: DotNetMock.Master.build Log Message: Index: DotNetMock.Master.build =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Master.build,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DotNetMock.Master.build 30 Oct 2002 04:46:51 -0000 1.4 --- DotNetMock.Master.build 6 Jan 2003 03:51:26 -0000 1.5 *************** *** 7,11 **** <property name="DotNetMock.Examples" value="DotNetMock.Examples"/> <property name="project.name" value="DotNetMock"/> ! <property name="version" value="0.2"/> <property name="build.dir" value="build/"/> <property name="dist.dir" value="dist"/> --- 7,11 ---- <property name="DotNetMock.Examples" value="DotNetMock.Examples"/> <property name="project.name" value="DotNetMock"/> ! <property name="version" value="0.3"/> <property name="build.dir" value="build/"/> <property name="dist.dir" value="dist"/> *************** *** 13,19 **** <property name="bin.dir" value="${package.dir}/bin/"/> <property name="src.dir" value="${package.dir}/src"/> - <tstamp/> - <target name="init" description="Setup environment"> <mkdir dir="${build.dir}" failonerror="false"/> --- 13,17 ---- *************** *** 23,27 **** <mkdir dir="${src.dir}" failonerror="false"/> </target> - <target name="clean" description="Cleans project to pre-build state"> <delete dir="${bin.dir}" failonerror="false"/> --- 21,24 ---- *************** *** 31,35 **** <delete dir="${build.dir}" failonerror="false"/> </target> - <target name="clean-all" description="Cleans all sub-projects to pre-build state"> <nant buildfile="${DotNetMock.Core}/${DotNetMock.Core}.build" target="clean"/> --- 28,31 ---- *************** *** 38,48 **** <call target="clean"/> </target> - <target name="test" depends="build-all"> ! <nunit> ! <formatter type="Xml"/> ! <test class="DotNetMock.Tests" assembly="${build.dir}/DotNetMock.Tests.dll" outfile="${build.dir}/DotNetMock.Tests.Results" /> ! </nunit> ! </target> <target name="build-all" description="Builds .NET Mock Object modules" depends="init"> <nant buildfile="${DotNetMock.Core}/${DotNetMock.Core}.build" target="build"/> --- 34,43 ---- <call target="clean"/> </target> <target name="test" depends="build-all"> ! <nunit> ! <formatter type="Xml"/> ! <test class="DotNetMock.Tests" assembly="${build.dir}/DotNetMock.Tests.dll" outfile="${build.dir}/DotNetMock.Tests.Results"/> ! </nunit> ! </target> <target name="build-all" description="Builds .NET Mock Object modules" depends="init"> <nant buildfile="${DotNetMock.Core}/${DotNetMock.Core}.build" target="build"/> *************** *** 50,54 **** <nant buildfile="${DotNetMock.Examples}/${DotNetMock.Examples}.build" target="build"/> </target> - <target name="package" description="Collects and packs up the distribution" depends="build-all doc"> <copy file="build/${DotNetMock.Core}.dll" tofile="${bin.dir}/${DotNetMock.Core}.dll"/> --- 45,48 ---- *************** *** 77,81 **** </zip> </target> - <target name="doc" description="build documentation"> <echo message="Requires HtmlHelp compiler (hhc.exe) to be in the system path"/> --- 71,74 ---- *************** *** 111,114 **** <copy file="${build.dir}/docs/MSDN/DotNetMock.chm" todir="${package.dir}/doc"/> </target> - </project> --- 104,106 ---- |
From: <gc...@us...> - 2002-12-29 02:47:42
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv13414/DotNetMock.Tests/Dynamic Modified Files: MockTests.cs PredicateTests.cs Log Message: Added MailingList Example Index: MockTests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic/MockTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockTests.cs 25 Oct 2002 03:02:27 -0000 1.2 --- MockTests.cs 29 Dec 2002 02:47:39 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- using NUnit.Framework; using DotNetMock.Dynamic; + using DotNetMock.Dynamic.Predicates; namespace DotNetMock.Tests.Dynamic *************** *** 40,44 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void NoCallToVoidMethod() { --- 41,45 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void NoCallToVoidMethod() { *************** *** 48,52 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void TooManyCallsToVoidMethod() { --- 49,53 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void TooManyCallsToVoidMethod() { *************** *** 77,81 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void CallToMethodWithInvalidParams() { --- 78,82 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void CallToMethodWithInvalidParams() { *************** *** 105,109 **** [Test] - [ExpectedException(typeof(AssertionException))] public void CallMultipleMethodsInWrongOrder() { --- 106,109 ---- *************** *** 138,142 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void CallToNonVoidMethodWithWrongParams() { --- 138,142 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void CallToNonVoidMethodWithWrongParams() { *************** *** 180,184 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void DefaultEqualsPredicatesFailure() { --- 180,184 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void DefaultEqualsPredicatesFailure() { Index: PredicateTests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic/PredicateTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PredicateTests.cs 25 Oct 2002 03:02:27 -0000 1.2 --- PredicateTests.cs 29 Dec 2002 02:47:39 -0000 1.3 *************** *** 3,6 **** --- 3,7 ---- using NUnit.Framework; using DotNetMock.Dynamic; + using DotNetMock.Dynamic.Predicates; namespace DotNetMock.Tests.Dynamic *************** *** 21,29 **** { p = new IsNull(); ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(!p.eval(new object())); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(!p.eval(true)); ! Assertion.Assert(!p.eval(false)); } --- 22,30 ---- { p = new IsNull(); ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(!p.Eval(new object())); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(!p.Eval(true)); ! Assertion.Assert(!p.Eval(false)); } *************** *** 32,37 **** { p = new NotNull(); ! Assertion.Assert(!p.eval(null)); ! Assertion.Assert(p.eval(new object())); } --- 33,38 ---- { p = new NotNull(); ! Assertion.Assert(!p.Eval(null)); ! Assertion.Assert(p.Eval(new object())); } *************** *** 42,56 **** object o2 = new object(); p = new IsEqual(o1); ! Assertion.Assert(p.eval(o1)); ! Assertion.Assert(!p.eval(o2)); ! Assertion.Assert(!p.eval(null)); int i1 = 1; int i2 = 2; p = new IsEqual(i1); ! Assertion.Assert(p.eval(i1)); ! Assertion.Assert(p.eval(1)); ! Assertion.Assert(!p.eval(i2)); ! Assertion.Assert(!p.eval(2)); } --- 43,57 ---- object o2 = new object(); p = new IsEqual(o1); ! Assertion.Assert(p.Eval(o1)); ! Assertion.Assert(!p.Eval(o2)); ! Assertion.Assert(!p.Eval(null)); int i1 = 1; int i2 = 2; p = new IsEqual(i1); ! Assertion.Assert(p.Eval(i1)); ! Assertion.Assert(p.Eval(1)); ! Assertion.Assert(!p.Eval(i2)); ! Assertion.Assert(!p.Eval(2)); } *************** *** 61,75 **** object o2 = new object(); p = new NotEqual(o1); ! Assertion.Assert(!p.eval(o1)); ! Assertion.Assert(p.eval(o2)); ! Assertion.Assert(p.eval(null)); int i1 = 1; int i2 = 2; p = new NotEqual(i1); ! Assertion.Assert(!p.eval(i1)); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(p.eval(i2)); ! Assertion.Assert(p.eval(2)); } --- 62,76 ---- object o2 = new object(); p = new NotEqual(o1); ! Assertion.Assert(!p.Eval(o1)); ! Assertion.Assert(p.Eval(o2)); ! Assertion.Assert(p.Eval(null)); int i1 = 1; int i2 = 2; p = new NotEqual(i1); ! Assertion.Assert(!p.Eval(i1)); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(p.Eval(i2)); ! Assertion.Assert(p.Eval(2)); } *************** *** 78,90 **** { p = new IsAnything(); ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(p.eval(0)); ! Assertion.Assert(p.eval(99)); ! Assertion.Assert(p.eval(-2)); ! Assertion.Assert(p.eval(true)); ! Assertion.Assert(p.eval(false)); ! Assertion.Assert(p.eval("")); ! Assertion.Assert(p.eval("hello")); ! Assertion.Assert(p.eval(new object())); } --- 79,91 ---- { p = new IsAnything(); ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(p.Eval(0)); ! Assertion.Assert(p.Eval(99)); ! Assertion.Assert(p.Eval(-2)); ! Assertion.Assert(p.Eval(true)); ! Assertion.Assert(p.Eval(false)); ! Assertion.Assert(p.Eval("")); ! Assertion.Assert(p.Eval("hello")); ! Assertion.Assert(p.Eval(new object())); } *************** *** 93,99 **** { p = new IsTypeOf(typeof(System.IO.TextReader)); ! Assertion.Assert(!p.eval(null)); ! Assertion.Assert(p.eval(new System.IO.StringReader(""))); ! Assertion.Assert(!p.eval(new System.IO.StringWriter())); } --- 94,100 ---- { p = new IsTypeOf(typeof(System.IO.TextReader)); ! Assertion.Assert(!p.Eval(null)); ! Assertion.Assert(p.Eval(new System.IO.StringReader(""))); ! Assertion.Assert(!p.Eval(new System.IO.StringWriter())); } *************** *** 101,106 **** public void Not() { ! Assertion.Assert(new Not(new False()).eval(null)); ! Assertion.Assert(!new Not(new True()).eval(null)); } --- 102,107 ---- public void Not() { ! Assertion.Assert(new NotPredicate(new False()).Eval(null)); ! Assertion.Assert(!new NotPredicate(new True()).Eval(null)); } *************** *** 108,115 **** public void And() { ! Assertion.Assert( new And(new True() , new True() ).eval(null)); ! Assertion.Assert(!new And(new True() , new False()).eval(null)); ! Assertion.Assert(!new And(new False(), new True() ).eval(null)); ! Assertion.Assert(!new And(new False(), new False()).eval(null)); } --- 109,116 ---- public void And() { ! Assertion.Assert( new AndPredicate(new True() , new True() ).Eval(null)); ! Assertion.Assert(!new AndPredicate(new True() , new False()).Eval(null)); ! Assertion.Assert(!new AndPredicate(new False(), new True() ).Eval(null)); ! Assertion.Assert(!new AndPredicate(new False(), new False()).Eval(null)); } *************** *** 117,124 **** public void Or() { ! Assertion.Assert( new Or(new True() , new True() ).eval(null)); ! Assertion.Assert( new Or(new True() , new False()).eval(null)); ! Assertion.Assert( new Or(new False(), new True() ).eval(null)); ! Assertion.Assert(!new Or(new False(), new False()).eval(null)); } --- 118,125 ---- public void Or() { ! Assertion.Assert( new OrPredicate(new True() , new True() ).Eval(null)); ! Assertion.Assert( new OrPredicate(new True() , new False()).Eval(null)); ! Assertion.Assert( new OrPredicate(new False(), new True() ).Eval(null)); ! Assertion.Assert(!new OrPredicate(new False(), new False()).Eval(null)); } *************** *** 127,143 **** { p = new IsIn(2, 3, 5); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(p.eval(2)); ! Assertion.Assert(p.eval(3)); ! Assertion.Assert(!p.eval(4)); ! Assertion.Assert(p.eval(5)); ! Assertion.Assert(!p.eval(6)); ! Assertion.Assert(!p.eval(null)); int[] array = {1, 2}; p = new IsIn(array); ! Assertion.Assert(p.eval(1)); ! Assertion.Assert(p.eval(2)); ! Assertion.Assert(!p.eval(3)); } --- 128,144 ---- { p = new IsIn(2, 3, 5); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(p.Eval(2)); ! Assertion.Assert(p.Eval(3)); ! Assertion.Assert(!p.Eval(4)); ! Assertion.Assert(p.Eval(5)); ! Assertion.Assert(!p.Eval(6)); ! Assertion.Assert(!p.Eval(null)); int[] array = {1, 2}; p = new IsIn(array); ! Assertion.Assert(p.Eval(1)); ! Assertion.Assert(p.Eval(2)); ! Assertion.Assert(!p.Eval(3)); } *************** *** 146,158 **** { p = new NotIn(1, 2); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(!p.eval(2)); ! Assertion.Assert(p.eval(3)); int[] array = {1, 2}; p = new NotIn(array); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(!p.eval(2)); ! Assertion.Assert(p.eval(3)); } --- 147,159 ---- { p = new NotIn(1, 2); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(!p.Eval(2)); ! Assertion.Assert(p.Eval(3)); int[] array = {1, 2}; p = new NotIn(array); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(!p.Eval(2)); ! Assertion.Assert(p.Eval(3)); } *************** *** 161,168 **** { p = new IsEqualIgnoreCase("heLLo"); ! Assertion.Assert(p.eval("HELLO")); ! Assertion.Assert(p.eval("hello")); ! Assertion.Assert(p.eval("HelLo")); ! Assertion.Assert(!p.eval("abcde")); } --- 162,169 ---- { p = new IsEqualIgnoreCase("heLLo"); ! Assertion.Assert(p.Eval("HELLO")); ! Assertion.Assert(p.Eval("hello")); ! Assertion.Assert(p.Eval("HelLo")); ! Assertion.Assert(!p.Eval("abcde")); } *************** *** 179,186 **** { p = new IsEqualIgnoreWhiteSpace("Hello World how\n are we?"); ! Assertion.Assert(p.eval("Hello World how are we?")); ! Assertion.Assert(p.eval(" Hello World how are \n\n\twe?")); ! Assertion.Assert(!p.eval("HelloWorld how are we?")); ! Assertion.Assert(!p.eval("Hello World how are we")); } --- 180,187 ---- { p = new IsEqualIgnoreWhiteSpace("Hello World how\n are we?"); ! Assertion.Assert(p.Eval("Hello World how are we?")); ! Assertion.Assert(p.Eval(" Hello World how are \n\n\twe?")); ! Assertion.Assert(!p.Eval("HelloWorld how are we?")); ! Assertion.Assert(!p.Eval("Hello World how are we")); } *************** *** 189,214 **** { p = new IsMatch(new Regex(@"^th[aeiou]\w* .*$")); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(!p.eval("ThE world")); ! Assertion.Assert(!p.eval(" the world")); ! Assertion.Assert(p.eval("thats nice")); ! Assertion.Assert(!p.eval(new object())); ! Assertion.Assert(!p.eval(null)); p = new IsMatch(@"^th[aeiou]\w* .*$"); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(!p.eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", false); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(!p.eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", true); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(p.eval("ThE world")); } --- 190,215 ---- { p = new IsMatch(new Regex(@"^th[aeiou]\w* .*$")); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(!p.Eval("ThE world")); ! Assertion.Assert(!p.Eval(" the world")); ! Assertion.Assert(p.Eval("thats nice")); ! Assertion.Assert(!p.Eval(new object())); ! Assertion.Assert(!p.Eval(null)); p = new IsMatch(@"^th[aeiou]\w* .*$"); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(!p.Eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", false); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(!p.Eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", true); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(p.Eval("ThE world")); } *************** *** 219,226 **** p = new Predicate(new Predicate.Method(myEval)); myFlag = false; ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(!p.eval(null)); ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(!p.eval(null)); } --- 220,227 ---- p = new Predicate(new Predicate.Method(myEval)); myFlag = false; ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(!p.Eval(null)); ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(!p.Eval(null)); } *************** *** 235,239 **** class True : IPredicate { ! public bool eval(object val) { return true; --- 236,240 ---- class True : IPredicate { ! public bool Eval(object val) { return true; *************** *** 243,247 **** class False : IPredicate { ! public bool eval(object val) { return false; --- 244,248 ---- class False : IPredicate { ! public bool Eval(object val) { return false; |
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/MailingList In directory sc8-pr-cvs1:/tmp/cvs-serv13414/DotNetMock.Examples/MailingList Added Files: DatabaseConstants.cs IListAction.cs MailingList.cs MailingListException.cs MailingListTests.cs MockListAction.cs Log Message: Added MailingList Example --- NEW FILE: DatabaseConstants.cs --- using System; namespace DotNetMock.Examples.MailingList { public class DatabaseConstants { public static int UNIQUE_CONSTRAINT_VIOLATED = 1; } } --- NEW FILE: IListAction.cs --- using System; namespace DotNetMock.Examples.MailingList { public interface IListAction { void ApplyTo(string email, string name); } } --- NEW FILE: MailingList.cs --- using System; using System.Data; using System.Data.SqlClient; namespace DotNetMock.Examples.MailingList { public class MailingList { public static string INSERT_SQL = "INSERT INTO mailing_list(email_address, name) VALUES (@email, @name)"; public static string DELETE_SQL = "DELETE FROM mailing_list WHERE email_address = @email"; public static string SELECT_SQL = "SELECT * FROM mailing_list"; public MailingList() { } public void AddMember(IDbConnection connection, string emailAddress, string name) { IDbCommand command = connection.CreateCommand(); try { command.CommandText = MailingList.INSERT_SQL; command.Parameters.Add(new SqlParameter("@email", emailAddress)); command.Parameters.Add(new SqlParameter("@name", name)); command.ExecuteNonQuery(); } catch (ConstraintException ex) { throw new MailingListException("Email address already exists:" + ex.Message); } catch (SqlException ex) { throw ex; } finally { connection.Close(); } } public void RemoveMember(IDbConnection connection, string email) { IDbCommand command = connection.CreateCommand(); try { command.CommandText = MailingList.DELETE_SQL; command.Parameters.Add(new SqlParameter("@email", email)); int rowsAffected = command.ExecuteNonQuery(); if (rowsAffected == 0) { throw new MailingListException("Could not find email address: " + email); } } finally { connection.Close(); } } public void ApplyToAllMembers(IDbConnection connection, IListAction listAction) { IDbCommand command = connection.CreateCommand(); try { command.CommandText = MailingList.SELECT_SQL; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { listAction.ApplyTo(reader.GetString(1), reader.GetString(2)); } } finally { connection.Close(); } } } } --- NEW FILE: MailingListException.cs --- using System; namespace DotNetMock.Examples.MailingList { public class MailingListException : ApplicationException { public MailingListException() : base() {} public MailingListException(string message) : base(message) {} public MailingListException(string message, Exception inner) : base(message, inner) {} } } --- NEW FILE: MailingListTests.cs --- using System; using System.Data; using System.Data.SqlClient; using NUnit.Framework; using DotNetMock.Data; namespace DotNetMock.Examples.MailingList { [TestFixture] public class MailingListTests { private string _email = "fre...@an...dress"; private string _name = "Fred Bloggs"; private MailingList _list = null; private MockListAction _mockListAction = null; private MockDbConnection _mockConnection = null; private MockCommand _mockCommand = null; private MockDataReader _mockReader = null; [SetUp] public void Init() { _list = new MailingList(); _mockListAction = new MockListAction(); _mockConnection = new MockDbConnection(); _mockCommand = new MockCommand(); _mockReader = new MockDataReader(); _mockConnection.SetupCommand(_mockCommand); } private void setGeneralExpectations() { _mockConnection.SetExpectedCreateCalls(1); _mockCommand.SetExpectedExecuteCalls(1); _mockConnection.SetExpectedCloseCalls(1); } private void setExpectationsForAddMember() { setGeneralExpectations(); _mockCommand.SetExpectedCommandText(MailingList.INSERT_SQL); _mockCommand.SetExpectedParameter(new MockDataParameter("@email", _email)); _mockCommand.SetExpectedParameter(new MockDataParameter("@name", _name)); setGeneralExpectations(); } private void setExpectationsForRemoveMember() { setGeneralExpectations(); _mockCommand.SetExpectedCommandText(MailingList.DELETE_SQL); _mockCommand.SetExpectedParameter(new MockDataParameter("@email", _email)); } private void setExpectationsForListMember() { setGeneralExpectations(); _mockCommand.SetExpectedReader(_mockReader); _mockCommand.SetExpectedCommandText(MailingList.SELECT_SQL); } private void verifyADO() { _mockCommand.Verify(); _mockConnection.Verify(); } [Test] public void AddNewMember() { setExpectationsForAddMember(); _list.AddMember(_mockConnection, _email, _name); verifyADO(); } [Test] [ExpectedException(typeof(MailingListException))] public void AddExistingMember() { setExpectationsForAddMember(); _mockCommand.SetExecuteException(new ConstraintException("Duplicate User")); _list.AddMember(_mockConnection, _email, _name); } [Test] public void CreateCommandFailsForAdd() { _mockConnection.SetCreateCommandException(new SystemException()); _mockConnection.SetExpectedCreateCalls(1); try { _list.AddMember(_mockConnection, _email, _name); Assertion.Fail("Should have thrown an exception."); } catch (SystemException ex) { } verifyADO(); } [Test] public void RemoveMember() { setExpectationsForRemoveMember(); _mockCommand.SetUpdateCount(1); _list.RemoveMember(_mockConnection, _email); verifyADO(); } [Test] public void RemoveMissingMember() { _mockCommand.SetUpdateCount(0); setExpectationsForRemoveMember(); try { _list.RemoveMember(_mockConnection, _email); } catch (MailingListException ex) { } verifyADO(); } [Test] public void ListOneMember() { setExpectationsForListMember(); object[,] values = new object[1,2]; values[0,0] = _email; values[0,1] = _name; _mockReader.SetRows(values); _mockReader.SetExpectedReadCalls(2); _mockListAction.AddExpectedMember(_email, _name); _mockListAction.SetExpectedMemberCount(1); _list.ApplyToAllMembers(_mockConnection, _mockListAction); verifyADO(); _mockReader.Verify(); _mockListAction.Verify(); } [Test] public void ListTwoMembers() { setExpectationsForListMember(); object[,] values = new object[2,2]; values[0,0] = _email; values[0,1] = _name; values[1,0] = _email; values[1,1] = _name; _mockReader.SetRows(values); _mockReader.SetExpectedReadCalls(3); _mockListAction.SetExpectedMemberCount(2); _mockListAction.AddExpectedMember(_email, _name); _mockListAction.AddExpectedMember(_email, _name); _list.ApplyToAllMembers(_mockConnection, _mockListAction); verifyADO(); _mockReader.Verify(); _mockListAction.Verify(); } [Test] public void ListNoMembers() { setExpectationsForListMember(); _mockReader.SetExpectedReadCalls(1); _mockListAction.SetExpectNoMembers(); _list.ApplyToAllMembers(_mockConnection, _mockListAction); verifyADO(); _mockReader.Verify(); _mockListAction.Verify(); } [Test] public void ListMemberFails() { setExpectationsForListMember(); object[,] values = new object[2,2]; values[0,0] = _email; values[0,1] = _name; values[1,0] = _email; values[1,1] = _name; _mockReader.SetRows(values); _mockReader.SetGetException(new ApplicationException("Mock Exception")); _mockReader.SetExpectedReadCalls(1); _mockListAction.SetExpectNoMembers(); try { _list.ApplyToAllMembers(_mockConnection, _mockListAction); Assertion.Fail("Should have thrown an exception."); } catch (ApplicationException ex) { } verifyADO(); _mockReader.Verify(); _mockListAction.Verify(); } } } --- NEW FILE: MockListAction.cs --- using System; namespace DotNetMock.Examples.MailingList { /// <summary> /// Summary description for MockListAction. /// </summary> public class MockListAction : MockObject, IListAction { private ExpectationCounter _memberCount = new ExpectationCounter("MockListAction.Count"); private ExpectationArrayList _members = new ExpectationArrayList("MockListAction.Members"); private MailingListException _exception = null; public MockListAction() { } #region Implementation of IListAction public void ApplyTo(string email, string name) { _memberCount.Inc(); if (_exception != null) throw _exception; _members.AddActualMany(new object[] {email, name}); } #endregion public void AddExpectedMember(string email, string name) { _members.AddExpectedMany(new object[] {email, name}); } public void SetExpectedMemberCount(int count) { _memberCount.Expected = count; } public void SetExpectNoMembers() { _memberCount.ExpectNothing(); _members.ExpectNothing(); } public void SetupMemberException(MailingListException exception) { _exception = exception; } } } |
From: <gc...@us...> - 2002-12-29 02:47:42
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic/Generate In directory sc8-pr-cvs1:/tmp/cvs-serv13414/DotNetMock.Tests/Dynamic/Generate Modified Files: ClassGeneratorTests.cs Log Message: Added MailingList Example Index: ClassGeneratorTests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic/Generate/ClassGeneratorTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClassGeneratorTests.cs 25 Oct 2002 03:02:27 -0000 1.2 --- ClassGeneratorTests.cs 29 Dec 2002 02:47:39 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- using NUnit.Framework; using DotNetMock.Dynamic; + using DotNetMock.Dynamic.Predicates; using DotNetMock.Dynamic.Generate; using System.Collections; *************** *** 137,141 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void CallMethodWithParamExpectationsThatFails() { --- 138,142 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void CallMethodWithParamExpectationsThatFails() { *************** *** 154,158 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void CallMethodWithTwoParamExpectationsThatFails() { --- 155,159 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void CallMethodWithTwoParamExpectationsThatFails() { |
From: <gc...@us...> - 2002-12-29 02:47:42
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data In directory sc8-pr-cvs1:/tmp/cvs-serv13414/DotNetMock/Data Modified Files: MockDataReader.cs Log Message: Added MailingList Example Index: MockDataReader.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data/MockDataReader.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockDataReader.cs 28 Dec 2002 21:36:34 -0000 1.1 --- MockDataReader.cs 29 Dec 2002 02:47:39 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- private object[,] _rows = new object[0,0]; private int _currentRow = -1; + private Exception _getException = null; public MockDataReader() {} *************** *** 47,50 **** --- 48,55 ---- _rows = rows; } + public void SetGetException(Exception exception) + { + _getException = exception; + } #endregion #region Implementation of IDataReader *************** *** 115,118 **** --- 120,127 ---- public object GetValue(int i) { + if (_getException != null) + { + throw _getException; + } return _rows[_currentRow, i - 1]; } |
From: <gc...@us...> - 2002-12-29 02:47:08
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/MailingList In directory sc8-pr-cvs1:/tmp/cvs-serv13377/MailingList Log Message: Directory /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/MailingList added to the repository |
From: <gc...@us...> - 2002-12-28 21:36:37
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/data In directory sc8-pr-cvs1:/tmp/cvs-serv6799/DotNetMock.Tests/data Modified Files: mockcommandtests.cs Added Files: mockdatareadertests.cs Log Message: --- NEW FILE: mockdatareadertests.cs --- using System; using System.Data; using DotNetMock.Data; using NUnit.Framework; namespace DotNetMock.Tests.Data { [TestFixture] public class MockDataReaderTests { private MockDataReader _reader = null; [SetUp] public void Init() { _reader = new MockDataReader(); } [TearDown] public void Destroy() { _reader = null; } [Test] public void RecordsAffectedSuccess() { _reader.SetRecordsAffectedCount(1); Assertion.AssertEquals("Records affected not equal.", 1, _reader.RecordsAffected); } [Test] [ExpectedException(typeof(AssertionException))] public void RecordsAffectedFails() { _reader.SetRecordsAffectedCount(2); Assertion.AssertEquals(3, _reader.RecordsAffected); } [Test] public void CloseCountCallsSuccess() { _reader.SetExpectedCloseCalls(3); _reader.Close(); _reader.Close(); _reader.Close(); _reader.Verify(); } [Test] [ExpectedException(typeof(AssertionException))] public void CloseCountCallsFails() { _reader.SetExpectedCloseCalls(1); _reader.Close(); _reader.Close(); _reader.Verify(); } [Test] public void GetSchemsTableSuccess() { DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("ID", typeof(int))); dataTable.Columns.Add(new DataColumn("Password", typeof(string))); dataTable.Columns.Add(new DataColumn("Email", typeof(string))); _reader.SetSchemaTable(dataTable); DataTable dataTable2 = new DataTable(); dataTable2.Columns.Add(new DataColumn("ID", typeof(int))); dataTable2.Columns.Add(new DataColumn("Password", typeof(string))); dataTable2.Columns.Add(new DataColumn("Email", typeof(string))); Assertion.Equals(dataTable2, _reader.GetSchemaTable()); } [Test] public void GetSchemaTableFails() { Assertion.AssertNull("Schema Table isn't empty.", _reader.GetSchemaTable()); } [Test] public void IsClosedSuccess() { _reader.SetIsClosedValue(true); Assertion.Assert(_reader.IsClosed); } [Test] public void IsCloseDefaultValue() { Assertion.Assert(!_reader.IsClosed); } [Test] public void ReadCountCallsSuccess() { _reader.SetExpectedReadCalls(3); _reader.Read(); _reader.Read(); _reader.Read(); _reader.Verify(); } [Test] [ExpectedException(typeof(AssertionException))] public void ReadCountCallsFails() { _reader.SetExpectedReadCalls(2); _reader.Read(); _reader.Read(); _reader.Read(); _reader.Verify(); } [Test] public void ReadSuccess() { _reader.SetExpectedReadCalls(3); _reader.SetRows(createObjectValues()); while (_reader.Read()) { } _reader.Verify(); } [Test] [ExpectedException(typeof(AssertionException))] public void ReadFailure() { _reader.SetExpectedReadCalls(2); _reader.SetRows(createObjectValues()); while (_reader.Read()) { } _reader.Verify(); } [Test] public void GetValueSuccess() { _reader.SetExpectedReadCalls(3); _reader.SetRows(createObjectValues()); int rowCount = 0; while (_reader.Read()) { for (int i = 0; i <= 1; i++) { Assertion.AssertEquals("Items not equal.", "Row " + rowCount + ", Column " + i, _reader.GetValue(i + 1)); } rowCount++; } _reader.Verify(); } [Test] public void IndexerIntSuccess() { _reader.SetExpectedReadCalls(3); _reader.SetRows(createObjectValues()); int rowCount = 0; while (_reader.Read()) { for (int i = 0; i <= 1; i++) { Assertion.AssertEquals("Items not equal.", "Row " + rowCount + ", Column " + i, _reader[i + 1]); } rowCount++; } _reader.Verify(); } [Test] [ExpectedException(typeof(IndexOutOfRangeException))] public void IndexerIntFails() { _reader.SetExpectedReadCalls(3); _reader.SetRows(createObjectValues()); int rowCount = 0; while (_reader.Read()) { for (int i = 0; i <= 1; i++) { Assertion.AssertEquals("Items not equal.", "Row " + rowCount + ", Column " + i, _reader[i + 3]); } rowCount++; } _reader.Verify(); } [Test] public void GetIntSuccess() { object[,] values = new object[2,2]; values[0,0] = 0; values[0,1] = 1; values[1,0] = 0; values[1,1] = 1; _reader.SetRows(values); _reader.SetExpectedReadCalls(3); while (_reader.Read()) { Assertion.AssertEquals(0, _reader.GetInt32(1)); Assertion.AssertEquals(1, _reader.GetInt32(2)); } _reader.Verify(); } [Test] [ExpectedException(typeof(IndexOutOfRangeException))] public void GetIntFails() { object[,] values = new object[2,2]; values[0,0] = 0; values[0,1] = 1; values[1,0] = 0; values[1,1] = 1; _reader.SetRows(values); _reader.SetExpectedReadCalls(3); while (_reader.Read()) { Assertion.AssertEquals(0, _reader.GetInt32(0)); Assertion.AssertEquals(1, _reader.GetInt32(1)); } _reader.Verify(); } [Test] public void IndexerStringSuccess() { _reader.SetExpectedReadCalls(2); DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("ID", typeof(int))); dataTable.Columns.Add(new DataColumn("Password", typeof(string))); _reader.SetSchemaTable(dataTable); object[,] values = new object[1,2]; values[0,0] = 123456; values[0,1] = "password"; _reader.SetRows(values); while (_reader.Read()) { Assertion.AssertEquals(123456, _reader["ID"]); Assertion.AssertEquals("password", _reader["Password"]); } _reader.Verify(); } [Test] [ExpectedException(typeof(IndexOutOfRangeException))] public void IndexerStringFails() { DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("ID", typeof(int))); dataTable.Columns.Add(new DataColumn("Password", typeof(string))); _reader.SetSchemaTable(dataTable); object[,] values = new object[2,2]; values[0,0] = 123456; values[0,1] = "password"; _reader.SetRows(values); while (_reader.Read()) { Assertion.AssertEquals(123456, _reader["Fakes"]); } _reader.Verify(); } private object[,] createObjectValues() { object[,] values = new object[2,2]; values[0,0] = "Row 0, Column 0"; values[0,1] = "Row 0, Column 1"; values[1,0] = "Row 1, Column 0"; values[1,1] = "Row 1, Column 1"; return values; } } } Index: mockcommandtests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/data/mockcommandtests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mockcommandtests.cs 29 Oct 2002 03:40:13 -0000 1.1 --- mockcommandtests.cs 28 Dec 2002 21:36:34 -0000 1.2 *************** *** 16,20 **** public void Destroy() { - _mockCmd.Dispose(); _mockCmd = null; } --- 16,19 ---- *************** *** 76,80 **** MockTransaction mockTransaction = new MockTransaction(); - NUnit.Framework.Assertion.AssertNull(_mockCmd.Connection); _mockCmd.Transaction = mockTransaction; NUnit.Framework.Assertion.AssertNotNull(_mockCmd.Transaction); --- 75,78 ---- *************** *** 82,85 **** --- 80,84 ---- NUnit.Framework.Assertion.AssertNotNull(_mockCmd.Connection); NUnit.Framework.Assertion.AssertEquals(typeof(MockDbConnection), _mockCmd.Connection.GetType()); + _mockCmd.Dispose(); } [Test] |
From: <gc...@us...> - 2002-12-28 21:36:36
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Data In directory sc8-pr-cvs1:/tmp/cvs-serv6799/DotNetMock/Data Added Files: MockDataReader.cs Log Message: --- NEW FILE: MockDataReader.cs --- using System; using System.Data; using DotNetMock; namespace DotNetMock.Data { /// <summary> /// Summary description for MockDataReader. /// </summary> public class MockDataReader : MockObject, IDataReader { private int _recordsAffectedCount = -1; private bool _isClosed = false; private ExpectationCounter _closeCalls = new ExpectationCounter("MockDataReader.CloseCalls"); private ExpectationCounter _readCalls = new ExpectationCounter("MockDataReader.ReadCalls"); private DataTable _schemaTable = null; private object[,] _rows = new object[0,0]; private int _currentRow = -1; public MockDataReader() {} #region Mock Methods public void SetRecordsAffectedCount(int count) { _recordsAffectedCount = count; } public void SetExpectedCloseCalls(int calls) { _closeCalls.Expected = calls; } public void SetSchemaTable(DataTable schemaTable) { _schemaTable = schemaTable; } public void SetExpectedReadCalls(int readCalls) { _readCalls.Expected = readCalls; } public void SetIsClosedValue(bool isClosed) { _isClosed = isClosed; } public void SetRows(object[,] rows) { _rows = rows; } #endregion #region Implementation of IDataReader public void Close() { _closeCalls.Inc(); _isClosed = true; } public System.Data.DataTable GetSchemaTable() { return _schemaTable; } public bool NextResult() { this.NotImplemented("MockDataReader.NextResult"); return true; } public bool Read() { _readCalls.Inc(); if (_currentRow + 1 >= _rows.GetLength(0)) { return false; } _currentRow++; return true; } public int Depth { get { this.NotImplemented("MockDataReader.Depth"); return 0; } } public bool IsClosed { get { return _isClosed; } } public int RecordsAffected { get { return _recordsAffectedCount; } } #region Implementation of IDisposable public void Dispose() { } #endregion #region Implementation of IDataRecord public int GetInt32(int i) { return Convert.ToInt32(GetValue(i)); } public object GetValue(int i) { return _rows[_currentRow, i - 1]; } public bool IsDBNull(int i) { bool result = true; if (!GetValue(i).Equals("")) { result = false; } return result; } public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) { this.NotImplemented("MockDataReader.GetBytes"); return 0; } public byte GetByte(int i) { return Convert.ToByte(GetValue(i)); } public System.Type GetFieldType(int i) { this.NotImplemented("MockDataReader.GetFieldType"); return null; } public decimal GetDecimal(int i) { return Convert.ToDecimal(GetValue(i)); } public int GetValues(object[] values) { this.NotImplemented("MockDataReader.GetValues"); return 0; } public string GetName(int i) { this.NotImplemented("MockDataReader.GetName"); return null; } public long GetInt64(int i) { return Convert.ToInt64(GetValue(i)); } public double GetDouble(int i) { return Convert.ToDouble(GetValue(i)); } public bool GetBoolean(int i) { return Convert.ToBoolean(GetValue(i)); } public System.Guid GetGuid(int i) { this.NotImplemented("MockDataReader.GetGuid"); return new System.Guid(); } public System.DateTime GetDateTime(int i) { return Convert.ToDateTime(GetValue(i)); } public int GetOrdinal(string name) { this.NotImplemented("MockDataReader.GetOrdinal"); return 0; } public string GetDataTypeName(int i) { this.NotImplemented("MockDataReader.GetDataTypeName"); return null; } public float GetFloat(int i) { this.NotImplemented("MockDataReader.GetFloat"); return 0; } public System.Data.IDataReader GetData(int i) { this.NotImplemented("MockDataReader.GetData"); return null; } public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) { this.NotImplemented("MockDataReader.GetChars"); return 0; } public string GetString(int i) { return Convert.ToString(GetValue(i)); } public char GetChar(int i) { return Convert.ToChar(GetValue(i)); } public short GetInt16(int i) { return Convert.ToInt16(GetValue(i)); } public object this[string name] { get { return this[findColumnIndexForName(name)]; } } public object this[int i] { get { return GetValue(i); } } public int FieldCount { get { this.NotImplemented("MockDataReader.FieldCount"); return 0; } } #endregion #endregion private int findColumnIndexForName(string name) { if (_schemaTable != null) { for (int i = 0; i < _schemaTable.Columns.Count; ++i) { if (_schemaTable.Columns[i].ColumnName.Equals(name)) { return i + 1; } } } throw new IndexOutOfRangeException("Column name: " + name + " not found"); } } } |
From: <gc...@us...> - 2002-12-28 21:36:36
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock In directory sc8-pr-cvs1:/tmp/cvs-serv6799/DotNetMock Modified Files: AbstractExpectationCollection.cs Log Message: Index: AbstractExpectationCollection.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/AbstractExpectationCollection.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractExpectationCollection.cs 25 Oct 2002 03:02:25 -0000 1.4 --- AbstractExpectationCollection.cs 28 Dec 2002 21:36:34 -0000 1.5 *************** *** 149,153 **** for (int i = 0; i < this.ActualCollection.Count; i++) { ! NUnit.Framework.Assertion.AssertEquals("Collection items not equal.", this.ExpectedCollection[i], this.ActualCollection[i]); } } --- 149,153 ---- for (int i = 0; i < this.ActualCollection.Count; i++) { ! NUnit.Framework.Assertion.AssertEquals("Collection items not equal.", this.ExpectedCollection[i].ToString(), this.ActualCollection[i].ToString()); } } |
From: <gc...@us...> - 2002-11-06 04:04:01
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic In directory usw-pr-cvs1:/tmp/cvs-serv13357/DotNetMock.Examples/Dynamic Modified Files: DefaultWeatherRandom.cs IWeatherRandom.cs Weather.cs WeatherTest.cs Log Message: Index: DefaultWeatherRandom.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic/DefaultWeatherRandom.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultWeatherRandom.cs 30 Oct 2002 04:46:51 -0000 1.1 --- DefaultWeatherRandom.cs 6 Nov 2002 04:03:58 -0000 1.2 *************** *** 3,7 **** namespace DotNetMock.Examples.Dynamic { ! public class DefaultWeatherRandom : WeatherRandom { public const double CHANCE_OF_RAIN = 0.2; --- 3,7 ---- namespace DotNetMock.Examples.Dynamic { ! public class DefaultWeatherRandom : IWeatherRandom { public const double CHANCE_OF_RAIN = 0.2; Index: IWeatherRandom.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic/IWeatherRandom.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IWeatherRandom.cs 30 Oct 2002 04:46:51 -0000 1.1 --- IWeatherRandom.cs 6 Nov 2002 04:03:58 -0000 1.2 *************** *** 3,7 **** namespace DotNetMock.Examples.Dynamic { ! public interface WeatherRandom { bool NextIsRaining(); --- 3,7 ---- namespace DotNetMock.Examples.Dynamic { ! public interface IWeatherRandom { bool NextIsRaining(); Index: Weather.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic/Weather.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Weather.cs 30 Oct 2002 04:46:51 -0000 1.1 --- Weather.cs 6 Nov 2002 04:03:58 -0000 1.2 *************** *** 4,12 **** public class Weather { ! private WeatherRandom random; private bool isRaining = false; private double temperature = 0.0; ! public Weather( WeatherRandom random ) { this.random = random; --- 4,12 ---- public class Weather { ! private IWeatherRandom random; private bool isRaining = false; private double temperature = 0.0; ! public Weather( IWeatherRandom random ) { this.random = random; Index: WeatherTest.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic/WeatherTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WeatherTest.cs 30 Oct 2002 04:46:51 -0000 1.1 --- WeatherTest.cs 6 Nov 2002 04:03:58 -0000 1.2 *************** *** 15,20 **** public void SetUp() { ! random = new DynamicMock(typeof(WeatherRandom)); ! weather = new Weather((WeatherRandom)random.Object); } --- 15,20 ---- public void SetUp() { ! random = new DynamicMock(typeof(IWeatherRandom)); ! weather = new Weather((IWeatherRandom)random.Object); } *************** *** 67,71 **** { IMock random = new DynamicMock(typeof(System.Random)); ! WeatherRandom weather = new DefaultWeatherRandom((System.Random)random.Object); random.SetValue("NextDouble", 0.0); --- 67,71 ---- { IMock random = new DynamicMock(typeof(System.Random)); ! IWeatherRandom weather = new DefaultWeatherRandom((System.Random)random.Object); random.SetValue("NextDouble", 0.0); *************** *** 83,87 **** { IMock random = new DynamicMock(typeof(System.Random)); ! WeatherRandom weather = new DefaultWeatherRandom((System.Random)random.Object); random.SetValue("NextDouble", 0.0); --- 83,87 ---- { IMock random = new DynamicMock(typeof(System.Random)); ! IWeatherRandom weather = new DefaultWeatherRandom((System.Random)random.Object); random.SetValue("NextDouble", 0.0); |
From: Griffin C. <gri...@ho...> - 2002-10-30 05:01:05
|
This is announcing the second release of the .NET Mock Object library, version 0.2. Change log can be viewed here: https://sourceforge.net/project/shownotes.php?group_id=54948&release_id=119404 Download the release here: https://sourceforge.net/project/showfiles.php?group_id=54948&release_id=119404 As always, feedback is welcome. -Griffin _________________________________________________________________ Choose an Internet access plan right for you -- try MSN! http://resourcecenter.msn.com/access/plans/default.asp |
From: <gc...@us...> - 2002-10-30 04:46:54
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic In directory usw-pr-cvs1:/tmp/cvs-serv3274/DotNetMock.Examples/Dynamic Added Files: DefaultWeatherRandom.cs IWeatherRandom.cs Weather.cs WeatherTest.cs Log Message: Added Examples project Added Dynamic Examples --- NEW FILE: DefaultWeatherRandom.cs --- using System; namespace DotNetMock.Examples.Dynamic { public class DefaultWeatherRandom : WeatherRandom { public const double CHANCE_OF_RAIN = 0.2; public const double MIN_TEMPERATURE = 20; public const double MAX_TEMPERATURE = 30; private const double TEMPERATURE_RANGE = (MAX_TEMPERATURE-MIN_TEMPERATURE); private System.Random rng; public DefaultWeatherRandom( System.Random rng ) { this.rng = rng; } public bool NextIsRaining() { return rng.NextDouble() < CHANCE_OF_RAIN; } public double NextTemperature() { return MIN_TEMPERATURE + rng.NextDouble() * TEMPERATURE_RANGE; } } } --- NEW FILE: IWeatherRandom.cs --- using System; namespace DotNetMock.Examples.Dynamic { public interface WeatherRandom { bool NextIsRaining(); double NextTemperature(); } } --- NEW FILE: Weather.cs --- namespace DotNetMock.Examples.Dynamic { public class Weather { private WeatherRandom random; private bool isRaining = false; private double temperature = 0.0; public Weather( WeatherRandom random ) { this.random = random; } public bool IsRaining { get { return isRaining; } } public double Temperature { get { return temperature; } } public void Randomize() { temperature = random.NextTemperature(); isRaining = random.NextIsRaining(); if( isRaining ) temperature *= 0.5; } } } --- NEW FILE: WeatherTest.cs --- using NUnit.Framework; using DotNetMock.Dynamic; namespace DotNetMock.Examples.Dynamic { [TestFixture] public class WeatherTest { private IMock random; private Weather weather; [SetUp] public void SetUp() { random = new DynamicMock(typeof(WeatherRandom)); weather = new Weather((WeatherRandom)random.Object); } [Test] public void RandomRaining() { random.SetValue("NextTemperature", 1.0); random.SetValue("NextIsRaining", true); weather.Randomize(); Assertion.Assert("is raining", weather.IsRaining); } [Test] public void RandomNotRaining() { random.SetValue("NextTemperature", 1.0); random.SetValue("NextIsRaining", false); weather.Randomize(); Assertion.Assert("is not raining", !weather.IsRaining); } [Test] public void RandomTemperatureSunny() { double TEMPERATURE = 20.0; random.SetValue("NextTemperature", TEMPERATURE); random.SetValue("NextIsRaining", false); weather.Randomize(); Assertion.AssertEquals("temperature", TEMPERATURE, weather.Temperature); } [Test] public void RandomTemperatureRaining() { double TEMPERATURE = 20.0; random.SetValue("NextTemperature", TEMPERATURE); random.SetValue("NextIsRaining", true); weather.Randomize(); Assertion.AssertEquals("temperature", TEMPERATURE / 2.0, weather.Temperature); } } [TestFixture] public class DefaultWeatherRandomTest { [Test] public void NextIsRaining() { IMock random = new DynamicMock(typeof(System.Random)); WeatherRandom weather = new DefaultWeatherRandom((System.Random)random.Object); random.SetValue("NextDouble", 0.0); Assertion.Assert("is raining", weather.NextIsRaining()); random.SetValue("NextDouble", DefaultWeatherRandom.CHANCE_OF_RAIN); Assertion.Assert("is not raining", !weather.NextIsRaining()); random.SetValue("NextDouble", 1.0); Assertion.Assert("is not raining", !weather.NextIsRaining()); } [Test] public void NextTemperature() { IMock random = new DynamicMock(typeof(System.Random)); WeatherRandom weather = new DefaultWeatherRandom((System.Random)random.Object); random.SetValue("NextDouble", 0.0); Assertion.AssertEquals("should be min temperature", DefaultWeatherRandom.MIN_TEMPERATURE, weather.NextTemperature() ); random.SetValue("NextDouble", 0.5); Assertion.AssertEquals("should be average temperature", 0.5 * (DefaultWeatherRandom.MIN_TEMPERATURE + DefaultWeatherRandom.MAX_TEMPERATURE), weather.NextTemperature() ); random.SetValue("NextDouble", 1.0); Assertion.AssertEquals("should be max temperature", DefaultWeatherRandom.MAX_TEMPERATURE, weather.NextTemperature() ); } } } |
From: <gc...@us...> - 2002-10-30 04:46:54
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples In directory usw-pr-cvs1:/tmp/cvs-serv3274/DotNetMock.Examples Added Files: AssemblyInfo.cs DotNetMock.Examples.build DotNetMock.Examples.csproj Log Message: Added Examples project Added Dynamic Examples --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] --- NEW FILE: DotNetMock.Examples.build --- <?xml version="1.0"?> <project name=".NET Mock Objects Examples"> <description>Build file for Example .NET Mock Objects module</description> <property name="debug" value="true"/> <property name="build.dir" value="../build/"/> <property name="project.name" value="DotNetMock.Examples"/> <tstamp/> <target name="init" description="Setup environment"> <mkdir dir="${build.dir}" failonerror="false"/> </target> <target name="clean" description="Cleans environment to pre-build state"> <delete dir="${build.dir}" failonerror="false"/> <delete file="../lib/${project.name}.dll" failonerror="false"/> </target> <target name="build" description="Builds .NET Mock Object Example module" depends="init"> <csc target="library" output="${build.dir}/${project.name}.dll" debug="${debug}" doc="${build.dir}\${project.name}.xml"> <sources basedir="."> <includes name="**/*.cs"/> </sources> <references basedir="../lib"> <includes name="nunit.framework.dll" /> <includes name="DotNetMock.dll"/> </references> </csc> <copy file="${build.dir}/${project.name}.dll" todir="../lib"/> </target> </project> --- NEW FILE: DotNetMock.Examples.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.0.9466" SchemaVersion = "1.0" ProjectGuid = "{80B98B32-57CB-4989-B506-0F2B0AD94DBA}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "DotNetMock.Examples" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" RootNamespace = "DotNetMock.Examples" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "true" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.XML" HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> <Reference Name = "DotNetMock" Project = "{1AD0CD00-16FA-4456-B2ED-A47406957228}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> <Reference Name = "nunit.framework" AssemblyName = "nunit.framework" HintPath = "..\lib\nunit.framework.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Dynamic\DefaultWeatherRandom.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Dynamic\IWeatherRandom.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Dynamic\Weather.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Dynamic\WeatherTest.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> |
From: <gc...@us...> - 2002-10-30 04:46:54
|
Update of /cvsroot/dotnetmock/dotnetmock In directory usw-pr-cvs1:/tmp/cvs-serv3274 Modified Files: DotNetMock.Master.build DotNetMock.sln Removed Files: DotNetMock.suo Log Message: Added Examples project Added Dynamic Examples Index: DotNetMock.Master.build =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Master.build,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DotNetMock.Master.build 29 Oct 2002 03:40:13 -0000 1.3 --- DotNetMock.Master.build 30 Oct 2002 04:46:51 -0000 1.4 *************** *** 5,10 **** <property name="DotNetMock.Core" value="DotNetMock"/> <property name="DotNetMock.Tests" value="DotNetMock.Tests"/> <property name="project.name" value="DotNetMock"/> ! <property name="version" value="0.1"/> <property name="build.dir" value="build/"/> <property name="dist.dir" value="dist"/> --- 5,11 ---- <property name="DotNetMock.Core" value="DotNetMock"/> <property name="DotNetMock.Tests" value="DotNetMock.Tests"/> + <property name="DotNetMock.Examples" value="DotNetMock.Examples"/> <property name="project.name" value="DotNetMock"/> ! <property name="version" value="0.2"/> <property name="build.dir" value="build/"/> <property name="dist.dir" value="dist"/> *************** *** 34,37 **** --- 35,39 ---- <nant buildfile="${DotNetMock.Core}/${DotNetMock.Core}.build" target="clean"/> <nant buildfile="${DotNetMock.Tests}/${DotNetMock.Tests}.build" target="clean"/> + <nant buildfile="${DotNetMock.Examples}/${DotNetMock.Examples}.build" target="clean"/> <call target="clean"/> </target> *************** *** 46,49 **** --- 48,52 ---- <nant buildfile="${DotNetMock.Core}/${DotNetMock.Core}.build" target="build"/> <nant buildfile="${DotNetMock.Tests}/${DotNetMock.Tests}.build" target="build"/> + <nant buildfile="${DotNetMock.Examples}/${DotNetMock.Examples}.build" target="build"/> </target> *************** *** 51,54 **** --- 54,58 ---- <copy file="build/${DotNetMock.Core}.dll" tofile="${bin.dir}/${DotNetMock.Core}.dll"/> <copy file="build/${DotNetMock.Tests}.dll" tofile="${bin.dir}/${DotNetMock.Tests}.dll"/> + <copy file="build/${DotNetMock.Examples}.dll" tofile="${bin.dir}/${DotNetMock.Examples}.dll"/> <copy file="lib/nunit.framework.dll" tofile="${bin.dir}/nunit.framework.dll"/> <copy todir="${src.dir}/${DotNetMock.Core}"> *************** *** 59,62 **** --- 63,71 ---- <copy todir="${src.dir}/${DotNetMock.Tests}"> <fileset basedir="${DotNetMock.Tests}"> + <includes name="**/*.cs"/> + </fileset> + </copy> + <copy todir="${src.dir}/${DotNetMock.Examples}"> + <fileset basedir="${DotNetMock.Examples}"> <includes name="**/*.cs"/> </fileset> Index: DotNetMock.sln =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.sln,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DotNetMock.sln 29 Sep 2002 23:15:57 -0000 1.3 --- DotNetMock.sln 30 Oct 2002 04:46:51 -0000 1.4 *************** *** 1,7 **** Microsoft Visual Studio Solution File, Format Version 7.00 - Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetMock", "dotnetmock\DotNetMock.csproj", "{1AD0CD00-16FA-4456-B2ED-A47406957228}" - EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetMock.Tests", "DotNetMock.Tests\DotNetMock.Tests.csproj", "{0FBE418F-86AF-4E83-B66F-C0177CE582BC}" EndProject Global GlobalSection(SolutionConfiguration) = preSolution --- 1,9 ---- Microsoft Visual Studio Solution File, Format Version 7.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetMock.Tests", "DotNetMock.Tests\DotNetMock.Tests.csproj", "{0FBE418F-86AF-4E83-B66F-C0177CE582BC}" EndProject + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetMock", "DotNetMock\DotNetMock.csproj", "{1AD0CD00-16FA-4456-B2ED-A47406957228}" + EndProject + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetMock.Examples", "DotNetMock.Examples\DotNetMock.Examples.csproj", "{80B98B32-57CB-4989-B506-0F2B0AD94DBA}" + EndProject Global GlobalSection(SolutionConfiguration) = preSolution *************** *** 12,23 **** EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution - {1AD0CD00-16FA-4456-B2ED-A47406957228}.Debug.ActiveCfg = Debug|.NET - {1AD0CD00-16FA-4456-B2ED-A47406957228}.Debug.Build.0 = Debug|.NET - {1AD0CD00-16FA-4456-B2ED-A47406957228}.Release.ActiveCfg = Release|.NET - {1AD0CD00-16FA-4456-B2ED-A47406957228}.Release.Build.0 = Release|.NET {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Debug.ActiveCfg = Debug|.NET {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Debug.Build.0 = Debug|.NET {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Release.ActiveCfg = Release|.NET {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Release.Build.0 = Release|.NET EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution --- 14,29 ---- EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Debug.ActiveCfg = Debug|.NET {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Debug.Build.0 = Debug|.NET {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Release.ActiveCfg = Release|.NET {0FBE418F-86AF-4E83-B66F-C0177CE582BC}.Release.Build.0 = Release|.NET + {1AD0CD00-16FA-4456-B2ED-A47406957228}.Debug.ActiveCfg = Debug|.NET + {1AD0CD00-16FA-4456-B2ED-A47406957228}.Debug.Build.0 = Debug|.NET + {1AD0CD00-16FA-4456-B2ED-A47406957228}.Release.ActiveCfg = Release|.NET + {1AD0CD00-16FA-4456-B2ED-A47406957228}.Release.Build.0 = Release|.NET + {80B98B32-57CB-4989-B506-0F2B0AD94DBA}.Debug.ActiveCfg = Debug|.NET + {80B98B32-57CB-4989-B506-0F2B0AD94DBA}.Debug.Build.0 = Debug|.NET + {80B98B32-57CB-4989-B506-0F2B0AD94DBA}.Release.ActiveCfg = Release|.NET + {80B98B32-57CB-4989-B506-0F2B0AD94DBA}.Release.Build.0 = Release|.NET EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution --- DotNetMock.suo DELETED --- |
From: <gc...@us...> - 2002-10-30 04:45:44
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic In directory usw-pr-cvs1:/tmp/cvs-serv2893/Dynamic Log Message: Directory /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples/Dynamic added to the repository |
From: <gc...@us...> - 2002-10-30 04:45:20
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples In directory usw-pr-cvs1:/tmp/cvs-serv2769/DotNetMock.Examples Log Message: Directory /cvsroot/dotnetmock/dotnetmock/DotNetMock.Examples added to the repository |
From: <gc...@us...> - 2002-10-30 04:16:35
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests In directory usw-pr-cvs1:/tmp/cvs-serv28292/DotNetMock.Tests Modified Files: NullTests.cs Log Message: Index: NullTests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/NullTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NullTests.cs 25 Oct 2002 03:02:26 -0000 1.2 --- NullTests.cs 30 Oct 2002 04:16:33 -0000 1.3 *************** *** 10,14 **** public class NullTests { ! private Null _null = null; public NullTests(string name) : base() {} --- 10,14 ---- public class NullTests { ! private NullObject _null = null; public NullTests(string name) : base() {} *************** *** 17,21 **** [SetUp] public void SetUp() { ! _null = new Null(); } --- 17,21 ---- [SetUp] public void SetUp() { ! _null = new NullObject(); } *************** *** 28,34 **** public void Null() { NUnit.Framework.Assertion.AssertEquals("null", _null.ToString()); ! _null = new Null("Null Object"); NUnit.Framework.Assertion.AssertEquals("Null Object", _null.ToString()); ! Null null2 = new Null(); int int1 = 3; NUnit.Framework.Assertion.Assert(!_null.Equals(int1)); --- 28,34 ---- public void Null() { NUnit.Framework.Assertion.AssertEquals("null", _null.ToString()); ! _null = new NullObject("Null Object"); NUnit.Framework.Assertion.AssertEquals("Null Object", _null.ToString()); ! NullObject null2 = new NullObject(); int int1 = 3; NUnit.Framework.Assertion.Assert(!_null.Equals(int1)); |
From: <gc...@us...> - 2002-10-30 04:16:35
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic In directory usw-pr-cvs1:/tmp/cvs-serv28292/DotNetMock/Dynamic Modified Files: DynamicMock.cs IMock.cs IPredicate.cs Mock.cs Removed Files: Predicate.cs Log Message: Index: DynamicMock.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/DynamicMock.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DynamicMock.cs 12 Oct 2002 03:29:53 -0000 1.1 --- DynamicMock.cs 30 Oct 2002 04:16:32 -0000 1.2 *************** *** 6,12 **** public class DynamicMock : Mock { private object obj; private Type type; ! public DynamicMock(Type type) : this(type, null) { --- 6,13 ---- public class DynamicMock : Mock { + private object obj; private Type type; ! public DynamicMock(Type type) : this(type, null) { *************** *** 18,22 **** Name = "Mock" + name; } ! public DynamicMock(Type type, string name) : base(name) { --- 19,23 ---- Name = "Mock" + name; } ! public DynamicMock(Type type, string name) : base(name) { Index: IMock.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/IMock.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IMock.cs 12 Oct 2002 03:29:53 -0000 1.1 --- IMock.cs 30 Oct 2002 04:16:32 -0000 1.2 *************** *** 21,27 **** --- 21,38 ---- /// <summary> + /// If strict, any method called that doesn't have an expectation set + /// will fail. (Defaults false) + /// </summary> + bool Strict { get; set; } + + /// <summary> /// Expect a method to be called with the supplied parameters. /// </summary> void Expect(string methodName, params object[] args); + + /// <summary> + /// Expect no call to this method. + /// </summary> + void ExpectNoCall(string methodName); /// <summary> Index: IPredicate.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/IPredicate.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IPredicate.cs 12 Oct 2002 03:29:53 -0000 1.1 --- IPredicate.cs 30 Oct 2002 04:16:32 -0000 1.2 *************** *** 1,12 **** - using System; - namespace DotNetMock.Dynamic { - /// <summary> - /// Interface for all Predicates to implement. - /// </summary> public interface IPredicate ! { ! bool eval(object val); } } --- 1,7 ---- namespace DotNetMock.Dynamic { public interface IPredicate ! { ! bool Eval(object currentValue); } } Index: Mock.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Mock.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mock.cs 12 Oct 2002 03:29:53 -0000 1.1 --- Mock.cs 30 Oct 2002 04:16:32 -0000 1.2 *************** *** 1,17 **** using System; using System.Collections; ! using NUnit.Framework; ! namespace DotNetMock.Dynamic { ! /// <summary> ! /// Summary description for Mock. ! /// </summary> public class Mock : IMock { ! private int currentExpectation; private string name; private object obj; ! private IList expectations; private IDictionary values; --- 1,16 ---- using System; using System.Collections; ! using DotNetMock.Dynamic.Predicates; ! namespace DotNetMock.Dynamic { ! public class Mock : IMock { ! private string name; private object obj; ! private bool strict; ! private IDictionary expectations; private IDictionary values; *************** *** 19,25 **** { this.name = name; ! expectations = new ArrayList(); values = new Hashtable(); - currentExpectation = 0; } --- 18,23 ---- { this.name = name; ! expectations = new Hashtable(); values = new Hashtable(); } *************** *** 36,42 **** } public virtual void Verify() { ! Assertion.AssertEquals(currentExpectation, expectations.Count); } --- 34,49 ---- } + public virtual bool Strict + { + get { return strict; } + set { strict = value; } + } + public virtual void Verify() { ! foreach (IList list in expectations.Values) ! { ! Assertion.AssertEquals(0, list.Count); ! } } *************** *** 46,57 **** } public virtual void ExpectAndReturn(string methodName, object result, params object[] args) { ! expectations.Add(new Expectation(methodName, result, null, args)); } public virtual void ExpectAndThrow(string methodName, Exception e, params object[] args) { ! expectations.Add(new Expectation(methodName, null, e, args)); } --- 53,69 ---- } + public virtual void ExpectNoCall(string methodName) + { + addExpectation(new Expectation(methodName, null, new VerifyException(methodName + "() should never be called."), null)); + } + public virtual void ExpectAndReturn(string methodName, object result, params object[] args) { ! addExpectation(new Expectation(methodName, result, null, args)); } public virtual void ExpectAndThrow(string methodName, Exception e, params object[] args) { ! addExpectation(new Expectation(methodName, null, e, args)); } *************** *** 67,82 **** return values[methodName]; } ! if (currentExpectation == expectations.Count) { Assertion.Fail(methodName + "() called too many times"); } ! Expectation exp = (Expectation)expectations[currentExpectation]; ! currentExpectation++; ! return exp.Verify(methodName, args); } private class Expectation { ! private string methodName; private object[] args; private object returnValue; --- 79,115 ---- return values[methodName]; } ! ! IList list = (IList) expectations[methodName]; ! if (list == null) ! { ! if ( strict ) ! { ! throw new VerifyException(methodName + "() called too many times"); ! } ! return null; ! } ! if (list.Count == 0) { Assertion.Fail(methodName + "() called too many times"); } ! Expectation e = (Expectation)list[0]; ! list.RemoveAt(0); ! return e.Verify(methodName, args); ! } ! ! private void addExpectation(Expectation e) ! { ! IList list = (IList) expectations[e.MethodName]; ! if (list == null) ! { ! list = new ArrayList(); ! expectations[e.MethodName] = list; ! } ! list.Add(e); } private class Expectation { ! public string MethodName; private object[] args; private object returnValue; *************** *** 85,89 **** public Expectation(string methodName, object returnValue, Exception e, object[] args) { ! this.methodName = methodName; if (args == null) { --- 118,122 ---- public Expectation(string methodName, object returnValue, Exception e, object[] args) { ! this.MethodName = methodName; if (args == null) { *************** *** 99,105 **** } ! public object Verify(string methodName, object[] args) { ! Assertion.AssertEquals(this.methodName, methodName); // assert that each passed in arg is validated by the appropriate predicate. --- 132,138 ---- } ! public virtual object Verify(string methodName, object[] args) { ! Assertion.AssertEquals(this.MethodName, methodName); // assert that each passed in arg is validated by the appropriate predicate. *************** *** 124,128 **** } ! Assertion.Assert(predicate.eval(actualArg)); } --- 157,161 ---- } ! Assertion.Assert(predicate.Eval(actualArg)); } *************** *** 136,139 **** --- 169,200 ---- } } + + private class Assertion + { + public static void Assert(bool expression) + { + if (!expression) + { + Fail("Verification failed."); + } + } + + public static void AssertEquals(object a, object b) + { + if (! a.Equals(b)) + { + Fail("Verification failed."); + } + } + + public static void Fail(string msg) + { + throw new VerifyException(msg); + } + } + + + } + } --- Predicate.cs DELETED --- |
From: <gc...@us...> - 2002-10-30 04:16:35
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Generate In directory usw-pr-cvs1:/tmp/cvs-serv28292/DotNetMock/Dynamic/Generate Modified Files: ClassGenerator.cs Log Message: Index: ClassGenerator.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Generate/ClassGenerator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClassGenerator.cs 12 Oct 2002 03:29:53 -0000 1.1 --- ClassGenerator.cs 30 Oct 2002 04:16:32 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- using System.Reflection; using System.Reflection.Emit; + using System.Security; namespace DotNetMock.Dynamic.Generate *************** *** 9,13 **** { private static IDictionary boxingOpCodes; ! public object Generate(Type type, IMock mock) { --- 10,14 ---- { private static IDictionary boxingOpCodes; ! public object Generate(Type type, IMock mock) { *************** *** 116,125 **** il.MarkLabel(l); il.Emit(OpCodes.Ldloc_0); ! } il.Emit(OpCodes.Ret); } ! public OpCode GetBoxingOpCode( Type aType ) { if (boxingOpCodes == null) --- 117,126 ---- il.MarkLabel(l); il.Emit(OpCodes.Ldloc_0); ! } il.Emit(OpCodes.Ret); } ! public OpCode GetBoxingOpCode( Type currentType ) { if (boxingOpCodes == null) *************** *** 139,145 **** boxingOpCodes[typeof(bool)] = OpCodes.Ldind_I1; } ! if (boxingOpCodes.Contains(aType)) { ! return (OpCode)boxingOpCodes[aType]; } else --- 140,146 ---- boxingOpCodes[typeof(bool)] = OpCodes.Ldind_I1; } ! if (boxingOpCodes.Contains(currentType)) { ! return (OpCode)boxingOpCodes[currentType]; } else *************** *** 150,153 **** } ! } --- 151,155 ---- } ! ! } |
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates In directory usw-pr-cvs1:/tmp/cvs-serv28292/DotNetMock/Dynamic/Predicates Added Files: AndPredicate.cs IsAnything.cs IsCloseTo.cs IsEqual.cs IsEqualIgnoreCase.cs IsEqualIgnoreWhiteSpace.cs IsIn.cs IsMatch.cs IsNull.cs IsTypeOf.cs NotEqual.cs NotIn.cs NotNull.cs NotPredicate.cs OrPredicate.cs Predicate.cs Log Message: --- NEW FILE: AndPredicate.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class AndPredicate : IPredicate { private IPredicate p1, p2; public AndPredicate(IPredicate p1, IPredicate p2) { this.p1 = p1; this.p2 = p2; } public bool Eval(object currentValue) { return p1.Eval(currentValue) && p2.Eval(currentValue); } } } --- NEW FILE: IsAnything.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class IsAnything : IPredicate { public bool Eval(object currentValue) { return true; } } } --- NEW FILE: IsCloseTo.cs --- using System; using System.Globalization; namespace DotNetMock.Dynamic.Predicates { public class IsCloseTo : IPredicate { private double expected; private double error; public IsCloseTo(double expected, double error) { this.expected = expected; this.error = error; } public bool Eval(object currentValue) { try { double actual = Convert.ToDouble(currentValue, CultureInfo.CurrentCulture); return Math.Abs(actual - expected) <= error; } catch (FormatException) { return false; } } } } --- NEW FILE: IsEqual.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class IsEqual : IPredicate { private object compare; public IsEqual(object compare) { this.compare = compare; } public bool Eval(object currentValue) { return compare.Equals(currentValue); } } } --- NEW FILE: IsEqualIgnoreCase.cs --- using System; using System.Globalization; namespace DotNetMock.Dynamic.Predicates { public class IsEqualIgnoreCase : IPredicate { private IPredicate p; public IsEqualIgnoreCase(object compare) { p = new IsEqual(compare.ToString().ToLower(CultureInfo.CurrentCulture)); } public bool Eval(object currentValue) { return p.Eval(currentValue.ToString().ToLower(CultureInfo.CurrentCulture)); } } } --- NEW FILE: IsEqualIgnoreWhiteSpace.cs --- using System; using System.Text; namespace DotNetMock.Dynamic.Predicates { public class IsEqualIgnoreWhiteSpace : IPredicate { private IPredicate p; public IsEqualIgnoreWhiteSpace(object compare) { p = new IsEqual(StripSpace(compare.ToString())); } public bool Eval(object currentValue) { return p.Eval(StripSpace(currentValue.ToString())); } public static string StripSpace(string s) { StringBuilder result = new StringBuilder(); bool lastWasSpace = true; foreach(char c in s) { if (Char.IsWhiteSpace(c)) { if (!lastWasSpace) { result.Append(' '); } lastWasSpace = true; } else { result.Append(c); lastWasSpace = false; } } return result.ToString().Trim(); } } } --- NEW FILE: IsIn.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class IsIn : IPredicate { private object[] inList; public IsIn(params object[] inList) { if (inList.Length == 1 && inList[0].GetType().IsArray) { Array arr = (Array)inList[0]; this.inList = new object[arr.Length]; arr.CopyTo(this.inList, 0); } else { this.inList = inList; } } public bool Eval(object currentValue) { foreach (object o in inList) { if (o.Equals(currentValue)) { return true; } } return false; } } } --- NEW FILE: IsMatch.cs --- using System; using System.Text.RegularExpressions; namespace DotNetMock.Dynamic.Predicates { public class IsMatch : IPredicate { private Regex regex; public IsMatch(Regex regex) { this.regex = regex; } public IsMatch(String regex) : this(new Regex(regex)) { } public IsMatch(String regex, bool ignoreCase) : this(new Regex(regex, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None)) { } public bool Eval(object currentValue) { return currentValue == null ? false : regex.IsMatch(currentValue.ToString()); } } } --- NEW FILE: IsNull.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class IsNull : IPredicate { public bool Eval(object currentValue) { return currentValue == null; } } } --- NEW FILE: IsTypeOf.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class IsTypeOf : IPredicate { private Type type; public IsTypeOf(Type type) { this.type = type; } public bool Eval(object currentValue) { return currentValue == null ? false : type.IsAssignableFrom(currentValue.GetType()); } } } --- NEW FILE: NotEqual.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class NotEqual : IPredicate { private IPredicate p; public NotEqual(object compare) { p = new NotPredicate(new IsEqual(compare)); } public bool Eval(object currentValue) { return p.Eval(currentValue); } } } --- NEW FILE: NotIn.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class NotIn : IPredicate { private IPredicate p; public NotIn(params object[] inList) { p = new NotPredicate(new IsIn(inList)); } public bool Eval(object currentValue) { return p.Eval(currentValue); } } } --- NEW FILE: NotNull.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class NotNull : IPredicate { public bool Eval(object currentValue) { return currentValue != null; } } } --- NEW FILE: NotPredicate.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class NotPredicate : IPredicate { private IPredicate p; public NotPredicate(IPredicate p) { this.p = p; } public bool Eval(object currentValue) { return !p.Eval(currentValue); } } } --- NEW FILE: OrPredicate.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class OrPredicate : IPredicate { private IPredicate p1, p2; public OrPredicate(IPredicate p1, IPredicate p2) { this.p1 = p1; this.p2 = p2; } public bool Eval(object currentValue) { return p1.Eval(currentValue) || p2.Eval(currentValue); } } } --- NEW FILE: Predicate.cs --- using System; namespace DotNetMock.Dynamic.Predicates { public class Predicate : IPredicate { public delegate bool Method(object currentValue); private Method m; public Predicate(Method m) { this.m = m; } public bool Eval(object currentValue) { return m(currentValue); } } } |