public async System.Threading.Tasks.Task HandlesIncorrectTypeInput(object dt1, object dt2)
        {
            _engine         = new AutomationEngineInstance(null);
            _mergeDataTable = new MergeDataTableCommand();

            VariableMethods.CreateTestVariable(dt1, _engine, "dt1", typeof(OBData.DataTable));
            VariableMethods.CreateTestVariable(dt2, _engine, "dt2", typeof(int));

            _mergeDataTable.v_SourceDataTable      = "{dt1}";
            _mergeDataTable.v_DestinationDataTable = "{dt2}";
            _mergeDataTable.v_MissingSchemaAction  = "Add";

            await Assert.ThrowsAsync <ArgumentException>(() => _mergeDataTable.RunCommand(_engine));
        }
        public void HandlesNullDataTables(OBData.DataTable dt1, OBData.DataTable dt2)
        {
            _engine         = new AutomationEngineInstance(null);
            _mergeDataTable = new MergeDataTableCommand();

            VariableMethods.CreateTestVariable(dt1, _engine, "dt1", typeof(OBData.DataTable));
            VariableMethods.CreateTestVariable(dt2, _engine, "dt2", typeof(OBData.DataTable));

            _mergeDataTable.v_SourceDataTable      = "{dt1}";
            _mergeDataTable.v_DestinationDataTable = "{dt2}";
            _mergeDataTable.v_MissingSchemaAction  = "Add";

            Assert.Throws <ArgumentNullException>(() => _mergeDataTable.RunCommand(_engine));
        }
        public async void TableDataIsEqual(OBData.DataTable dt1, OBData.DataTable dt2, string schema)
        {
            _engine         = new AutomationEngineInstance(null);
            _mergeDataTable = new MergeDataTableCommand();

            VariableMethods.CreateTestVariable(dt1, _engine, "dt1", typeof(OBData.DataTable));
            VariableMethods.CreateTestVariable(dt2, _engine, "dt2", typeof(OBData.DataTable));

            switch (schema)
            {
            case "Add":
                dt2.Merge(dt1, false, MissingSchemaAction.Add);
                break;

            case "AddWithKey":
                dt2.Merge(dt1, false, MissingSchemaAction.AddWithKey);
                break;

            case "Error":
                dt2.Merge(dt1, false, MissingSchemaAction.Error);
                break;

            case "Ignore":
                dt2.Merge(dt1, false, MissingSchemaAction.Ignore);
                break;

            default:
                throw new NotImplementedException("Test for schema '" + schema + "' not implemented");
            }

            _mergeDataTable.v_SourceDataTable      = "{dt1}";
            _mergeDataTable.v_DestinationDataTable = "{dt2}";
            _mergeDataTable.v_MissingSchemaAction  = schema;

            _mergeDataTable.RunCommand(_engine);

            OBData.DataTable resultDataTable = (OBData.DataTable) await _mergeDataTable.v_DestinationDataTable.EvaluateCode(_engine);

            Assert.Equal(dt2.GetType(), resultDataTable.GetType());
            // Check each row / column pair and assert equivalence
            for (int row = 0; row < dt2.Rows.Count; row++)
            {
                for (int col = 0; col < dt2.Columns.Count; col++)
                {
                    Assert.Equal(dt2.Rows[row][dt2.Columns[col]], resultDataTable.Rows[row][resultDataTable.Columns[col]]);
                }
            }
        }