public void TestEAProjOM() { string className = "ProjectionIncludeTest"; string testName = "TestEAProjOM"; string entityName_RGB = "RGB"; List <TypeAttributeParam> attributeParams_RGB = new List <TypeAttributeParam>(); { attributeParams_RGB.Add(new TypeAttributeParam("Red", "string", "hasA")); attributeParams_RGB.Add(new TypeAttributeParam("Green", "string", "hasA")); attributeParams_RGB.Add(new TypeAttributeParam("Blue", "string", "hasA")); attributeParams_RGB.Add(new TypeAttributeParam("IsGrayscale", "boolean", "hasA")); } string entityName_Color = "Color"; List <TypeAttributeParam> attributeParams_Color = new List <TypeAttributeParam>(); { attributeParams_Color.Add(new TypeAttributeParam("ColorName", "string", "identifiedBy")); } List <string> includeAttributeNames = new List <string>() { "Red", "Green", "Blue" }; using (ProjectionOMTestUtil util = new ProjectionOMTestUtil(className, testName)) { CdmEntityDefinition entity_RGB = util.CreateBasicEntity(entityName_RGB, attributeParams_RGB); util.ValidateBasicEntity(entity_RGB, entityName_RGB, attributeParams_RGB); CdmEntityDefinition entity_Color = util.CreateBasicEntity(entityName_Color, attributeParams_Color); util.ValidateBasicEntity(entity_Color, entityName_Color, attributeParams_Color); CdmProjection projection_RGBColor = util.CreateProjection(entity_RGB.EntityName); CdmOperationIncludeAttributes operation_IncludeAttributes = util.CreateOperationInputAttribute(projection_RGBColor, includeAttributeNames); CdmEntityReference projectionEntityRef_RGBColor = util.CreateProjectionInlineEntityReference(projection_RGBColor); CdmEntityAttributeDefinition entityAttribute_RGBColor = util.CreateEntityAttribute("RGBColor", projectionEntityRef_RGBColor); entity_Color.Attributes.Add(entityAttribute_RGBColor); foreach (List <string> resOpts in resOptsCombinations) { CdmEntityDefinition resolvedEntity_Color = util.GetAndValidateResolvedEntity(entity_Color, resOpts); } util.DefaultManifest.SaveAsAsync(util.ManifestDocName, saveReferenced: true).GetAwaiter().GetResult(); } }
public async Task TestEAProjOM() { string className = "ProjectionCombineTest"; string testName = "TestEAProjOM"; string entityName_Email = "Email"; List <TypeAttributeParam> attributeParams_Email = new List <TypeAttributeParam>(); { attributeParams_Email.Add(new TypeAttributeParam("EmailID", "string", "identifiedBy")); attributeParams_Email.Add(new TypeAttributeParam("Address", "string", "hasA")); attributeParams_Email.Add(new TypeAttributeParam("IsPrimary", "boolean", "hasA")); } string entityName_Phone = "Phone"; List <TypeAttributeParam> attributeParams_Phone = new List <TypeAttributeParam>(); { attributeParams_Phone.Add(new TypeAttributeParam("PhoneID", "string", "identifiedBy")); attributeParams_Phone.Add(new TypeAttributeParam("Number", "string", "hasA")); attributeParams_Phone.Add(new TypeAttributeParam("IsPrimary", "boolean", "hasA")); } string entityName_Social = "Social"; List <TypeAttributeParam> attributeParams_Social = new List <TypeAttributeParam>(); { attributeParams_Social.Add(new TypeAttributeParam("SocialID", "string", "identifiedBy")); attributeParams_Social.Add(new TypeAttributeParam("Account", "string", "hasA")); attributeParams_Social.Add(new TypeAttributeParam("IsPrimary", "boolean", "hasA")); } string entityName_Customer = "Customer"; List <TypeAttributeParam> attributeParams_Customer = new List <TypeAttributeParam>(); { attributeParams_Customer.Add(new TypeAttributeParam("CustomerName", "string", "hasA")); } List <string> selectedAttributes = new List <string>() { "EmailID", "PhoneID", "SocialID" }; using (ProjectionOMTestUtil util = new ProjectionOMTestUtil(className, testName)) { CdmEntityDefinition entity_Email = util.CreateBasicEntity(entityName_Email, attributeParams_Email); util.ValidateBasicEntity(entity_Email, entityName_Email, attributeParams_Email); CdmEntityDefinition entity_Phone = util.CreateBasicEntity(entityName_Phone, attributeParams_Phone); util.ValidateBasicEntity(entity_Phone, entityName_Phone, attributeParams_Phone); CdmEntityDefinition entity_Social = util.CreateBasicEntity(entityName_Social, attributeParams_Social); util.ValidateBasicEntity(entity_Social, entityName_Social, attributeParams_Social); CdmEntityDefinition entity_Customer = util.CreateBasicEntity(entityName_Customer, attributeParams_Customer); util.ValidateBasicEntity(entity_Customer, entityName_Customer, attributeParams_Customer); CdmProjection projection_Customer = util.CreateProjection(entity_Customer.EntityName); CdmTypeAttributeDefinition typeAttribute_MergeInto = util.CreateTypeAttribute("MergeInto", "string", "hasA"); CdmOperationCombineAttributes operation_CombineAttributes = util.CreateOperationCombineAttributes(projection_Customer, selectedAttributes, typeAttribute_MergeInto); CdmEntityReference projectionEntityRef_Customer = util.CreateProjectionInlineEntityReference(projection_Customer); CdmEntityAttributeDefinition entityAttribute_ContactAt = util.CreateEntityAttribute("ContactAt", projectionEntityRef_Customer); entity_Customer.Attributes.Add(entityAttribute_ContactAt); foreach (List <string> resOpts in resOptsCombinations) { await util.GetAndValidateResolvedEntity(entity_Customer, resOpts); } util.DefaultManifest.SaveAsAsync(util.ManifestDocName, saveReferenced: true).GetAwaiter().GetResult(); } }