|
From: <joe...@us...> - 2003-07-11 08:33:12
|
Update of /cvsroot/nmock/nmock/src/NMock/Constraints
In directory sc8-pr-cvs1:/tmp/cvs-serv10925/src/NMock/Constraints
Added Files:
IsArrayEqual.cs
Log Message:
Added IsArrayEqual constraint - by Luke Maxon
--- NEW FILE: IsArrayEqual.cs ---
// Contributed by Luke Maxon <lt...@th...>
using System;
using System.Collections;
namespace NMock.Constraints
{
public class IsListEqual : BaseConstraint
{
private object compare;
public IsListEqual(object compare)
{
this.compare = compare;
}
public override bool Eval(object val)
{
IList thisList = compare as IList;
IList thatList = val as IList;
if(thisList == null || thatList == null)
{
return false;
}
if(thisList.Count != thatList.Count)
{
return false;
}
for(int i=0;i<thisList.Count;++i)
{
if(!thisList[i].Equals(thatList[i]))
{
return false;
}
}
return true;
}
public override string Message
{
get { return "<" + compare + ">"; }
}
}
}
|