Summary

Class:FakeXrmEasy.XrmFakedRelationship
Assembly:FakeXrmEasy
File(s):F:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedRelationship.cs
Covered lines:43
Uncovered lines:0
Coverable lines:43
Total lines:96
Line coverage:100%
Branch coverage:100%

Metrics

MethodCyclomatic ComplexitySequence CoverageBranch Coverage
.ctor()1100100
.ctor(...)1100100
.ctor(...)1100100

File(s)

F:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedRelationship.cs

#LineLine coverage
 1namespace FakeXrmEasy
 2{
 3    public class XrmFakedRelationship
 4    {
 5
 2106        private string entity1Attribute = string.Empty;
 2107        private string entity2Attribute = string.Empty;
 8
 9        /// <summary>
 10        /// Schema name of the many to many intersect entity
 11        /// </summary>
 159012        public string IntersectEntity { get; set; }
 13
 14        /// <summary>
 15        /// Entity name and attribute of the first entity participating in the relationship
 16        /// </summary>
 17        public string Entity1Attribute
 18        {
 19            get
 91220            {
 91221                 if (entity1Attribute == entity2Attribute && Entity1LogicalName == Entity2LogicalName)
 622                {
 623                    return entity1Attribute + "one";
 24                }
 25                else
 90626                {
 90627                    return entity1Attribute;
 28                }
 91229            }
 61230            set { entity1Attribute = value; }
 31        }
 32
 221433        public string Entity1LogicalName { get; set; }
 34
 156035        public string Entity2LogicalName { get; set; }
 36
 37        /// <summary>
 38        /// Entity name and attribute of the second entity participating in the relationship
 39        /// </summary>
 40        public string Entity2Attribute
 41        {
 42            get
 89443            {
 89444                 if (entity1Attribute == entity2Attribute && Entity1LogicalName == Entity2LogicalName)
 645                {
 646                    return entity2Attribute + "two";
 47                }
 48                else
 88849                {
 88850                    return entity2Attribute;
 51                }
 89452            }
 61253            set { entity2Attribute = value; }
 54        }
 55
 16856        public XrmFakedRelationship()
 16857        {
 16858            RelationshipType = enmFakeRelationshipType.ManyToMany;
 16859        }
 60
 61        public enum enmFakeRelationshipType
 62        {
 63            ManyToMany = 0,
 64            OneToMany = 1
 65        }
 66
 89467        public enmFakeRelationshipType RelationshipType { get; set; }
 68
 69        /// <summary>
 70        /// Initializes a N:N relationship type
 71        /// </summary>
 72        /// <param name="entityName"></param>
 73        /// <param name="entity1Attribute"></param>
 74        /// <param name="entity2Attribute"></param>
 75        /// <param name="entity1LogicalName"></param>
 76        /// <param name="entity2LogicalName"></param>
 1277        public XrmFakedRelationship(string entityName, string entity1Attribute, string entity2Attribute, string entity1L
 1278        {
 1279            IntersectEntity = entityName;
 1280            Entity1Attribute = entity1Attribute;
 1281            Entity2Attribute = entity2Attribute;
 1282            Entity1LogicalName = entity1LogicalName;
 1283            Entity2LogicalName = entity2LogicalName;
 1284            RelationshipType = enmFakeRelationshipType.ManyToMany;
 1285        }
 86
 3087        public XrmFakedRelationship(string entity1Attribute, string entity2Attribute, string entity1LogicalName, string 
 3088        {
 3089            Entity1Attribute = entity1Attribute;
 3090            Entity2Attribute = entity2Attribute;
 3091            Entity1LogicalName = entity1LogicalName;
 3092            Entity2LogicalName = entity2LogicalName;
 3093            RelationshipType = enmFakeRelationshipType.OneToMany;
 3094        }
 95    }
 96}