public void CreateOrUpdatePickListElementTest() { OrganizationRequest orgReq = null; Guid respId = Guid.NewGuid(); MRetrieveEntityResponse rtventResp = new MRetrieveEntityResponse(); MEntityMetadata entmt = new MEntityMetadata(); entmt.IsCustomEntityGet = () => { return(true); }; rtventResp.EntityMetadataGet = () => { return(entmt); }; BCrmServiceClient.AddResponse(typeof(RetrieveEntityRequest), rtventResp); BCrmServiceClient.MockCrmCommandExecute(); List <AttributeData> lst1 = new List <AttributeData>(); lst1.Add(new AttributeData()); MDynamicEntityUtility.AllInstances.GetAttributeDataByEntityStringStringArray = (obj, str, arrstr) => { return(lst1); }; List <LocalizedLabel> lst = new List <LocalizedLabel>(); lst.Add(new LocalizedLabel()); BCrmServiceClient.MockGetPickListElementFromMetadataEntity(); bool result = crmaction.CreateOrUpdatePickListElement("account", "name", lst, 1, true); Assert.IsTrue(result); orgReq = BCrmServiceClient.GetRequest(typeof(InsertOptionValueRequest)); Assert.IsNotNull(((InsertOptionValueRequest)orgReq).Value); }