public void Constructor() { DataOperation operation = new DataOperation("DataOperationID"); Argument param1 = new Argument("key1", "value1", true, "argument1"); Argument param2 = new Argument("key2", "value2", true, "argument2"); Argument param3 = new Argument("key3", "value3", true, "argument3"); operation.AddArgument(param1); operation.AddArgument(param2); operation.AddArgument(param3); Assert.AreEqual("DataOperationID", operation.ID); DataOperation operation2 = new DataOperation(operation); Assert.AreEqual(operation, operation2); }
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)); }
public void Equals() { 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 operation1 = new DataOperation("ID"); operation1.AddArgument(param1); operation1.AddArgument(param2); operation1.AddArgument(param3); param1 = new Argument("key1", "value1", true, "argument1"); param2 = new Argument("key2", "value2", true, "argument2"); param3 = new Argument("key3", "value3", true, "argument3"); DataOperation operation2 = new DataOperation("ID"); operation2.AddArgument(param1); operation2.AddArgument(param2); Assert.IsFalse(operation1.Equals(operation2)); operation2.AddArgument(param3); Assert.IsTrue(operation1.Equals(operation2)); param1.Key = "key"; Assert.IsFalse(operation1.Equals(operation2)); param1.Key = "key1"; operation1.ID = "ID1"; Assert.IsFalse(operation1.Equals(operation2)); operation1.ID = "ID"; Assert.IsFalse(operation1.Equals(null)); Assert.IsFalse(operation1.Equals("string")); }