From: <gc...@us...> - 2003-02-26 17:18:27
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock In directory sc8-pr-cvs1:/tmp/cvs-serv7217/DotNetMock Added Files: ExpectationBool.cs ExpectationType.cs NullObject.cs Log Message: --- NEW FILE: ExpectationBool.cs --- using System; namespace DotNetMock { /// <summary> /// Expectation Bool implementation. Extends <c>AbstractExpectation</c> /// </summary> /// <remarks/> public class ExpectationBool : AbstractExpectation { private bool _actualBool = false; private bool _expectedBool = false; /// <summary> /// Default Constructor /// </summary> /// <param name="name">Name of this Expectation</param> public ExpectationBool(string name) : base(name) {} /// <summary> /// Clears actual value /// </summary> public override void ClearActual() { this._actualBool = false; } /// <summary> /// Clear expected value /// </summary> public override void ClearExpected() { this._expectedBool = false; } /// <summary> /// Verifies object /// </summary> public override void Verify() { if (this.HasExpectations) { NUnit.Framework.Assertion.AssertEquals("Bool values not equal for " + this.name, this._expectedBool, this._actualBool); } } /// <summary> /// Gets/Sets actual boolean value /// </summary> public bool Actual { get { return _actualBool; } set { _actualBool = value;} } /// <summary> /// Gets/Sets expected boolean value /// </summary> public bool Expected { get { return _expectedBool; } set { _expectedBool = value; this.HasExpectations = true; } } } } --- NEW FILE: ExpectationType.cs --- using System; namespace DotNetMock { /// <summary> /// Expectation Type implementation. Extends <c>AbstractExpectation</c> /// </summary> /// <remarks/> public class ExpectationType : AbstractExpectation { private Type _actualType = null; private Type _expectedType = null; /// <summary> /// /// </summary> /// <param name="name"></param> public ExpectationType(string name) : base(name) { ClearActual(); } /// <summary> /// Clears Actual value. /// </summary> public override void ClearActual() { this._actualType = null; } /// <summary> /// Clears Expected value. /// </summary> public override void ClearExpected() { this._expectedType = null; } /// <summary> /// Gets/Sets Actual values. /// </summary> public Type Actual { get { return this._actualType; } set { this._actualType = (Type)value; if (ShouldCheckImmediate) { Verify(); } } } /// <summary> /// Gets/Sets Expected value. /// </summary> public Type Expected { get { return this._expectedType; } set { this._expectedType = (Type)value; this.HasExpectations = true; } } /// <summary> /// Verifies object. /// </summary> public override void Verify() { if (this.HasExpectations) { NUnit.Framework.Assertion.AssertEquals("Types do not equal for object " + this.name, this._expectedType, this._actualType); } } } } --- NEW FILE: NullObject.cs --- namespace DotNetMock { using System; /// <summary> /// This represents a Null Object. /// </summary> /// <remarks/> public class NullObject { private string _name; public NullObject() { _name = "null"; } public NullObject(string name) { _name = name; } /// <summary> /// Overrides Object.ToString(). /// </summary> /// <returns>Object Name.</returns> public override string ToString() { return _name; } /// <summary> /// Determines if the given object is Null object. /// </summary> /// <param name="other">Object to compare.</param> /// <returns>True/False.</returns> public override bool Equals(Object other) { return (other is NullObject); } /// <summary> /// Returns unique hash code for the object. /// </summary> /// <returns>Objects HashCode.</returns> public override int GetHashCode() { return _name.GetHashCode(); } } } |