public void testDescriminator()
        {
            TnmSchemaLookup lookup = new TnmSchemaLookup("C629", "9100");

            Assert.IsFalse(lookup.hasDiscriminator());
            lookup.setInput(TnmStagingData.SSF25_KEY, "");
            Assert.IsFalse(lookup.hasDiscriminator());
            lookup.setInput(TnmStagingData.SSF25_KEY, "001");
            Assert.IsTrue(lookup.hasDiscriminator());
        }
        public void testSchemaSelection()
        {
            // test bad values
            List <StagingSchema> lookup = _STAGING.lookupSchema(new SchemaLookup());

            Assert.AreEqual(0, lookup.Count);

            lookup = _STAGING.lookupSchema(new TnmSchemaLookup("XXX", "YYY"));
            Assert.AreEqual(0, lookup.Count);

            // test valid combinations that do not require a discriminator
            TnmSchemaLookup schemaLookup = new TnmSchemaLookup("C629", "9231");

            schemaLookup.setInput(TnmStagingData.SSF25_KEY, "");
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(1, lookup.Count);
            Assert.AreEqual("testis", lookup[0].getId());
            schemaLookup.setInput(TnmStagingData.SSF25_KEY, null);
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(1, lookup.Count);
            Assert.AreEqual("testis", lookup[0].getId());

            // now test one that does do AJCC7
            lookup = _STAGING.lookupSchema(new TnmSchemaLookup("C629", "9231"));
            Assert.AreEqual(1, lookup.Count);

            // test value combinations that do not require a discriminator and are supplied 988
            schemaLookup = new TnmSchemaLookup("C629", "9231");
            schemaLookup.setInput(TnmStagingData.SSF25_KEY, "988");
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(1, lookup.Count);
            Assert.AreEqual("testis", lookup[0].getId());

            // test valid combination that requires a discriminator but is not supplied one
            lookup = _STAGING.lookupSchema(new TnmSchemaLookup("C111", "8200"));
            Assert.AreEqual(2, lookup.Count);

            HashSet <String> hash1 = null;
            HashSet <String> hash2 = null;

            foreach (StagingSchema schema in lookup)
            {
                hash1 = new HashSet <String>()
                {
                    "ssf25"
                };
                hash2 = schema.getSchemaDiscriminators();
                Assert.IsTrue(hash1.SetEquals(hash2));
            }

            // test valid combination that requires discriminator and a good discriminator is supplied
            schemaLookup = new TnmSchemaLookup("C111", "8200");
            schemaLookup.setInput(TnmStagingData.SSF25_KEY, "010");
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(1, lookup.Count);
            foreach (StagingSchema schema in lookup)
            {
                hash1 = new HashSet <String>()
                {
                    "ssf25"
                };
                hash2 = schema.getSchemaDiscriminators();
                Assert.IsTrue(hash1.SetEquals(hash2));
            }
            Assert.AreEqual("nasopharynx", lookup[0].getId());

            // test valid combination that requires a discriminator but is supplied a bad disciminator value
            schemaLookup = new TnmSchemaLookup("C111", "8200");
            schemaLookup.setInput(TnmStagingData.SSF25_KEY, "999");
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(0, lookup.Count);

            // test searching on only site
            lookup = _STAGING.lookupSchema(new TnmSchemaLookup("C401", null));
            Assert.AreEqual(5, lookup.Count);

            // test searching on only hist
            lookup = _STAGING.lookupSchema(new TnmSchemaLookup(null, "9702"));
            Assert.AreEqual(2, lookup.Count);

            // test that searching on only ssf25 returns no results
            schemaLookup = new TnmSchemaLookup(null, null);
            schemaLookup.setInput(TnmStagingData.SSF25_KEY, "001");
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(0, lookup.Count);
            schemaLookup = new TnmSchemaLookup("", null);
            schemaLookup.setInput(TnmStagingData.SSF25_KEY, "001");
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(0, lookup.Count);
            schemaLookup = new TnmSchemaLookup(null, "");
            schemaLookup.setInput(TnmStagingData.SSF25_KEY, "001");
            lookup = _STAGING.lookupSchema(schemaLookup);
            Assert.AreEqual(0, lookup.Count);
        }
        public void testBadKey()
        {
            TnmSchemaLookup lookup = new TnmSchemaLookup("C509", "8000");

            lookup.setInput("bad_key", "111");
        }