Пример #1
0
        public void ExistsReturnsFalseWhenContactDoesNotExists()
        {
            Contact contact = CreateTestContact();

            contact.emailaddress1 = $"email {Guid.NewGuid()}";
            contact.firstname     = $"firstname {Guid.NewGuid()}";
            contact.Insert();

            bool exists = StaticCrm.Exists <Contact>(_dynamicsCrmConnection, new Dictionary <string, string>()
            {
                { "emailaddress1", contact.emailaddress1 },
                { "firstname", $"firstname {Guid.NewGuid()}" },
            });

            contact.Delete();

            Assert.False(exists);
        }
Пример #2
0
        private void CreateInsertedIntermediateEntity(string insertedEntityName, string insertedEntityIdName, string insertedEntityOriginIdName, dynamic insertedEntity)
        {
            string originEntityIdName = _databaseCopyNN.originEntityIdName;
            string targetName         = _databaseCopyNN.targetName;
            string targetIdName       = _databaseCopyNN.targetIdName;
            string intermediateEntityRelationshipName = _databaseCopyNN.intermediateEntityRelationshipName;

            IDictionary <string, object> insertedEntityDictionary = (IDictionary <string, object>)insertedEntity;

            Guid insertedEntityId       = (Guid)insertedEntityDictionary[insertedEntityIdName];
            Guid insertedEntityOriginId = StaticCrm.GetGuidFromReference(insertedEntityDictionary[insertedEntityOriginIdName]);

            List <dynamic> originIntermediateEntities = GetOriginIntermediateEntities(originEntityIdName, targetIdName, insertedEntityOriginId);

            foreach (dynamic originIntermediateEntity in originIntermediateEntities)
            {
                IDictionary <string, object> originIntermediateEntityDictionary = (IDictionary <string, object>)originIntermediateEntity;

                Guid targetId = (Guid)originIntermediateEntityDictionary[targetIdName];

                StaticCrm.AssociateNN(_dynamicsCrmConnection, intermediateEntityRelationshipName, insertedEntityName, insertedEntityId, targetName, targetId);
            }
        }
Пример #3
0
        public void GetAllAttributeNames()
        {
            List <string> attributeNames = StaticCrm.GetAllAttributeNames(_dynamicsCrmConnection, typeof(Annotation));

            Assert.Greater(attributeNames.Count, 3);
        }