public void GetEntityAttributeMetadataForAttribute() { OrganizationRequest orgReq = null; AttributeMetadata AM = new AttributeMetadata(); MRetrieveAttributeResponse resp = new MRetrieveAttributeResponse(); BCrmServiceClient.AddResponse(typeof(RetrieveAttributeRequest), resp); resp.AttributeMetadataGet = () => new AttributeMetadata(); BCrmServiceClient.MockCrmCommandExecute(); AM = crmaction.GetEntityAttributeMetadataForAttribute("contact", "attribute"); Assert.IsNotNull(AM); orgReq = BCrmServiceClient.GetRequest(typeof(RetrieveAttributeRequest)); Assert.IsNotNull(((RetrieveAttributeRequest)orgReq).LogicalName); Assert.IsNotNull(((RetrieveAttributeRequest)orgReq).EntityLogicalName); }
public void GetAllAttributesForEntity() { OrganizationRequest orgReq = null; List <AttributeMetadata> AM = new List <AttributeMetadata>(); MRetrieveAttributeResponse resp = new MRetrieveAttributeResponse(); resp.AttributeMetadataGet = () => new AttributeMetadata(); MEntityMetadata metadata = new MEntityMetadata(); metadata.AttributesGet = () => new AttributeMetadata[1] { new AttributeMetadata() }; MMetadataUtility.AllInstances.GetEntityMetadataString = (objMutility, str) => { return(metadata); }; BCrmServiceClient.AddResponse(typeof(RetrieveAttributeRequest), resp); BCrmServiceClient.MockCrmCommandExecute(); AM = crmaction.GetAllAttributesForEntity("contact"); Assert.IsNotNull(AM); }