message: Testing getECClassMetaData
diff: @@ -56,5 +56,63 @@ describe("ECSqlStatement", () => {
  assert.notEqual(rows.length, 0);
  assert.notEqual(rows[0].ecinstanceid, "");
  });
  +});
  +
  +describe("ECClassMetaData", () => {
  +
  + it("should get metadata for class", async () => {
  + const imodel: IModel = await ECSqlStatementTestUtils.openIModel("test.bim", true);
  + const metadatastr: string = await imodel.getDgnDb().getECClassMetaData("biscore", "Element");
  + assert.isNotNull(metadatastr);
  + assert.isString(metadatastr);
  + assert.notEqual(metadatastr.length, 0);
  + const obj: any = JSON.parse(metadatastr);
  + assert.isNotNull(obj);
  + assert.isString(obj.name);
  + assert.equal(obj.name, "Element");
  + assert.equal(obj.schema, "BisCore");
  + assert.isArray(obj.baseClasses);
  + assert.equal(obj.baseClasses.length, 0);
  + assert.isArray(obj.customAttributes);
  + let foundClassHasHandler = false;
  + let foundClassHasCurrentTimeStampProperty = false;
  + for (const ca of obj.customAttributes) {
  + if (ca.ecclass.name === "ClassHasHandler")
  + foundClassHasHandler = true;
  + else if (ca.ecclass.name === "ClassHasCurrentTimeStampProperty")
  + foundClassHasCurrentTimeStampProperty = true;
  + }
  + assert.isTrue(foundClassHasHandler);
  + assert.isTrue(foundClassHasCurrentTimeStampProperty);
  + assert.isDefined(obj.federationGuid);
  + assert.isDefined(obj.federationGuid.primitiveECProperty);
  + assert.equal(obj.federationGuid.primitiveECProperty.type, "binary");
  + assert.equal(obj.federationGuid.primitiveECProperty.extendedType, "BeGuid");
  + });
  + it("should get metadata for CA class just as well (and we'll see an array-typed property)", async () => {
  + const imodel: IModel = await ECSqlStatementTestUtils.openIModel("test.bim", true);
  + const metadatastr: string = await imodel.getDgnDb().getECClassMetaData("biscore", "ClassHasHandler");
  + assert.isNotNull(metadatastr);
  + assert.isString(metadatastr);
  + assert.notEqual(metadatastr.length, 0);
  + const obj: any = JSON.parse(metadatastr);
  + assert.isDefined(obj.restrictions);
  + assert.isDefined(obj.restrictions.primitveArrayECProperty);
  + assert.equal(obj.restrictions.primitveArrayECProperty.type, "string");
  + assert.equal(obj.restrictions.primitveArrayECProperty.minOccurs, 0);
  + });
  +
  + it("should get metadata for class, and we'll see a struct-typed property", async () => {
  + debugger;
  + const imodel: IModel = await ECSqlStatementTestUtils.openIModel("test.bim", true);
  + const metadatastr: string = await imodel.getDgnDb().getECClassMetaData("biscore", "AnnotationTableCell");
  + assert.isNotNull(metadatastr);
  + assert.isString(metadatastr);
  + assert.notEqual(metadatastr.length, 0);
  + const obj: any = JSON.parse(metadatastr);
  + assert.isDefined(obj.cellIndex);
  + assert.isDefined(obj.cellIndex.structECProperty);
  + assert.equal(obj.cellIndex.structECProperty.type, "AnnotationTableCellIndex");
  + });
  });
  