public void Arguments() { Argument param1 = new Argument("key1","value1",true,"argument1"); Argument param2 = new Argument("key2","value2",true,"argument2"); Argument param3 = new Argument("key3","value3",true,"argument3"); DataOperation operation = new DataOperation(); operation.AddArgument(param1); operation.AddArgument(param2); operation.AddArgument(param3); Assert.AreEqual(3,operation.ArgumentCount); Assert.AreEqual(param1,operation.GetArgument(0)); Assert.AreEqual(param2,operation.GetArgument(1)); Assert.AreEqual(param3,operation.GetArgument(2)); }
///<summary> /// Check if the current instance equals another instance of this class. ///</summary> ///<param name="obj">The instance to compare the current instance with.</param> ///<returns><code>true</code> if the instances are the same instance or have the same content.</returns> public override bool Equals(Object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } DataOperation d = (DataOperation)obj; if (!ID.Equals(d.ID)) { return(false); } if (!ArgumentCount.Equals(d.ArgumentCount)) { return(false); } for (int i = 0; i < ArgumentCount; i++) { if (!GetArgument(i).Equals(d.GetArgument(i))) { return(false); } } return(true); }