Example #1
0
        public void MappableEntity_CallsNewEntityOnServiceWhenIdNull()
        {
            const string entityName = "entity";
            var          newEntity  = new Entity("mock");

            _mockService.Setup(mock => mock.NewEntity(entityName, _context)).Returns(newEntity);

            var result = _crm.MappableEntity(entityName, null, _context);

            result.Should().Be(newEntity);
        }
Example #2
0
        public virtual Entity ToEntity(ICrmService crm, OrganizationServiceContext context)
        {
            if (!ShouldMap(crm))
            {
                return(null);
            }

            var entity = crm.MappableEntity(LogicalName(GetType()), Id, context);

            MapFieldAttributesToEntity(entity);
            MapRelationshipAttributesToEntity(entity, crm, context);
            return(entity);
        }