Beispiel #1
0
        public void RelatedCatalogueTest_OneCatalogue(bool createExtractionInformation)
        {
            TableInfo  t = new TableInfo(Repository, "MyTable");
            ColumnInfo c = new ColumnInfo(Repository, "MyCol", "varchar(10)", t);

            Catalogue     cata = new Catalogue(Repository, "MyCata");
            CatalogueItem ci   = new CatalogueItem(Repository, cata, "MyCataItem");

            try
            {
                if (createExtractionInformation)
                {
                    new ExtractionInformation(Repository, ci, c, "dbo.SomeFunc('Bob') as MySelectLine");
                }
                else
                {
                    ci.SetColumnInfo(c);
                }

                var catas = t.GetAllRelatedCatalogues();
                Assert.AreEqual(1, catas.Length);
                Assert.AreEqual(cata, catas[0]);
            }
            finally
            {
                ci.DeleteInDatabase();
                cata.DeleteInDatabase();
                t.DeleteInDatabase();
            }
        }
Beispiel #2
0
        public void update_changeAllPropertiesOfCatalogueItem_passes()
        {
            Catalogue     parent = new Catalogue(CatalogueRepository, "KONGOR");
            CatalogueItem child  = new CatalogueItem(CatalogueRepository, parent, "KONGOR_SUPERKING")
            {
                Agg_method  = "Adding SetUp",
                Comments    = "do not change amagad super secret!",
                Limitations = "Extreme limitaitons",
                Description =
                    "Exciting things are going down in the streets of new your this time of year it would be a great idea if you were to go there",
                Name               = "KONGOR_MINIMAN",
                Periodicity        = Catalogue.CataloguePeriodicity.Monthly,
                Research_relevance = "Highly relevant to all fields of subatomic particle study",
                Statistical_cons   = "Dangerous cons frequent the areas that this stats is happening, be afraid",
                Topic              = "nothing much, lots of stuff"
            };

            child.SaveToDatabase();

            CatalogueItem childAfter = CatalogueRepository.GetObjectByID <CatalogueItem>(child.ID);

            Assert.IsTrue(child.Name == childAfter.Name);
            Assert.IsTrue(child.Agg_method == childAfter.Agg_method);
            Assert.IsTrue(child.Comments == childAfter.Comments);
            Assert.IsTrue(child.Limitations == childAfter.Limitations);
            Assert.IsTrue(child.Description == childAfter.Description);
            Assert.IsTrue(child.Periodicity == childAfter.Periodicity);
            Assert.IsTrue(child.Research_relevance == childAfter.Research_relevance);
            Assert.IsTrue(child.Statistical_cons == childAfter.Statistical_cons);
            Assert.IsTrue(child.Topic == childAfter.Topic);

            child.DeleteInDatabase();
            parent.DeleteInDatabase();
        }
Beispiel #3
0
        public void AddSameLinkTwice()
        {
            Catalogue     predator        = null;
            CatalogueItem lazor           = null;
            TableInfo     highEnergyTable = null;
            ColumnInfo    velocityColumn  = null;

            try
            {
                ///////////////Create the things that we are going to create relationships between /////////////////
                predator        = new Catalogue(CatalogueRepository, "Predator");
                lazor           = new CatalogueItem(CatalogueRepository, predator, "QuadlzorVelocity");
                highEnergyTable = new TableInfo(CatalogueRepository, "HighEnergyShizzle");
                velocityColumn  = new ColumnInfo(CatalogueRepository, "Velocity Of Matter", "int", highEnergyTable);

                //now you can add as many links as you want, it just skips them
                lazor.SetColumnInfo(velocityColumn);
                Assert.AreEqual(lazor.ColumnInfo, velocityColumn);
            }
            finally
            {
                lazor.DeleteInDatabase();           //delete child
                predator.DeleteInDatabase();        //delete parent

                velocityColumn.DeleteInDatabase();  //delete child
                highEnergyTable.DeleteInDatabase(); //delete parent
            }
        }
Beispiel #4
0
        public void TestSettingColumnInfoToNull()
        {
            var parent = new Catalogue(CatalogueRepository, "GROG");

            CatalogueItem child1 = new CatalogueItem(CatalogueRepository, parent, "GROG_ITEM1");

            child1.SetColumnInfo(null);

            Assert.IsNull(child1.ColumnInfo_ID);
            child1.DeleteInDatabase();
            parent.DeleteInDatabase();
        }
Beispiel #5
0
        public void clone_CloneCatalogueItemWithIDIntoCatalogue_passes()
        {
            Catalogue parent  = new Catalogue(CatalogueRepository, "KONGOR");
            Catalogue parent2 = new Catalogue(CatalogueRepository, "KONGOR2");

            CatalogueItem child = new CatalogueItem(CatalogueRepository, parent, "KONGOR_SUPERKING")
            {
                Agg_method  = "Adding SetUp",
                Comments    = "do not change amagad super secret!",
                Limitations = "Extreme limitaitons",
                Description =
                    "Exciting things are going down in the streets of new your this time of year it would be a great idea if you were to go there",
                Name               = "KONGOR_MINIMAN",
                Periodicity        = Catalogue.CataloguePeriodicity.Monthly,
                Research_relevance = "Highly relevant to all fields of subatomic particle study",
                Statistical_cons   = "Dangerous cons frequent the areas that this stats is happening, be afraid",
                Topic              = "nothing much, lots of stuff"
            };

            CatalogueItem cloneChild = null;

            try
            {
                child.SaveToDatabase();
                cloneChild = child.CloneCatalogueItemWithIDIntoCatalogue(parent2);

                //get the clone that was returned
                Assert.AreEqual(cloneChild.Catalogue_ID, parent2.ID);   //it is in the second one
                Assert.AreNotEqual(cloneChild.Catalogue_ID, parent.ID); //it is not in the first one
                Assert.AreNotEqual(cloneChild.ID, child.ID);            //it has a new ID

                Assert.AreEqual(cloneChild.Limitations, child.Limitations);
                Assert.AreEqual(cloneChild.Description, child.Description);
                Assert.AreEqual(cloneChild.Name, child.Name);
                Assert.AreEqual(cloneChild.Periodicity, child.Periodicity);
                Assert.AreEqual(cloneChild.Research_relevance, child.Research_relevance);
                Assert.AreEqual(cloneChild.Statistical_cons, child.Statistical_cons);
                Assert.AreEqual(cloneChild.Topic, child.Topic);
            }
            finally
            {
                if (cloneChild != null)
                {
                    cloneChild.DeleteInDatabase();
                }

                child.DeleteInDatabase();
                parent.DeleteInDatabase();
                parent2.DeleteInDatabase();
            }
        }
Beispiel #6
0
        public void constructor_newTestCatalogueItem_pass()
        {
            var parent = new Catalogue(CatalogueRepository, "GROG");

            CatalogueItem child1 = new CatalogueItem(CatalogueRepository, parent, "GROG_ITEM1");
            CatalogueItem child2 = new CatalogueItem(CatalogueRepository, parent, "GROG_ITEM2");

            Assert.IsTrue(child1.Catalogue_ID == parent.ID);
            Assert.IsTrue(child2.Catalogue_ID == parent.ID);

            Assert.IsTrue(child1.ID != child2.ID);

            child1.DeleteInDatabase();
            child2.DeleteInDatabase();
            parent.DeleteInDatabase();
        }
        public void DeleteSetupObjects()
        {
            if (cataItem != null)
            {
                cataItem.DeleteInDatabase();
            }

            cata.DeleteInDatabase();

            if (columnInfo != null)
            {
                columnInfo.DeleteInDatabase();
            }

            if (ti != null)
            {
                ti.DeleteInDatabase();
            }
        }
Beispiel #8
0
        public void ExtractableColumnTest()
        {
            ExtractableDataSet      dataSet       = null;
            ExtractionConfiguration configuration = null;
            Project project = null;

            Catalogue     cata     = null;
            CatalogueItem cataItem = null;
            ColumnInfo    column   = null;
            TableInfo     table    = null;

            ExtractionInformation extractionInformation = null;
            ExtractableColumn     extractableColumn     = null;

            try
            {
                //setup catalogue side of things
                cata     = new Catalogue(CatalogueRepository, "unit_test_ExtractableColumnTest_Cata");
                cataItem = new CatalogueItem(CatalogueRepository, cata, "unit_test_ExtractableColumnTest_CataItem");
                table    = new TableInfo(CatalogueRepository, "DaveTable");
                column   = new ColumnInfo(CatalogueRepository, "Name", "string", table);
                cataItem.SetColumnInfo(column);

                extractionInformation = new ExtractionInformation(CatalogueRepository, cataItem, column, "Hashme(Name)");

                //setup extractor side of things
                dataSet = new ExtractableDataSet(DataExportRepository, cata);
                project = new Project(DataExportRepository, "unit_test_ExtractableColumnTest_Proj");

                configuration = new ExtractionConfiguration(DataExportRepository, project);

                extractableColumn = new ExtractableColumn(DataExportRepository, dataSet, configuration, extractionInformation, 0, "Hashme2(Name)");
                Assert.AreEqual(configuration.GetAllExtractableColumnsFor(dataSet).Length, 1);
            }
            finally
            {
                if (extractionInformation != null)
                {
                    extractionInformation.DeleteInDatabase();
                }

                if (column != null)
                {
                    column.DeleteInDatabase();
                }

                if (table != null)
                {
                    table.DeleteInDatabase();
                }

                if (cataItem != null)
                {
                    cataItem.DeleteInDatabase();
                }

                if (configuration != null)
                {
                    configuration.DeleteInDatabase();
                }

                if (project != null)
                {
                    project.DeleteInDatabase();
                }

                if (dataSet != null)
                {
                    dataSet.DeleteInDatabase();
                }

                if (cata != null)
                {
                    cata.DeleteInDatabase();
                }
            }
        }