public void testBlankInputs() { InMemoryDataProvider provider = new InMemoryDataProvider("test", "1.0"); StagingTable table = new StagingTable(); table.setId("table_input1"); StagingColumnDefinition def1 = new StagingColumnDefinition(); def1.setKey("input1"); def1.setName("Input 1"); def1.setType(ColumnType.INPUT); StagingColumnDefinition def2 = new StagingColumnDefinition(); def2.setKey("result1"); def2.setName("Result1"); def2.setType(ColumnType.DESCRIPTION); table.setColumnDefinitions(new List <IColumnDefinition>() { def1, def2 }); table.setRawRows(new List <List <String> >()); table.getRawRows().Add(new List <String>() { "1", "ONE" }); table.getRawRows().Add(new List <String>() { "2", "TWO" }); provider.addTable(table); table = new StagingTable(); table.setId("table_input2"); def1 = new StagingColumnDefinition(); def1.setKey("input2"); def1.setName("Input 2"); def1.setType(ColumnType.INPUT); def2 = new StagingColumnDefinition(); def2.setKey("result2"); def2.setName("Result2"); def2.setType(ColumnType.DESCRIPTION); table.setColumnDefinitions(new List <IColumnDefinition>() { def1, def2 }); table.setRawRows(new List <List <String> >()); table.getRawRows().Add(new List <String>() { "", "Blank" }); table.getRawRows().Add(new List <String>() { "A", "Letter A" }); table.getRawRows().Add(new List <String>() { "B", "Letter B" }); provider.addTable(table); table = new StagingTable(); table.setId("table_selection"); def1 = new StagingColumnDefinition(); def1.setKey("input1"); def1.setName("Input 1"); def1.setType(ColumnType.INPUT); table.setColumnDefinitions(new List <IColumnDefinition>() { def1 }); table.setRawRows(new List <List <String> >()); table.getRawRows().Add(new List <String>() { "*" }); provider.addTable(table); table = new StagingTable(); table.setId("primary_site"); def1 = new StagingColumnDefinition(); def1.setKey("site"); def1.setName("Site"); def1.setType(ColumnType.INPUT); table.setColumnDefinitions(new List <IColumnDefinition>() { def1 }); table.setRawRows(new List <List <String> >()); table.getRawRows().Add(new List <String>() { "C509" }); provider.addTable(table); table = new StagingTable(); table.setId("histology"); def1 = new StagingColumnDefinition(); def1.setKey("hist"); def1.setName("Histology"); def1.setType(ColumnType.INPUT); table.setColumnDefinitions(new List <IColumnDefinition>() { def1 }); table.setRawRows(new List <List <String> >()); table.getRawRows().Add(new List <String>() { "8000" }); provider.addTable(table); table = new StagingTable(); table.setId("table_year_dx"); def1 = new StagingColumnDefinition(); def1.setKey("year_dx"); def1.setName("Year DX"); def1.setType(ColumnType.INPUT); table.setColumnDefinitions(new List <IColumnDefinition>() { def1 }); table.setRawRows(new List <List <String> >()); table.getRawRows().Add(new List <String>() { "1900-2100" }); provider.addTable(table); StagingSchema schema = new StagingSchema(); schema.setId("schema_test"); schema.setSchemaSelectionTable("table_selection"); List <StagingSchemaInput> inputs = new List <StagingSchemaInput>(); inputs.Add(new StagingSchemaInput("site", "Primary Site", "primary_site")); inputs.Add(new StagingSchemaInput("hist", "Hist", "histology")); inputs.Add(new StagingSchemaInput("year_dx", "Year DX", "table_year_dx")); inputs.Add(new StagingSchemaInput("input1", "Input 1", "table_input1")); inputs.Add(new StagingSchemaInput("input2", "Input 2", "table_input2")); schema.setInputs(inputs); provider.addSchema(schema); TNMStagingCSharp.Src.Staging.Staging staging = TNMStagingCSharp.Src.Staging.Staging.getInstance(provider); Assert.AreEqual("schema_test", staging.getSchema("schema_test").getId()); // check case where required input field not supplied (i.e. no default); since there are is no workflow defined, this should // not cause an error StagingData data = new StagingData("C509", "8000"); data.setInput("year_dx", "2018"); data.setInput("input1", "1"); staging.stage(data); Assert.AreEqual(StagingData.Result.STAGED, data.getResult()); // pass in blank for "input2" data = new StagingData("C509", "8000"); data.setInput("year_dx", "2018"); data.setInput("input1", "1"); data.setInput("input2", ""); staging.stage(data); Assert.AreEqual(StagingData.Result.STAGED, data.getResult()); // pass in null for "input2" data = new StagingData("C509", "8000"); data.setInput("year_dx", "2018"); data.setInput("input1", "1"); data.setInput("input2", null); staging.stage(data); Assert.AreEqual(StagingData.Result.STAGED, data.getResult()); }
public void testExternalLoad() { Assert.AreEqual("testing", _STAGING.getAlgorithm()); Assert.AreEqual("99.99", _STAGING.getVersion()); Assert.AreEqual(1, _STAGING.getSchemaIds().Count); Assert.AreEqual(62, _STAGING.getTableIds().Count); StagingSchema schema = _STAGING.getSchema("urethra"); Assert.IsNotNull(schema); Assert.AreEqual("testing", schema.getAlgorithm()); Assert.AreEqual("99.99", schema.getVersion()); StagingTable table = _STAGING.getTable("ajcc_descriptor_codes"); Assert.IsNotNull(table); Assert.AreEqual("testing", table.getAlgorithm()); Assert.AreEqual("99.99", table.getVersion()); Assert.AreEqual(6, table.getTableRows().Count); HashSet <String> involved = _STAGING.getInvolvedTables("urethra"); Assert.AreEqual(62, involved.Count); Assert.IsTrue(involved.Contains("mets_eval_ipa")); StagingData data = new StagingData(); data.setInput("site", "C680"); data.setInput("hist", "8000"); data.setInput("behavior", "3"); data.setInput("grade", "9"); data.setInput("year_dx", "2013"); data.setInput("cs_input_version_original", "020550"); data.setInput("extension", "100"); data.setInput("extension_eval", "9"); data.setInput("nodes", "100"); data.setInput("nodes_eval", "9"); data.setInput("mets", "10"); data.setInput("mets_eval", "9"); // perform the staging _STAGING.stage(data); Assert.AreEqual(StagingData.Result.STAGED, data.getResult()); Assert.AreEqual("urethra", data.getSchemaId()); Assert.AreEqual(0, data.getErrors().Count); Assert.AreEqual(37, data.getPath().Count); // check output Assert.AreEqual("129", data.getOutput("schema_number")); Assert.AreEqual("020550", data.getOutput("csver_derived")); // AJCC 6 Assert.AreEqual("70", data.getOutput("stor_ajcc6_stage")); // AJCC 7 Assert.AreEqual("700", data.getOutput("stor_ajcc7_stage")); // Summary Stage Assert.AreEqual("7", data.getOutput("stor_ss77")); Assert.AreEqual("7", data.getOutput("stor_ss2000")); }