コード例 #1
0
		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));
		}
コード例 #2
0
		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);

		}
コード例 #3
0
	  /// <summary>
	  /// This method will return an ArrayList of IDataOperations that the ElementMapper provides when
	  /// mapping from the ElementType specified in the method argument. 
	  /// </summary>
	  /// <remarks>
	  ///  Each IDataOperation object will contain 3 IArguments:
	  ///  <p> [Key]              [Value]                      [ReadOnly]    [Description]----------------- </p>
	  ///  <p> ["Type"]           ["SpatialMapping"]           [true]        ["Using the ElementMapper"] </p>
	  ///  <p> ["ID"]             [The Operation ID]           [true]        ["Internal ElementMapper dataoperation ID"] </p>
	  ///  <p> ["Description"]    [The Operation Description]  [true]        ["Using the ElementMapper"] </p>
	  ///  <p> ["ToElementType"]  [ElementType]                [true]        ["Valid To-Element Types"]  </p>
	  /// </remarks>
	  /// <param name="fromElementsElementType"></param>
	  /// <returns>
	  ///  ArrayList which contains the available dataOperations (IDataOperation).
	  /// </returns>
	  public ArrayList GetAvailableDataOperations(ElementType fromElementsElementType)
	  {
		  ArrayList availableDataOperations = new ArrayList();

		  for ( int i = 0; i < _availableMethods.Length; i++)
		  {
			  if( fromElementsElementType == _availableMethods[i].fromElementsShapeType)
			  {
				  DataOperation dataOperation = new DataOperation("ElementMapper" + _availableMethods[i].ID);
				  dataOperation.AddArgument(new Argument("ID",_availableMethods[i].ID.ToString(),true,"Internal ElementMapper dataoperation ID"));
				  dataOperation.AddArgument(new Argument("Description",_availableMethods[i].Description,true,"Operation description"));
				  dataOperation.AddArgument(new Argument("Type","SpatialMapping",true,"Using the ElementMapper"));
				  dataOperation.AddArgument(new Argument("FromElementType",_availableMethods[i].fromElementsShapeType.ToString(),true,"Valid From-Element Types"));
				  dataOperation.AddArgument(new Argument("ToElementType",_availableMethods[i].toElementsShapeType.ToString(),true,"Valid To-Element Types"));
				  availableDataOperations.Add(dataOperation);
			  }
		  }
		  return availableDataOperations;
	  }
コード例 #4
0
		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"));
		}