public void LocationLinkTest() { AddPrincipalToThread(); AnnotateService target = new AnnotateService(Parameters.TestDatabaseName); // TODO: Initialize to an appropriate value //Create a structure type, a structure, and some links StructureType t = CreatePopulatedStructureType("Test"); long[] IDs = target.UpdateStructureTypes(new StructureType[] { t }); long StructureTypeID = IDs[0]; //Create structure and location Structure newStruct = new Structure(); newStruct.TypeID = StructureTypeID; Location newPos = new Location(); newPos.ParentID = newStruct.ID; AnnotationPoint P = new AnnotationPoint(); P.X = 0; P.Y = 0; P.Z = 0; newPos.Position = P; CreateStructureRetval retval = target.CreateStructure(newStruct, newPos); long StructureID = retval.structure.ID; long LocationAID = retval.location.ID; //Create a second location for the structure, linked to the first Location B = new Location(); B.ParentID = StructureID; P.Z = 1; B.Position = P; B.DBAction = DBACTION.INSERT; IDs = target.Update(new Location[] { B } ); long LocationBID = IDs[0]; target.CreateLocationLink(LocationAID, LocationBID); target.DeleteLocationLink(LocationBID, LocationAID); //Delete the locations Location LocationA = target.GetLocationByID(LocationAID); Location LocationB = target.GetLocationByID(LocationBID); LocationA.DBAction = DBACTION.DELETE; LocationB.DBAction = DBACTION.DELETE; target.Update( new Location[] { LocationA, LocationB}); //Delete the structure newStruct = target.GetStructureByID(StructureID, false); newStruct.DBAction = DBACTION.DELETE; target.UpdateStructures(new Structure[] { newStruct }); //Delete the structure type t = target.GetStructureTypeByID(StructureTypeID); t.DBAction = DBACTION.DELETE; target.UpdateStructureTypes(new StructureType[] { t }); }