Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock In directory usw-pr-cvs1:/tmp/cvs-serv9843/DotNetMock Modified Files: AbstractExpectation.cs AbstractExpectationCollection.cs AssemblyInfo.cs ExpectationArrayList.cs ExpectationCounter.cs MockObject.cs Verifier.cs Added Files: IExpectation.cs IExpectationCollection.cs IVerifiable.cs Removed Files: Expectation.cs ExpectationCollection.cs Verifiable.cs Log Message: --- NEW FILE: IExpectation.cs --- namespace DotNetMock { using System; /// <summary> /// Interface that all expectation implement. Also implements the Verifiable interface /// </summary> public interface IExpectation : IVerifiable { /// <summary> /// Gets/Sets Has Expectations /// </summary> bool HasExpectations {get;set;} /// <summary> /// Sets the verify immediate flag /// </summary> bool VerifyImmediate {set;} /// <summary> /// Gets should check immediate /// </summary> bool ShouldCheckImmediate {get;} } } --- NEW FILE: IExpectationCollection.cs --- namespace DotNetMock { using System; using System.Collections; /// <summary> /// Summary description for Expectation Collection Interface. /// </summary> public interface IExpectationCollection : IExpectation { /// <summary> /// Adds object to actual collection /// </summary> /// <param name="actual">object to add</param> void AddActual(object actual); /// <summary> /// Adds an array of objects to actual collection /// </summary> /// <param name="actualMany">array of objects to add</param> void AddActualMany(object[] actualMany); /// <summary> /// Adds a Collection that implements the IEnumerable interface to actual collection /// </summary> /// <param name="actualMany"></param> void AddActualMany(IEnumerable actualMany); /// <summary> /// Adds the elements of an object that implements IList to the actual collection /// </summary> /// <param name="actualMany"></param> void AddActualMany(IList actualMany); /// <summary> /// Adds object to expected collection /// </summary> /// <param name="expected"></param> void AddExpected(object expected); /// <summary> /// Adds an array of objects to expected collection /// </summary> /// <param name="expectedMany"></param> void AddExpectedMany(object[] expectedMany); /// <summary> /// Adds a Collection that implements the IEnumerable interface to expected collection /// </summary> /// <param name="expectedMany"></param> void AddExpectedMany(IEnumerable expectedMany); /// <summary> /// Adds the elements of an object that implements IList to the expected collection /// </summary> /// <param name="expectedMany"></param> void AddExpectedMany(IList expectedMany); } } --- NEW FILE: IVerifiable.cs --- namespace DotNetMock { using System; /// <summary> /// A Verifiable is an object that can confirm at the end of a unit test that /// the correct behvaiour has occurred. /// </summary> public interface IVerifiable { void Verify(); } } Index: AbstractExpectation.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/AbstractExpectation.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractExpectation.cs 21 Sep 2002 06:19:18 -0000 1.6 --- AbstractExpectation.cs 25 Oct 2002 03:02:25 -0000 1.7 *************** *** 6,18 **** /// Summary description for Abstract Expectation. /// </summary> ! public abstract class AbstractExpectation : Expectation { private bool _hasExpectations = false; private bool _verifyImmediate = false; ! protected string _name = null; ! public AbstractExpectation(string name) { ! this._name = name; } --- 6,18 ---- /// Summary description for Abstract Expectation. /// </summary> ! public abstract class AbstractExpectation : IExpectation { private bool _hasExpectations = false; private bool _verifyImmediate = false; ! protected string name = null; ! protected AbstractExpectation(string name) { ! this.name = name; } Index: AbstractExpectationCollection.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/AbstractExpectationCollection.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AbstractExpectationCollection.cs 11 Oct 2002 03:07:59 -0000 1.3 --- AbstractExpectationCollection.cs 25 Oct 2002 03:02:25 -0000 1.4 *************** *** 8,12 **** /// Summary description for AbstractExpectationCollection. /// </summary> ! public abstract class AbstractExpectationCollection : AbstractExpectation, ExpectationCollection { /// <summary> --- 8,12 ---- /// Summary description for AbstractExpectationCollection. /// </summary> ! public abstract class AbstractExpectationCollection : AbstractExpectation, IExpectationCollection { /// <summary> *************** *** 14,18 **** /// </summary> /// <param name="name">Name for AbstractExpectationCollection</param> ! public AbstractExpectationCollection(string name) : base(name) {} /// <summary> /// Checks the given values immediatly --- 14,18 ---- /// </summary> /// <param name="name">Name for AbstractExpectationCollection</param> ! protected AbstractExpectationCollection(string name) : base(name) {} /// <summary> /// Checks the given values immediatly *************** *** 24,33 **** /// </summary> /// <returns>Actual Collection</returns> ! abstract protected IList GetActualCollection(); /// <summary> /// Returns Expected Collection /// </summary> /// <returns>Expected Collection</returns> ! abstract protected IList GetExpectedCollection(); /// <summary> /// Adds value to actual collection --- 24,33 ---- /// </summary> /// <returns>Actual Collection</returns> ! abstract public IList ActualCollection {get;} /// <summary> /// Returns Expected Collection /// </summary> /// <returns>Expected Collection</returns> ! abstract public IList ExpectedCollection {get;} /// <summary> /// Adds value to actual collection *************** *** 36,40 **** public void AddActual(object actual) { ! GetActualCollection().Add(actual); if (ShouldCheckImmediate) { --- 36,40 ---- public void AddActual(object actual) { ! this.ActualCollection.Add(actual); if (ShouldCheckImmediate) { *************** *** 82,86 **** public void AddExpected(object expected) { ! GetExpectedCollection().Add(expected); this.HasExpectations = true; } --- 82,86 ---- public void AddExpected(object expected) { ! this.ExpectedCollection.Add(expected); this.HasExpectations = true; } *************** *** 124,128 **** public override void ClearActual() { ! GetActualCollection().Clear(); } /// <summary> --- 124,128 ---- public override void ClearActual() { ! this.ExpectedCollection.Clear(); } /// <summary> *************** *** 131,135 **** public override void ClearExpected() { ! GetExpectedCollection().Clear(); } /// <summary> --- 131,135 ---- public override void ClearExpected() { ! this.ExpectedCollection.Clear(); } /// <summary> *************** *** 146,153 **** public override void Verify() { ! NUnit.Framework.Assertion.AssertEquals(GetExpectedCollection().Count, GetActualCollection().Count); ! for (int i = 0; i < GetActualCollection().Count; i++) { ! NUnit.Framework.Assertion.AssertEquals("Collection items not equal.", GetExpectedCollection()[i], GetActualCollection()[i]); } } --- 146,153 ---- public override void Verify() { ! NUnit.Framework.Assertion.AssertEquals(this.ExpectedCollection.Count, this.ActualCollection.Count); ! for (int i = 0; i < this.ActualCollection.Count; i++) { ! NUnit.Framework.Assertion.AssertEquals("Collection items not equal.", this.ExpectedCollection[i], this.ActualCollection[i]); } } Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/AssemblyInfo.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AssemblyInfo.cs 11 Oct 2002 03:07:59 -0000 1.4 --- AssemblyInfo.cs 25 Oct 2002 03:02:25 -0000 1.5 *************** *** 1,5 **** --- 1,12 ---- + using System; using System.Reflection; using System.Runtime.CompilerServices; + using System.Runtime.InteropServices; + // Marks CLS Compliance + [assembly:CLSCompliant(true)] + + // Marks COM Visibility to false. we don't want COM clients to use this assembly + [assembly:ComVisible(false)] // // General Information about an assembly is controlled through the following Index: ExpectationArrayList.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/ExpectationArrayList.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExpectationArrayList.cs 11 Oct 2002 03:07:59 -0000 1.6 --- ExpectationArrayList.cs 25 Oct 2002 03:02:25 -0000 1.7 *************** *** 23,29 **** /// </summary> /// <returns>Actual Collection</returns> ! protected override IList GetActualCollection() { ! return _actualArrayList; } /// <summary> --- 23,29 ---- /// </summary> /// <returns>Actual Collection</returns> ! public override IList ActualCollection { ! get { return _actualArrayList; } } /// <summary> *************** *** 31,37 **** /// </summary> /// <returns>Expected Collection</returns> ! protected override IList GetExpectedCollection() { ! return _expectedArrayList; } /// <summary> --- 31,37 ---- /// </summary> /// <returns>Expected Collection</returns> ! public override IList ExpectedCollection { ! get { return _expectedArrayList; } } /// <summary> Index: ExpectationCounter.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/ExpectationCounter.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExpectationCounter.cs 11 Oct 2002 03:07:59 -0000 1.5 --- ExpectationCounter.cs 25 Oct 2002 03:02:25 -0000 1.6 *************** *** 48,52 **** if (ShouldCheckImmediate) { NUnit.Framework.Assertion.Assert( ! this._name + " should not be called more than " + this._expectedCalls + " times", this._actualCalls <= this._expectedCalls); } --- 48,52 ---- if (ShouldCheckImmediate) { NUnit.Framework.Assertion.Assert( ! this.name + " should not be called more than " + this._expectedCalls + " times", this._actualCalls <= this._expectedCalls); } Index: MockObject.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/MockObject.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MockObject.cs 11 Oct 2002 03:07:59 -0000 1.5 --- MockObject.cs 25 Oct 2002 03:02:25 -0000 1.6 *************** *** 6,18 **** /// Base Mock Object. All custom Mock Objects should extend this object. /// </summary> ! public class MockObject : Verifiable { ! protected string _name = null; public MockObject(string name) { ! _name = name; } public MockObject() { ! _name = "MockObject"; } /// <summary> --- 6,19 ---- /// Base Mock Object. All custom Mock Objects should extend this object. /// </summary> ! public class MockObject : IVerifiable { ! protected string name = null; ! public MockObject(string name) { ! name = name; } public MockObject() { ! name = "MockObject"; } /// <summary> *************** *** 22,28 **** /// <param name="object1">First Object.</param> /// <param name="object2">Second Object.</param> ! public void AssertEquals(string message, Object object1, Object object2) { ! NUnit.Framework.Assertion.AssertEquals(message, object1, object2); } /// <summary> --- 23,29 ---- /// <param name="object1">First Object.</param> /// <param name="object2">Second Object.</param> ! public void AssertEquals(string message, Object expectedObject, Object actualObject) { ! NUnit.Framework.Assertion.AssertEquals(message, expectedObject, actualObject); } /// <summary> Index: Verifier.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Verifier.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Verifier.cs 21 Sep 2002 06:19:18 -0000 1.4 --- Verifier.cs 25 Oct 2002 03:02:26 -0000 1.5 *************** *** 26,33 **** /// Calls Verify() with the object and it's type. /// </summary> ! /// <param name="anObject"></param> ! public static void Verify(Object anObject) { ! Verify(anObject, anObject.GetType()); } /// <summary> --- 26,33 ---- /// Calls Verify() with the object and it's type. /// </summary> ! /// <param name="verifiableObject"></param> ! public static void Verify(Object verifiableObject) { ! Verify(verifiableObject, verifiableObject.GetType()); } /// <summary> *************** *** 38,55 **** /// <param name="anObject">Object to verify.</param> /// <param name="aType">Current Type.</param> ! protected internal static void Verify(Object anObject, Type aType) { // End the recursion at System.Object ! if (IsRootType(aType)) { return; } ! Verify(anObject, aType.BaseType); ! FieldInfo[] fields = aType.GetFields(_bindingFlags); foreach (FieldInfo field in fields) { ! VerifyField(field, anObject); } } --- 38,55 ---- /// <param name="anObject">Object to verify.</param> /// <param name="aType">Current Type.</param> ! protected internal static void Verify(Object verifiableObject, Type currentType) { // End the recursion at System.Object ! if (IsRootType(currentType)) { return; } ! Verify(verifiableObject, currentType.BaseType); ! FieldInfo[] fields = currentType.GetFields(_bindingFlags); foreach (FieldInfo field in fields) { ! VerifyField(field, verifiableObject); } } *************** *** 59,68 **** /// <param name="aField">Current Field.</param> /// <param name="anObject">Current Object.</param> ! protected internal static void VerifyField(FieldInfo aField, Object anObject) { ! Object fieldValue = aField.GetValue(anObject); ! Verifiable aVerifiable; ! if ((aVerifiable = fieldValue as Verifiable) != null) { aVerifiable.Verify(); --- 59,68 ---- /// <param name="aField">Current Field.</param> /// <param name="anObject">Current Object.</param> ! protected internal static void VerifyField(FieldInfo verifiableField, Object verifiableObject) { ! Object fieldValue = verifiableField.GetValue(verifiableObject); ! IVerifiable aVerifiable; ! if ((aVerifiable = fieldValue as IVerifiable) != null) { aVerifiable.Verify(); --- Expectation.cs DELETED --- --- ExpectationCollection.cs DELETED --- --- Verifiable.cs DELETED --- |