Ejemplo n.º 1
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();
            }
        }