Exemplo n.º 1
0
        public void InsertUpdateDeleteStructureTypesTest()
        {
            AddPrincipalToThread();

            AnnotateService target = new AnnotateService(Parameters.TestDatabaseName); // TODO: Initialize to an appropriate value
            string StructureTypeName = "TestStructureTypeInsert";

            StructureType t = CreatePopulatedStructureType(StructureTypeName);

            long[] IDs = target.UpdateStructureTypes(new StructureType[] { t } );
            long testID = IDs[0];

            StructureType[] allTypes = target.GetStructureTypes();
            StructureType insertedType = null;
            foreach (StructureType s in allTypes)
            {
                if (s.Name == StructureTypeName)
                {
                    insertedType = s;
                    break;
                }
            }

            Assert.IsNotNull(insertedType, "Could not find inserted type");

            t = target.GetStructureTypeByID(testID);

            /* Test Update */
            string UpdateTestName = "UpdateStructureTypesTest";
            string OriginalName = t.Name;
            Assert.AreEqual(t.Name, StructureTypeName);

            t.Name = UpdateTestName;
            t.DBAction = DBACTION.UPDATE;

            target.UpdateStructureTypes(new StructureType[] { t });

            t = target.GetStructureTypeByID(testID);

            Assert.AreEqual(t.Name, UpdateTestName);
            t.Name = OriginalName;
            t.DBAction = DBACTION.UPDATE;

            target.UpdateStructureTypes(new StructureType[] { t });

            t = target.GetStructureTypeByID(testID);
            Assert.AreEqual(t.Name, StructureTypeName);

            /* Test Delete */
            t.DBAction = DBACTION.DELETE;

            target.UpdateStructureTypes(new StructureType[] { t });

            allTypes = target.GetStructureTypes();
            StructureType deletedType = null;
            foreach (StructureType s in allTypes)
            {
                if (s.Name == StructureTypeName)
                {
                    deletedType = s;
                    break;
                }
            }

            Assert.IsNull(deletedType,"Found deleted type");
        }
Exemplo n.º 2
0
        public void GetStructureTypesTest()
        {
            AddPrincipalToThread();

            AnnotateService target = new AnnotateService(Parameters.TestDatabaseName); // TODO: Initialize to an appropriate value
            StructureType[] actual;
            actual = target.GetStructureTypes();
        }