protected override ITest CreateTestInstance(object[] args) { var test = new QaGroupConstraints((ITable)args[0], (string)args[1], (string)args[2], (int)args[3], (bool)args[4]); test.SetRelatedTables((IList <ITable>)args[5]); return(test); }
private static void TestRelGroupContraints(IFeatureWorkspace ws) { ITable tableData = DatasetUtils.CreateTable(ws, "TblData1", FieldUtils.CreateOIDField(), FieldUtils.CreateField("GroupField", esriFieldType .esriFieldTypeInteger)); ITable tableRel = DatasetUtils.CreateTable(ws, "TblRel1", FieldUtils.CreateOIDField(), FieldUtils.CreateTextField( "Kostenstelle", 20)); IRelationshipClass rel = TestWorkspaceUtils.CreateSimple1NRelationship( ws, "rel", tableRel, tableData, "ObjectId", "GroupField"); // make sure the table is known by the workspace ((IWorkspaceEdit)ws).StartEditing(false); ((IWorkspaceEdit)ws).StopEditing(true); for (int i = 0; i < 20; i++) { IRow row = tableData.CreateRow(); row.set_Value(1, 1); row.Store(); } for (int i = 0; i < 40; i++) { IRow row = tableData.CreateRow(); row.set_Value(1, 2); row.Store(); } for (int i = 0; i < 30; i++) { IRow row = tableData.CreateRow(); row.set_Value(1, 3); row.Store(); } IRow row1 = tableRel.CreateRow(); row1.set_Value(1, "123456-10"); row1.Store(); IRow row2 = tableRel.CreateRow(); row2.set_Value(1, "123456-11"); row2.Store(); IRow row3 = tableRel.CreateRow(); row3.set_Value(1, "123456-12"); row3.Store(); const bool limitToTestedRows = false; ITable relTab = TableJoinUtils.CreateQueryTable(rel, JoinType.InnerJoin); var test = new QaGroupConstraints(relTab, "IIF(LEN(TblRel1.Kostenstelle) >=6, SUBSTRING(TblRel1.Kostenstelle, 1, 6), '')", "SUBSTRING(TblRel1.Kostenstelle, 8, 9)", 1, limitToTestedRows); test.SetRelatedTables(new[] { tableData, tableRel }); using (var runner = new QaTestRunner(test)) { runner.Execute(); Assert.AreEqual(1, runner.Errors.Count); } var containerRunner = new QaContainerTestRunner(100, test); containerRunner.Execute(); Assert.AreEqual(1, containerRunner.Errors.Count); }