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);
        }
        public void GetEntityDisplayNamePluralTest()
        {
            Guid respId = Guid.NewGuid();
            MRetrieveEntityResponse orgResp = new MRetrieveEntityResponse();

            orgResp.EntityMetadataGet = () => { return(new EntityMetadata()); };
            BCrmServiceClient.AddResponse(typeof(RetrieveEntityRequest), orgResp);
            BCrmServiceClient.MockCrmCommandExecute();
            string result = crmaction.GetEntityDisplayNamePlural("account");

            Assert.IsNotNull(result);
        }
        public void GetEntityMetadata()
        {
            OrganizationRequest     orgReq = null;
            EntityMetadata          EM     = new EntityMetadata();
            MRetrieveEntityResponse resp   = new MRetrieveEntityResponse();

            resp.EntityMetadataGet = () => new EntityMetadata();
            BCrmServiceClient.AddResponse(typeof(RetrieveEntityRequest), resp);
            BCrmServiceClient.MockCrmCommandExecute();
            EM = crmaction.GetEntityMetadata("Account", EntityFilters.Default);
            Assert.IsNotNull(EM);
            orgReq = BCrmServiceClient.GetRequest(typeof(RetrieveEntityRequest));
            Assert.IsNotNull(((RetrieveEntityRequest)orgReq).LogicalName);
        }
        public void GetEntityDisplayName()
        {
            OrganizationRequest     orgReq = null;
            MRetrieveEntityResponse resp   = new MRetrieveEntityResponse();

            resp.EntityMetadataGet = () => new EntityMetadata();
            BCrmServiceClient.AddResponse(typeof(RetrieveEntityRequest), resp);
            BCrmServiceClient.MockCrmCommandExecute();
            string entityName  = "account";
            string displayName = crmaction.GetEntityDisplayName(entityName);

            Assert.AreEqual(entityName, displayName);
            orgReq = BCrmServiceClient.GetRequest(typeof(RetrieveEntityRequest));
            Assert.AreEqual(entityName, ((RetrieveEntityRequest)orgReq).LogicalName);
        }
        public void GetEntityTypeCodeTest()
        {
            OrganizationRequest     orgReq      = null;
            MRetrieveEntityResponse retriveResp = new MRetrieveEntityResponse();
            MEntityMetadata         ent         = new MEntityMetadata();

            ent.ObjectTypeCodeGet         = () => { return(1); };
            retriveResp.EntityMetadataGet = () => { return(ent); };
            BCrmServiceClient.AddResponse(typeof(RetrieveEntityRequest), retriveResp);
            BCrmServiceClient.MockCrmCommandExecute();
            string entityName = "account";
            string result     = crmaction.GetEntityTypeCode(entityName);

            Assert.IsNotNull(result);
            orgReq = BCrmServiceClient.GetRequest(typeof(RetrieveEntityRequest));
            Assert.AreEqual(entityName, ((RetrieveEntityRequest)orgReq).LogicalName);
        }