diff --git a/DevToolkitSamples/Properties/AssemblyInfo.cs b/DevToolkitSamples/Properties/AssemblyInfo.cs index ebc5e3cc..994ce8ab 100644 --- a/DevToolkitSamples/Properties/AssemblyInfo.cs +++ b/DevToolkitSamples/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.2013/Properties/AssemblyInfo.cs b/FakeXrmEasy.2013/Properties/AssemblyInfo.cs index cdd124dc..352ae97a 100644 --- a/FakeXrmEasy.2013/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.2013/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.2015/Properties/AssemblyInfo.cs b/FakeXrmEasy.2015/Properties/AssemblyInfo.cs index 2a4284e6..c1db53c7 100644 --- a/FakeXrmEasy.2015/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.2015/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.2016/Properties/AssemblyInfo.cs b/FakeXrmEasy.2016/Properties/AssemblyInfo.cs index 28bfe770..5218e951 100644 --- a/FakeXrmEasy.2016/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.2016/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.365/Properties/AssemblyInfo.cs b/FakeXrmEasy.365/Properties/AssemblyInfo.cs index db976c40..472d22b8 100644 --- a/FakeXrmEasy.365/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.365/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.9/Properties/AssemblyInfo.cs b/FakeXrmEasy.9/Properties/AssemblyInfo.cs index c1d9bf6a..4760b4b0 100644 --- a/FakeXrmEasy.9/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.9/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs index dc123e00..e01cc9c1 100644 --- a/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs index 15f24ec1..c57da72e 100644 --- a/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs index 485ce3bf..88766dc6 100644 --- a/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs index 8c7b36ec..5f3b0506 100644 --- a/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.Tests.9/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.9/Properties/AssemblyInfo.cs index 3b3ddecb..1349daf7 100644 --- a/FakeXrmEasy.Tests.9/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.9/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs index 388fa7e2..fbb528c4 100644 --- a/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.44.0.0")] -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] diff --git a/FakeXrmEasy/Properties/AssemblyInfo.cs b/FakeXrmEasy/Properties/AssemblyInfo.cs index beff8657..b1487d9c 100644 --- a/FakeXrmEasy/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.51.0.0")] -[assembly: AssemblyFileVersion("1.51.0.0")] -[assembly: AssemblyInformationalVersion("1.51.0.0 - master - 9ee088")] +[assembly: AssemblyVersion("1.51.1.0")] +[assembly: AssemblyFileVersion("1.51.1.0")] +[assembly: AssemblyInformationalVersion("1.51.1.0 - master - 71f0ef")] diff --git a/build.fsx b/build.fsx index 947dd60c..e067e583 100644 --- a/build.fsx +++ b/build.fsx @@ -48,8 +48,8 @@ let nugetDeployDir = @"[Enter_NuGet_Url]" let packagesDir = @".\packages\" let nuGetCommandLine = @".\tools\nuget\nuget410.exe" -let mutable previousVersion = "1.50.1" -let mutable version = "1.51.0" //Copy this into previousVersion before publishing packages... +let mutable previousVersion = "1.51.0" +let mutable version = "1.51.1" //Copy this into previousVersion before publishing packages... let mutable build = buildVersion let mutable nugetVersion = version let mutable asmVersion = version diff --git a/test/reports/FakeXrmEasy_AccessRightsRepository.htm b/test/reports/FakeXrmEasy_AccessRightsRepository.htm index 4e2b197c..4143b32b 100644 --- a/test/reports/FakeXrmEasy_AccessRightsRepository.htm +++ b/test/reports/FakeXrmEasy_AccessRightsRepository.htm @@ -54,11 +54,11 @@

D:\  10    {  11        protected Dictionary<EntityReference, List<PrincipalAccess>> _accessRights;  12 - 385513        public AccessRightsRepository() - 385514        { + 386113        public AccessRightsRepository() + 386114        {  15            //One record might be accessed from many security principals - 385516            _accessRights = new Dictionary<EntityReference, List<PrincipalAccess>>(); - 385517        } + 386116            _accessRights = new Dictionary<EntityReference, List<PrincipalAccess>>(); + 386117        }  18  19        /// <summary>  20        /// Grants the specified rights to the security principal (user or team) for the specified record @@ -167,6 +167,6 @@

D:\  123} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AddListMembersListRequestExecutor.htm b/test/reports/FakeXrmEasy_AddListMembersListRequestExecutor.htm index 155ab97c..ba71188a 100644 --- a/test/reports/FakeXrmEasy_AddListMembersListRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AddListMembersListRequestExecutor.htm @@ -139,13 +139,13 @@

 18100        }  101  102        public Type GetResponsibleRequestType() - 3855103        { - 3855104            return typeof(AddListMembersListRequest); - 3855105        } + 3861103        { + 3861104            return typeof(AddListMembersListRequest); + 3861105        }  106    }  107} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AddMemberListRequestExecutor.htm b/test/reports/FakeXrmEasy_AddMemberListRequestExecutor.htm index 1f082f3d..6e41b52d 100644 --- a/test/reports/FakeXrmEasy_AddMemberListRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AddMemberListRequestExecutor.htm @@ -135,13 +135,13 @@

 1896        }  97  98        public Type GetResponsibleRequestType() - 385599        { - 3855100            return typeof(AddMemberListRequest); - 3855101        } + 386199        { + 3861100            return typeof(AddMemberListRequest); + 3861101        }  102    }  103} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AddMembersTeamRequestExecutor.htm b/test/reports/FakeXrmEasy_AddMembersTeamRequestExecutor.htm index ce6126e8..b92665d3 100644 --- a/test/reports/FakeXrmEasy_AddMembersTeamRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AddMembersTeamRequestExecutor.htm @@ -95,13 +95,13 @@

 656        }  57  58        public Type GetResponsibleRequestType() - 385559        { - 385560            return typeof(AddMembersTeamRequest); - 385561        } + 386159        { + 386160            return typeof(AddMembersTeamRequest); + 386161        }  62    }  63} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AddToQueueRequestExecutor.htm b/test/reports/FakeXrmEasy_AddToQueueRequestExecutor.htm index 8d3732c1..d2eb6b17 100644 --- a/test/reports/FakeXrmEasy_AddToQueueRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AddToQueueRequestExecutor.htm @@ -90,13 +90,13 @@

 651        }  52  53        public Type GetResponsibleRequestType() - 385554        { - 385555            return typeof(AddToQueueRequest); - 385556        } + 386154        { + 386155            return typeof(AddToQueueRequest); + 386156        }  57    }  58} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AddUserToRecordTeamRequestExecutor.htm b/test/reports/FakeXrmEasy_AddUserToRecordTeamRequestExecutor.htm index 124b9303..9cc3d644 100644 --- a/test/reports/FakeXrmEasy_AddUserToRecordTeamRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AddUserToRecordTeamRequestExecutor.htm @@ -129,14 +129,14 @@

 590        }  91  92        public Type GetResponsibleRequestType() - 323993        { - 323994            return typeof(AddUserToRecordTeamRequest); - 323995        } + 324493        { + 324494            return typeof(AddUserToRecordTeamRequest); + 324495        }  96    }  97}  98#endif - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ArrayExtensions.htm b/test/reports/FakeXrmEasy_ArrayExtensions.htm index b998c72e..5ad2ec4c 100644 --- a/test/reports/FakeXrmEasy_ArrayExtensions.htm +++ b/test/reports/FakeXrmEasy_ArrayExtensions.htm @@ -209,6 +209,6 @@

D:\Git\fak  172} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ArrayTraverse.htm b/test/reports/FakeXrmEasy_ArrayTraverse.htm index 107cc716..e615ef9a 100644 --- a/test/reports/FakeXrmEasy_ArrayTraverse.htm +++ b/test/reports/FakeXrmEasy_ArrayTraverse.htm @@ -210,6 +210,6 @@

D:\Git\fak  172} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AssignRequestExecutor.htm b/test/reports/FakeXrmEasy_AssignRequestExecutor.htm index 8274ef96..bb04f9e5 100644 --- a/test/reports/FakeXrmEasy_AssignRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AssignRequestExecutor.htm @@ -94,13 +94,13 @@

 1855        }  56  57        public Type GetResponsibleRequestType() - 385558        { - 385559            return typeof(AssignRequest); - 385560        } + 386158        { + 386159            return typeof(AssignRequest); + 386160        }  61    }  62} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm b/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm index 46cb4ff8..d508438b 100644 --- a/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm @@ -135,13 +135,13 @@

 13896        }  97  98        public Type GetResponsibleRequestType() - 385599        { - 3855100            return typeof(AssociateRequest); - 3855101        } + 386199        { + 3861100            return typeof(AssociateRequest); + 3861101        }  102    }  103} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_BulkDeleteRequestExecutor.htm b/test/reports/FakeXrmEasy_BulkDeleteRequestExecutor.htm index a843d119..eb842f28 100644 --- a/test/reports/FakeXrmEasy_BulkDeleteRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_BulkDeleteRequestExecutor.htm @@ -105,13 +105,13 @@

 666        }  67  68        public Type GetResponsibleRequestType() - 385569        { - 385570            return typeof(BulkDeleteRequest); - 385571        } + 386169        { + 386170            return typeof(BulkDeleteRequest); + 386171        }  72    }  73} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_CloseIncidentRequestExecutor.htm b/test/reports/FakeXrmEasy_CloseIncidentRequestExecutor.htm index 0d92c213..41e397c6 100644 --- a/test/reports/FakeXrmEasy_CloseIncidentRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_CloseIncidentRequestExecutor.htm @@ -108,13 +108,13 @@

 669        }  70  71        public Type GetResponsibleRequestType() - 385572        { - 385573            return typeof(CloseIncidentResponse); - 385574        } + 386172        { + 386173            return typeof(CloseIncidentResponse); + 386174        }  75    }  76} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_CloseQuoteRequestExecutor.htm b/test/reports/FakeXrmEasy_CloseQuoteRequestExecutor.htm index 25394ca6..9a4d56f6 100644 --- a/test/reports/FakeXrmEasy_CloseQuoteRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_CloseQuoteRequestExecutor.htm @@ -91,13 +91,13 @@

 652        }  53  54        public Type GetResponsibleRequestType() - 385555        { - 385556            return typeof(CloseQuoteRequest); - 385557        } + 386155        { + 386156            return typeof(CloseQuoteRequest); + 386157        }  58    }  59} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_CreateRequestExecutor.htm b/test/reports/FakeXrmEasy_CreateRequestExecutor.htm index 6a917aa1..66db3fff 100644 --- a/test/reports/FakeXrmEasy_CreateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_CreateRequestExecutor.htm @@ -65,13 +65,13 @@

 12627        }  28  29        public Type GetResponsibleRequestType() - 385530        { - 385531            return typeof(CreateRequest); - 385532        } + 386130        { + 386131            return typeof(CreateRequest); + 386132        }  33    }  34} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_DefaultEntityInitializerService.htm b/test/reports/FakeXrmEasy_DefaultEntityInitializerService.htm index dc0dd75c..9a6eb791 100644 --- a/test/reports/FakeXrmEasy_DefaultEntityInitializerService.htm +++ b/test/reports/FakeXrmEasy_DefaultEntityInitializerService.htm @@ -55,55 +55,55 @@

 16  17        public Dictionary<string, IEntityInitializerService> InitializerServiceDictionary;  18 - 386119        public DefaultEntityInitializerService() - 386120        { - 386121            InitializerServiceDictionary = new Dictionary<string, IEntityInitializerService>() - 386122            { - 386123                { InvoiceDetailInitializerService.EntityLogicalName, new InvoiceDetailInitializerService() }, - 386124                { InvoiceInitializerService.EntityLogicalName, new InvoiceInitializerService() } - 386125            }; - 386126        } + 386719        public DefaultEntityInitializerService() + 386720        { + 386721            InitializerServiceDictionary = new Dictionary<string, IEntityInitializerService>() + 386722            { + 386723                { InvoiceDetailInitializerService.EntityLogicalName, new InvoiceDetailInitializerService() }, + 386724                { InvoiceInitializerService.EntityLogicalName, new InvoiceInitializerService() } + 386725            }; + 386726        }  27  28        public Entity Initialize(Entity e, Guid gCallerId, XrmFakedContext ctx, bool isManyToManyRelationshipEntity = fa - 2774629        { + 2775229        {  30            //Validate primary key for dynamic entities - 2774631            var primaryKey = string.Format("{0}id", e.LogicalName); - 2774632             if (!e.Attributes.ContainsKey(primaryKey)) + 2775231            var primaryKey = string.Format("{0}id", e.LogicalName); + 2775232             if (!e.Attributes.ContainsKey(primaryKey))  2200433            {  2200434                e[primaryKey] = e.Id;  2200435            }  36 - 2774637             if (isManyToManyRelationshipEntity) + 2775237             if (isManyToManyRelationshipEntity)  6038            {  6039                return e;  40            }  41 - 2768642            var CallerId = new EntityReference("systemuser", gCallerId); //Create a new instance by default + 2769242            var CallerId = new EntityReference("systemuser", gCallerId); //Create a new instance by default  43 - 2768644            var now = DateTime.UtcNow; + 2769244            var now = DateTime.UtcNow;  45 - 2768646            e.SetValueIfEmpty("createdon", now); + 2769246            e.SetValueIfEmpty("createdon", now);  47  48            //Overriden created on should replace created on - 2768649             if (e.Contains("overriddencreatedon")) + 2769249             if (e.Contains("overriddencreatedon"))  650            {  651                e["createdon"] = e["overriddencreatedon"];  652            }  53 - 2768654            e.SetValueIfEmpty("modifiedon", now); - 2768655            e.SetValueIfEmpty("createdby", CallerId); - 2768656            e.SetValueIfEmpty("modifiedby", CallerId); - 2768657            e.SetValueIfEmpty("ownerid", CallerId); - 2768658            e.SetValueIfEmpty("statecode", new OptionSetValue(0)); //Active by default + 2769254            e.SetValueIfEmpty("modifiedon", now); + 2769255            e.SetValueIfEmpty("createdby", CallerId); + 2769256            e.SetValueIfEmpty("modifiedby", CallerId); + 2769257            e.SetValueIfEmpty("ownerid", CallerId); + 2769258            e.SetValueIfEmpty("statecode", new OptionSetValue(0)); //Active by default  59 - 2768660             if (ctx.InitializationLevel == EntityInitializationLevel.PerEntity) + 2769260             if (ctx.InitializationLevel == EntityInitializationLevel.PerEntity)  36061            {  36062                 if (!string.IsNullOrEmpty(e.LogicalName) && InitializerServiceDictionary.ContainsKey(e.LogicalName))  14463                    InitializerServiceDictionary[e.LogicalName].Initialize(e, gCallerId, ctx, isManyToManyRelationshipEn  36064            }  65 - 2768666            return e; - 2774667        } + 2769266            return e; + 2775267        }  68  69        public Entity Initialize(Entity e, XrmFakedContext ctx, bool isManyToManyRelationshipEntity = false)  070        { @@ -113,6 +113,6 @@

 74} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm b/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm index 1861bd5a..a9309981 100644 --- a/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm @@ -71,13 +71,13 @@

 932        }  33  34        public Type GetResponsibleRequestType() - 385535        { - 385536            return typeof(DeleteRequest); - 385537        } + 386135        { + 386136            return typeof(DeleteRequest); + 386137        }  38    }  39} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm b/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm index 47e24a03..1de7a493 100644 --- a/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm @@ -106,13 +106,13 @@

 2467        }  68  69        public Type GetResponsibleRequestType() - 385570        { - 385571            return typeof(DisassociateRequest); - 385572        } + 386170        { + 386171            return typeof(DisassociateRequest); + 386172        }  73    }  74} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_EntityExtensions.htm b/test/reports/FakeXrmEasy_EntityExtensions.htm index a0d8b379..4af6f4eb 100644 --- a/test/reports/FakeXrmEasy_EntityExtensions.htm +++ b/test/reports/FakeXrmEasy_EntityExtensions.htm @@ -15,12 +15,12 @@

Summary

Class:FakeXrmEasy.Extensions.EntityExtensions Assembly:FakeXrmEasy File(s):D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\Extensions\EntityExtensions.cs -Covered lines:270 +Covered lines:277 Uncovered lines:81 -Coverable lines:351 -Total lines:534 -Line coverage:76.9% -Branch coverage:82.2% +Coverable lines:358 +Total lines:542 +Line coverage:77.3% +Branch coverage:82%

Metrics

@@ -31,11 +31,12 @@

Metrics

ProjectAttributes(...)1100100 ApplyDateBehaviour(...)7100100 ProjectAttributes(...)1584.7876.92 -ProjectAttributes(...)1496.1594.12 +ProjectAttributes(...)149693.33 +RemoveNullAttributes(...)5100100 CloneAttribute(...)2795.9592.68 Clone(...)1210080 Clone(...)100 -Clone(...)1210085.71 +Clone(...)1310085.71 JoinAttributes(...)125036.36 JoinAttributes(...)1300 KeySelector(...)893.1092.31 @@ -82,19 +83,19 @@

D:\Git\fak  31        /// <param name="alias"></param>  32        /// <returns></returns>  33        public static Entity ProjectAttributes(this Entity e, ColumnSet columnSet, XrmFakedContext context) - 13434        { - 13435            return ProjectAttributes(e, new QueryExpression() { ColumnSet = columnSet }, context); - 13436        } + 14034        { + 14035            return ProjectAttributes(e, new QueryExpression() { ColumnSet = columnSet }, context); + 14036        }  37  38        public static void ApplyDateBehaviour(this Entity e, XrmFakedContext context) - 1625939        { + 1627139        {  40#if FAKE_XRM_EASY || FAKE_XRM_EASY_2013 - 538241            return; //Do nothing... DateBehavior wasn't available for versions <= 2013 + 538641            return; //Do nothing... DateBehavior wasn't available for versions <= 2013  42#else  43 - 1087744             if (context.DateBehaviour.Count == 0 || e.LogicalName == null || !context.DateBehaviour.ContainsKey(e.Logica - 958345            { - 958346                return; + 1088544             if (context.DateBehaviour.Count == 0 || e.LogicalName == null || !context.DateBehaviour.ContainsKey(e.Logica + 959145            { + 959146                return;  47            }  48  129449            var entityDateBehaviours = context.DateBehaviour[e.LogicalName]; @@ -117,7 +118,7 @@

D:\Git\fak  66                }  14467            }  68#endif - 1625969        } + 1627169        }  70  71        public static void ProjectAttributes(Entity e, Entity projected, LinkEntity le, XrmFakedContext context)  1373472        { @@ -161,430 +162,438 @@

D:\Git\fak  13734110        }  111  112        public static Entity ProjectAttributes(this Entity e, QueryExpression qe, XrmFakedContext context) - 30858113        { - 30883114             if (qe.ColumnSet == null) return e;115 - 30833116             if (qe.ColumnSet.AllColumns) - 1686117            { - 1686118                return e; //return all the original attributes119            }120            else - 29147121            {122                //Return selected list of attributes in a projected entity - 29147123                Entity projected = null;124125                //However, if we are using proxy types, we must create a instance of the appropiate class - 29147126                 if (context.ProxyTypesAssembly != null) - 2165127                { - 2165128                    var subClassType = context.FindReflectedType(e.LogicalName); - 2165129                     if (subClassType != null) - 2165130                    { - 2165131                        var instance = Activator.CreateInstance(subClassType); - 2165132                        projected = (Entity)instance; - 2165133                        projected.Id = e.Id; - 2165134                    }135                    else - 0136                        projected = new Entity(e.LogicalName) { Id = e.Id }; //fallback to generic type if type not foun - 2165137                }138                else - 26982139                    projected = new Entity(e.LogicalName) { Id = e.Id };140141142                //Remove primary attribute unless explicitly specified - 29147143                 if (projected.Attributes.ContainsKey($"{e.LogicalName}id")) - 2165144                { - 2165145                    projected.Attributes.Remove($"{e.LogicalName}id"); - 2165146                }147 - 95955148                foreach (var attKey in qe.ColumnSet.Columns) - 4263149                {150                    //Check if attribute really exists in metadata - 4263151                     if (!context.AttributeExistsInMetadata(e.LogicalName, attKey)) - 12152                    { - 12153                        OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); - 0154                    }155 - 4251156                     if (e.Attributes.ContainsKey(attKey) && e.Attributes[attKey] != null) - 2539157                    { - 2539158                        projected[attKey] = CloneAttribute(e[attKey]); + 30864113        { + 30864114             if (qe.ColumnSet == null || qe.ColumnSet.AllColumns) + 1711115            { + 1711116                return RemoveNullAttributes(e); //return all the original attributes117            }118            else + 29153119            {120                //Return selected list of attributes in a projected entity + 29153121                Entity projected = null;122123                //However, if we are using proxy types, we must create a instance of the appropiate class + 29153124                 if (context.ProxyTypesAssembly != null) + 2171125                { + 2171126                    var subClassType = context.FindReflectedType(e.LogicalName); + 2171127                     if (subClassType != null) + 2171128                    { + 2171129                        var instance = Activator.CreateInstance(subClassType); + 2171130                        projected = (Entity)instance; + 2171131                        projected.Id = e.Id; + 2171132                    }133                    else + 0134                        projected = new Entity(e.LogicalName) { Id = e.Id }; //fallback to generic type if type not foun + 2171135                }136                else + 26982137                    projected = new Entity(e.LogicalName) { Id = e.Id };138139140                //Remove primary attribute unless explicitly specified + 29153141                 if (projected.Attributes.ContainsKey($"{e.LogicalName}id")) + 2171142                { + 2171143                    projected.Attributes.Remove($"{e.LogicalName}id"); + 2171144                }145 + 95985146                foreach (var attKey in qe.ColumnSet.Columns) + 4269147                {148                    //Check if attribute really exists in metadata + 4269149                     if (!context.AttributeExistsInMetadata(e.LogicalName, attKey)) + 12150                    { + 12151                        OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); + 0152                    }153 + 4257154                     if (e.Attributes.ContainsKey(attKey) && e.Attributes[attKey] != null) + 2539155                    { + 2539156                        projected[attKey] = CloneAttribute(e[attKey]);157 + 2539158                        string formattedValue = "";  159 - 2539160                        string formattedValue = "";161 - 2539162                         if (e.FormattedValues.TryGetValue(attKey, out formattedValue)) - 6163                        { - 6164                            projected.FormattedValues[attKey] = formattedValue; - 6165                        } - 2539166                    } - 4251167                }168169170                //Plus attributes from joins - 114741171                foreach (var le in qe.LinkEntities) - 13668172                { - 13668173                    ProjectAttributes(e, projected, le, context); - 13668174                }175                //foreach (var attKey in e.Attributes.Keys)176                //{177                //    if(e[attKey] is AliasedValue && !projected.Attributes.ContainsKey(attKey))178                //        projected[attKey] = e[attKey];179                //} - 29135180                return projected;181            } - 30846182        }183184        public static object CloneAttribute(object attributeValue) - 1967730185        { - 1967730186             if (attributeValue == null) - 550088187                return null;188 - 1417642189            var type = attributeValue.GetType(); - 1417642190             if (type == typeof(string)) - 20233191                return new string((attributeValue as string).ToCharArray()); - 1397409192             else if (type == typeof(EntityReference) - 1397409193#if FAKE_XRM_EASY - 1397409194                            || type == typeof(Microsoft.Xrm.Client.CrmEntityReference) - 1397409195#endif - 1397409196                    ) - 550250197            { - 550250198                var original = (attributeValue as EntityReference); - 550250199                var clone = new EntityReference(original.LogicalName, original.Id); - 550250200                clone.Name = CloneAttribute(original.Name) as string;201202#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 - 275724203                 if (original.KeyAttributes != null) - 275724204                { - 275724205                    clone.KeyAttributes = new KeyAttributeCollection(); - 275736206                    clone.KeyAttributes.AddRange(original.KeyAttributes.Select(kvp => new KeyValuePair<string, object>(C - 275724207                }208#endif - 550250209                    return clone;210            } - 847159211             else if (type == typeof(BooleanManagedProperty)) - 18212            { - 18213                var original = (attributeValue as BooleanManagedProperty); - 18214                return new BooleanManagedProperty(original.Value);215            } - 847141216             else if (type == typeof(OptionSetValue)) - 168231217            { - 168231218                var original = (attributeValue as OptionSetValue); - 168231219                return new OptionSetValue(original.Value);220            } - 678910221             else if (type == typeof(AliasedValue)) - 121248222            { - 121248223                var original = (attributeValue as AliasedValue); - 121248224                return new AliasedValue(original.EntityLogicalName, original.AttributeLogicalName, CloneAttribute(origin225            } - 557662226             else if (type == typeof(Money)) - 1101227            { - 1101228                var original = (attributeValue as Money); - 1101229                return new Money(original.Value);230            } - 556561231             else if (attributeValue.GetType() == typeof(EntityCollection)) - 12232            { - 12233                var collection = attributeValue as EntityCollection; - 24234                return new EntityCollection(collection.Entities.Select(e => e.Clone(e.GetType())).ToList());235            } - 556549236             else if (attributeValue is IEnumerable<Entity>) - 6237            { - 6238                var enumerable = attributeValue as IEnumerable<Entity>; - 18239                return enumerable.Select(e => e.Clone(e.GetType())).ToArray();240            }241#if !FAKE_XRM_EASY - 464238242             else if (type == typeof(byte[])) - 5243            { - 5244                var original = (attributeValue as byte[]); - 5245                var copy = new byte[original.Length]; - 5246                original.CopyTo(copy, 0); - 5247                return copy;248            }249#endif250#if FAKE_XRM_EASY_9 - 93637251             else if (attributeValue is OptionSetValueCollection) - 292252            { - 292253                var original = (attributeValue as OptionSetValueCollection); - 292254                var copy = new OptionSetValueCollection(original.ToArray()); - 292255                return copy;256            }257#endif - 556246258             else if (type == typeof(int) || type == typeof(Int64)) - 4773259                return attributeValue; //Not a reference type - 551473260             else if (type == typeof(decimal)) - 327261                return attributeValue; //Not a reference type - 551146262             else if (type == typeof(double)) - 270263                return attributeValue; //Not a reference type - 550876264             else if (type == typeof(float)) - 36265                return attributeValue; //Not a reference type - 550840266             else if (type == typeof(byte)) - 0267                return attributeValue; //Not a reference type - 550840268             else if (type == typeof(float)) - 0269                return attributeValue; //Not a reference type - 550840270             else if (type == typeof(bool)) - 44574271                return attributeValue; //Not a reference type - 506266272             else if (type == typeof(Guid)) - 172612273                return attributeValue; //Not a reference type - 333654274             else if (type == typeof(DateTime)) - 333570275                return attributeValue; //Not a reference type - 84276             else if (attributeValue is Enum) - 84277                return attributeValue; //Not a reference type278 - 0279            throw new Exception(string.Format("Attribute type not supported when trying to clone attribute '{0}'", type. - 1967730280        }281282        public static Entity Clone(this Entity e) - 55806283        { - 55806284            var cloned = new Entity(e.LogicalName); - 55806285            cloned.Id = e.Id; - 55806286            cloned.LogicalName = e.LogicalName;287 - 55806288             if (e.FormattedValues != null) - 55806289            { - 55806290                var formattedValues = new FormattedValueCollection(); - 167442291                foreach (var key in e.FormattedValues.Keys) - 12292                    formattedValues.Add(key, e.FormattedValues[key]);293 - 55806294                cloned.Inject("FormattedValues", formattedValues); - 55806295            }296 - 1041020297            foreach (var attKey in e.Attributes.Keys) - 436801298            { - 436801299                 cloned[attKey] = e[attKey] != null ? CloneAttribute(e[attKey]) : null; - 436801300            }301#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 - 83781302            foreach (var attKey in e.KeyAttributes.Keys) - 0303            { - 0304                 cloned.KeyAttributes[attKey] = e.KeyAttributes[attKey] != null ? CloneAttribute(e.KeyAttributes[attKey]) - 0305            }306#endif - 55806307            return cloned; - 55806308        }309310        public static T Clone<T>(this Entity e) where T : Entity - 0311        { - 0312            return (T)e.Clone(typeof(T)); - 0313        }314315        public static Entity Clone(this Entity e, Type t) - 96819316        { - 96819317             if (t == null) - 419318                return e.Clone();319 - 96400320            var cloned = Activator.CreateInstance(t) as Entity; - 96400321            cloned.Id = e.Id; - 96400322            cloned.LogicalName = e.LogicalName;323 - 96400324             if (e.FormattedValues != null) - 96400325            { - 96400326                var formattedValues = new FormattedValueCollection(); - 289428327                foreach (var key in e.FormattedValues.Keys) - 114328                    formattedValues.Add(key, e.FormattedValues[key]);329 - 96400330                cloned.Inject("FormattedValues", formattedValues); - 96400331            }332 - 2003990333            foreach (var attKey in e.Attributes.Keys) - 857395334            { - 857395335                 if (e[attKey] != null) - 856920336                { - 856920337                    cloned[attKey] = CloneAttribute(e[attKey]); - 856920338                } - 857395339            } + 2539160                         if (e.FormattedValues.TryGetValue(attKey, out formattedValue)) + 6161                        { + 6162                            projected.FormattedValues[attKey] = formattedValue; + 6163                        } + 2539164                    } + 4257165                }166167168                //Plus attributes from joins + 114759169                foreach (var le in qe.LinkEntities) + 13668170                { + 13668171                    ProjectAttributes(RemoveNullAttributes(e), projected, le, context); + 13668172                }173                //foreach (var attKey in e.Attributes.Keys)174                //{175                //    if(e[attKey] is AliasedValue && !projected.Attributes.ContainsKey(attKey))176                //        projected[attKey] = e[attKey];177                //} + 29141178                return RemoveNullAttributes(projected);179            } + 30852180        }181182        public static Entity RemoveNullAttributes(Entity entity) + 44520183        { + 44520184            IList<string> nullAttributes = entity.Attributes + 292082185                .Where(attribute => attribute.Value == null || + 292082186                                  (attribute.Value is AliasedValue && (attribute.Value as AliasedValue).Value == null)) + 44683187                .Select(attribute => attribute.Key).ToList(); + 133886188            foreach (var nullAttribute in nullAttributes) + 163189            { + 163190                entity.Attributes.Remove(nullAttribute); + 163191            } + 44520192            return entity; + 44520193        }194195        public static object CloneAttribute(object attributeValue) + 1967946196        { + 1967946197             if (attributeValue == null) + 550154198                return null;199 + 1417792200            var type = attributeValue.GetType(); + 1417792201             if (type == typeof(string)) + 20233202                return new string((attributeValue as string).ToCharArray()); + 1397559203             else if (type == typeof(EntityReference) + 1397559204#if FAKE_XRM_EASY + 1397559205                            || type == typeof(Microsoft.Xrm.Client.CrmEntityReference) + 1397559206#endif + 1397559207                    ) + 550304208            { + 550304209                var original = (attributeValue as EntityReference); + 550304210                var clone = new EntityReference(original.LogicalName, original.Id); + 550304211                clone.Name = CloneAttribute(original.Name) as string;212213#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 + 275751214                 if (original.KeyAttributes != null) + 275751215                { + 275751216                    clone.KeyAttributes = new KeyAttributeCollection(); + 275763217                    clone.KeyAttributes.AddRange(original.KeyAttributes.Select(kvp => new KeyValuePair<string, object>(C + 275751218                }219#endif + 550304220                return clone;221            } + 847255222             else if (type == typeof(BooleanManagedProperty)) + 18223            { + 18224                var original = (attributeValue as BooleanManagedProperty); + 18225                return new BooleanManagedProperty(original.Value);226            } + 847237227             else if (type == typeof(OptionSetValue)) + 168249228            { + 168249229                var original = (attributeValue as OptionSetValue); + 168249230                return new OptionSetValue(original.Value);231            } + 678988232             else if (type == typeof(AliasedValue)) + 121260233            { + 121260234                var original = (attributeValue as AliasedValue); + 121260235                return new AliasedValue(original.EntityLogicalName, original.AttributeLogicalName, CloneAttribute(origin236            } + 557728237             else if (type == typeof(Money)) + 1101238            { + 1101239                var original = (attributeValue as Money); + 1101240                return new Money(original.Value);241            } + 556627242             else if (attributeValue.GetType() == typeof(EntityCollection)) + 12243            { + 12244                var collection = attributeValue as EntityCollection; + 24245                return new EntityCollection(collection.Entities.Select(e => e.Clone(e.GetType())).ToList());246            } + 556615247             else if (attributeValue is IEnumerable<Entity>) + 6248            { + 6249                var enumerable = attributeValue as IEnumerable<Entity>; + 18250                return enumerable.Select(e => e.Clone(e.GetType())).ToArray();251            }252#if !FAKE_XRM_EASY + 464293253             else if (type == typeof(byte[])) + 5254            { + 5255                var original = (attributeValue as byte[]); + 5256                var copy = new byte[original.Length]; + 5257                original.CopyTo(copy, 0); + 5258                return copy;259            }260#endif261#if FAKE_XRM_EASY_9 + 93648262             else if (attributeValue is OptionSetValueCollection) + 292263            { + 292264                var original = (attributeValue as OptionSetValueCollection); + 292265                var copy = new OptionSetValueCollection(original.ToArray()); + 292266                return copy;267            }268#endif + 556312269             else if (type == typeof(int) || type == typeof(Int64)) + 4773270                return attributeValue; //Not a reference type + 551539271             else if (type == typeof(decimal)) + 327272                return attributeValue; //Not a reference type + 551212273             else if (type == typeof(double)) + 270274                return attributeValue; //Not a reference type + 550942275             else if (type == typeof(float)) + 36276                return attributeValue; //Not a reference type + 550906277             else if (type == typeof(byte)) + 0278                return attributeValue; //Not a reference type + 550906279             else if (type == typeof(float)) + 0280                return attributeValue; //Not a reference type + 550906281             else if (type == typeof(bool)) + 44580282                return attributeValue; //Not a reference type + 506326283             else if (type == typeof(Guid)) + 172636284                return attributeValue; //Not a reference type + 333690285             else if (type == typeof(DateTime)) + 333606286                return attributeValue; //Not a reference type + 84287             else if (attributeValue is Enum) + 84288                return attributeValue; //Not a reference type289 + 0290            throw new Exception(string.Format("Attribute type not supported when trying to clone attribute '{0}'", type. + 1967946291        }292293        public static Entity Clone(this Entity e) + 55806294        { + 55806295            var cloned = new Entity(e.LogicalName); + 55806296            cloned.Id = e.Id; + 55806297            cloned.LogicalName = e.LogicalName;298 + 55806299             if (e.FormattedValues != null) + 55806300            { + 55806301                var formattedValues = new FormattedValueCollection(); + 167442302                foreach (var key in e.FormattedValues.Keys) + 12303                    formattedValues.Add(key, e.FormattedValues[key]);304 + 55806305                cloned.Inject("FormattedValues", formattedValues); + 55806306            }307 + 1041164308            foreach (var attKey in e.Attributes.Keys) + 436873309            { + 436873310                 cloned[attKey] = e[attKey] != null ? CloneAttribute(e[attKey]) : null; + 436873311            }312#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 + 83781313            foreach (var attKey in e.KeyAttributes.Keys) + 0314            { + 0315                 cloned.KeyAttributes[attKey] = e.KeyAttributes[attKey] != null ? CloneAttribute(e.KeyAttributes[attKey]) + 0316            }317#endif + 55806318            return cloned; + 55806319        }320321        public static T Clone<T>(this Entity e) where T : Entity + 0322        { + 0323            return (T)e.Clone(typeof(T)); + 0324        }325326        public static Entity Clone(this Entity e, Type t) + 96843327        { + 96843328             if (t == null) + 419329                return e.Clone();330 + 96424331            var cloned = Activator.CreateInstance(t) as Entity; + 96424332            cloned.Id = e.Id; + 96424333            cloned.LogicalName = e.LogicalName;334 + 96424335             if (e.FormattedValues != null) + 96424336            { + 96424337                var formattedValues = new FormattedValueCollection(); + 289500338                foreach (var key in e.FormattedValues.Keys) + 114339                    formattedValues.Add(key, e.FormattedValues[key]);  340341#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 - 145359342            foreach (var attKey in e.KeyAttributes.Keys) - 3343            { - 3344                 cloned.KeyAttributes[attKey] = e.KeyAttributes[attKey] != null ? CloneAttribute(e.KeyAttributes[attKey]) - 3345            }346#endif - 96400347            return cloned; - 96819348        }349350        /// <summary>351        /// Extension method to join the attributes of entity e and otherEntity352        /// </summary>353        /// <param name="e"></param>354        /// <param name="otherEntity"></param>355        /// <param name="attributes"></param>356        /// <returns></returns>357        public static Entity JoinAttributes(this Entity e, Entity otherEntity, ColumnSet columnSet, string alias, XrmFak - 14969358        { - 15146359             if (otherEntity == null) return e; //Left Join where otherEntity was not matched360 - 14792361            otherEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, which would cause 362 - 14792363             if (columnSet.AllColumns) - 14792364            { - 285914365                foreach (var attKey in otherEntity.Attributes.Keys) - 120769366                { - 120769367                    e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherEntity[attKey]); - 120769368                }369 - 44400370                foreach (var attKey in otherEntity.FormattedValues.Keys) - 12371                { - 12372                    e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; - 12373                } - 14792374            }375            else - 0376            {377                //Return selected list of attributes - 0378                foreach (var attKey in columnSet.Columns) - 0379                { - 0380                     if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) - 0381                    { - 0382                        OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); - 0383                    }384 - 0385                     if (otherEntity.Attributes.ContainsKey(attKey)) - 0386                    { - 0387                        e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherEntity[attKey]) - 0388                    }389                    else - 0390                    { - 0391                        e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, null); - 0392                    }393 - 0394                     if (otherEntity.FormattedValues.ContainsKey(attKey)) - 0395                    { - 0396                        e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; - 0397                    } - 0398                } - 0399            } - 14792400            return e; - 14969401        }402403        public static Entity JoinAttributes(this Entity e, IEnumerable<Entity> otherEntities, ColumnSet columnSet, strin - 0404        { - 0405            foreach (var otherEntity in otherEntities) - 0406            { - 0407                var otherClonedEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, whic408 - 0409                 if (columnSet.AllColumns) - 0410                { - 0411                    foreach (var attKey in otherClonedEntity.Attributes.Keys) - 0412                    { - 0413                        e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherClonedEntity[at - 0414                    }415 - 0416                    foreach (var attKey in otherEntity.FormattedValues.Keys) - 0417                    { - 0418                        e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; - 0419                    } - 0420                }421                else - 0422                {423                    //Return selected list of attributes - 0424                    foreach (var attKey in columnSet.Columns) + 96424341                cloned.Inject("FormattedValues", formattedValues); + 96424342            }343 + 2006094344            foreach (var attKey in e.Attributes.Keys) + 858411345            { + 858411346                 cloned[attKey] = e[attKey] != null ? CloneAttribute(e[attKey]) : null; + 858411347            }348349#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 + 145395350            foreach (var attKey in e.KeyAttributes.Keys) + 3351            { + 3352                 cloned.KeyAttributes[attKey] = e.KeyAttributes[attKey] != null ? CloneAttribute(e.KeyAttributes[attKey]) + 3353            }354#endif + 96424355            return cloned; + 96843356        }357358        /// <summary>359        /// Extension method to join the attributes of entity e and otherEntity360        /// </summary>361        /// <param name="e"></param>362        /// <param name="otherEntity"></param>363        /// <param name="attributes"></param>364        /// <returns></returns>365        public static Entity JoinAttributes(this Entity e, Entity otherEntity, ColumnSet columnSet, string alias, XrmFak + 14969366        { + 15146367             if (otherEntity == null) return e; //Left Join where otherEntity was not matched368 + 14792369            otherEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, which would cause 370 + 14792371             if (columnSet.AllColumns) + 14792372            { + 285938373                foreach (var attKey in otherEntity.Attributes.Keys) + 120781374                { + 120781375                    e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherEntity[attKey]); + 120781376                }377 + 44400378                foreach (var attKey in otherEntity.FormattedValues.Keys) + 12379                { + 12380                    e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; + 12381                } + 14792382            }383            else + 0384            {385                //Return selected list of attributes + 0386                foreach (var attKey in columnSet.Columns) + 0387                { + 0388                     if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) + 0389                    { + 0390                        OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); + 0391                    }392 + 0393                     if (otherEntity.Attributes.ContainsKey(attKey)) + 0394                    { + 0395                        e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherEntity[attKey]) + 0396                    }397                    else + 0398                    { + 0399                        e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, null); + 0400                    }401 + 0402                     if (otherEntity.FormattedValues.ContainsKey(attKey)) + 0403                    { + 0404                        e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; + 0405                    } + 0406                } + 0407            } + 14792408            return e; + 14969409        }410411        public static Entity JoinAttributes(this Entity e, IEnumerable<Entity> otherEntities, ColumnSet columnSet, strin + 0412        { + 0413            foreach (var otherEntity in otherEntities) + 0414            { + 0415                var otherClonedEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, whic416 + 0417                 if (columnSet.AllColumns) + 0418                { + 0419                    foreach (var attKey in otherClonedEntity.Attributes.Keys) + 0420                    { + 0421                        e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherClonedEntity[at + 0422                    }423 + 0424                    foreach (var attKey in otherEntity.FormattedValues.Keys)  0425                    { - 0426                         if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) - 0427                        { - 0428                            OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); - 0429                        }430 - 0431                         if (otherClonedEntity.Attributes.ContainsKey(attKey)) - 0432                        { - 0433                            e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherClonedEntit - 0434                        }435                        else - 0436                        { - 0437                            e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, null); - 0438                        }439 - 0440                         if (otherEntity.FormattedValues.ContainsKey(attKey)) - 0441                        { - 0442                            e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; - 0443                        } - 0444                    } - 0445                } - 0446            } - 0447            return e; - 0448        }449450        /// <summary>451        /// Returns the key for the attribute name selected (could an entity reference or a primary key or a guid)452        /// </summary>453        /// <param name="e"></param>454        /// <param name="sAttributeName"></param>455        /// <returns></returns>456        public static Guid KeySelector(this Entity e, string sAttributeName, XrmFakedContext context) - 29977457        { - 29977458             if (sAttributeName.Contains(".")) - 192459            {460                //Do not lowercase the alias prefix - 192461                var splitted = sAttributeName.Split('.'); - 192462                sAttributeName = string.Format("{0}.{1}", splitted[0], splitted[1].ToLower()); - 192463            }464            else - 29785465            { - 29785466                sAttributeName = sAttributeName.ToLower(); - 29785467            }468 - 29977469             if (!e.Attributes.ContainsKey(sAttributeName)) - 240470            {471                //Check if it is the primary key - 240472                 if (sAttributeName.Contains("id") && - 240473                   e.LogicalName.ToLower().Equals(sAttributeName.Substring(0, sAttributeName.Length - 2))) - 0474                { - 0475                    return e.Id;476                } - 240477                return Guid.Empty; //Atrribute is null or doesn´t exists so it can´t be joined478            }479 - 29737480            object keyValue = null; - 29737481             if (e[sAttributeName] is AliasedValue) - 192482            { - 192483                keyValue = (e[sAttributeName] as AliasedValue).Value; - 192484            }485            else - 29545486            { - 29545487                keyValue = e[sAttributeName]; - 29545488            }489 - 29737490             if (keyValue is EntityReference) - 14456491                return (keyValue as EntityReference).Id; - 15281492             if (keyValue is Guid) - 15257493                return ((Guid)keyValue);494 - 24495            return Guid.Empty; - 29977496        } + 0426                        e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; + 0427                    } + 0428                }429                else + 0430                {431                    //Return selected list of attributes + 0432                    foreach (var attKey in columnSet.Columns) + 0433                    { + 0434                         if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) + 0435                        { + 0436                            OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); + 0437                        }438 + 0439                         if (otherClonedEntity.Attributes.ContainsKey(attKey)) + 0440                        { + 0441                            e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, otherClonedEntit + 0442                        }443                        else + 0444                        { + 0445                            e[alias + "." + attKey] = new AliasedValue(otherEntity.LogicalName, attKey, null); + 0446                        }447 + 0448                         if (otherEntity.FormattedValues.ContainsKey(attKey)) + 0449                        { + 0450                            e.FormattedValues[alias + "." + attKey] = otherEntity.FormattedValues[attKey]; + 0451                        } + 0452                    } + 0453                } + 0454            } + 0455            return e; + 0456        }457458        /// <summary>459        /// Returns the key for the attribute name selected (could an entity reference or a primary key or a guid)460        /// </summary>461        /// <param name="e"></param>462        /// <param name="sAttributeName"></param>463        /// <returns></returns>464        public static Guid KeySelector(this Entity e, string sAttributeName, XrmFakedContext context) + 29977465        { + 29977466             if (sAttributeName.Contains(".")) + 192467            {468                //Do not lowercase the alias prefix + 192469                var splitted = sAttributeName.Split('.'); + 192470                sAttributeName = string.Format("{0}.{1}", splitted[0], splitted[1].ToLower()); + 192471            }472            else + 29785473            { + 29785474                sAttributeName = sAttributeName.ToLower(); + 29785475            }476 + 29977477             if (!e.Attributes.ContainsKey(sAttributeName)) + 162478            {479                //Check if it is the primary key + 162480                 if (sAttributeName.Contains("id") && + 162481                   e.LogicalName.ToLower().Equals(sAttributeName.Substring(0, sAttributeName.Length - 2))) + 0482                { + 0483                    return e.Id;484                } + 162485                return Guid.Empty; //Atrribute is null or doesn´t exists so it can´t be joined486            }487 + 29815488            object keyValue = null; + 29815489             if (e[sAttributeName] is AliasedValue) + 192490            { + 192491                keyValue = (e[sAttributeName] as AliasedValue).Value; + 192492            }493            else + 29623494            { + 29623495                keyValue = e[sAttributeName]; + 29623496            }  497498        /// <summary>499        /// Extension method to "hack" internal set properties on sealed classes via reflection500        /// </summary>501        /// <param name="e"></param>502        /// <param name="property"></param>503        /// <param name="value"></param>504        public static void Inject(this Entity e, string property, object value) - 152242505        { - 152242506            e.GetType().GetProperty(property).SetValue(e, value, null); - 152242507        }508509        public static void SetValueIfEmpty(this Entity e, string property, object value) - 166134510        { - 166134511            var containsKey = e.Attributes.ContainsKey(property); - 166134512             if (!containsKey || containsKey && e[property] == null) - 165845513            { - 165845514                e[property] = value; - 165845515            } - 166134516        }517518        /// <summary>519        /// ToEntityReference implementation which converts an entity into an entity reference with key attribute info a520        /// </summary>521        /// <param name="e">Entity to convert to an Entity Reference</param>522        /// <returns></returns>523        public static EntityReference ToEntityReferenceWithKeyAttributes(this Entity e) - 306524        { - 306525            var result = e.ToEntityReference();526#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 - 157527            result.KeyAttributes = e.KeyAttributes;528#endif - 306529            return result; - 306530        }531532533    }534} + 29815498             if (keyValue is EntityReference) + 14456499                return (keyValue as EntityReference).Id; + 15359500             if (keyValue is Guid) + 15257501                return ((Guid)keyValue);502 + 102503            return Guid.Empty; + 29977504        }505506        /// <summary>507        /// Extension method to "hack" internal set properties on sealed classes via reflection508        /// </summary>509        /// <param name="e"></param>510        /// <param name="property"></param>511        /// <param name="value"></param>512        public static void Inject(this Entity e, string property, object value) + 152266513        { + 152266514            e.GetType().GetProperty(property).SetValue(e, value, null); + 152266515        }516517        public static void SetValueIfEmpty(this Entity e, string property, object value) + 166170518        { + 166170519            var containsKey = e.Attributes.ContainsKey(property); + 166170520             if (!containsKey || containsKey && e[property] == null) + 165881521            { + 165881522                e[property] = value; + 165881523            } + 166170524        }525526        /// <summary>527        /// ToEntityReference implementation which converts an entity into an entity reference with key attribute info a528        /// </summary>529        /// <param name="e">Entity to convert to an Entity Reference</param>530        /// <returns></returns>531        public static EntityReference ToEntityReferenceWithKeyAttributes(this Entity e) + 312532        { + 312533            var result = e.ToEntityReference();534#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 + 160535            result.KeyAttributes = e.KeyAttributes;536#endif + 312537            return result; + 312538        }539540541    }542} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_EntityMetadataExtensions.htm b/test/reports/FakeXrmEasy_EntityMetadataExtensions.htm index abd21689..768e1685 100644 --- a/test/reports/FakeXrmEasy_EntityMetadataExtensions.htm +++ b/test/reports/FakeXrmEasy_EntityMetadataExtensions.htm @@ -88,6 +88,6 @@

D:  47} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_EntityReferenceExtensions.htm b/test/reports/FakeXrmEasy_EntityReferenceExtensions.htm index 12a8a76f..94da6f86 100644 --- a/test/reports/FakeXrmEasy_EntityReferenceExtensions.htm +++ b/test/reports/FakeXrmEasy_EntityReferenceExtensions.htm @@ -61,6 +61,6 @@

D  24} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ExecuteFetchRequestExecutor.htm b/test/reports/FakeXrmEasy_ExecuteFetchRequestExecutor.htm index ecd9356d..bd8ffc4c 100644 --- a/test/reports/FakeXrmEasy_ExecuteFetchRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_ExecuteFetchRequestExecutor.htm @@ -54,7 +54,7 @@

 12{  13    public class ExecuteFetchRequestExecutor : IFakeMessageExecutor  14    { - 388015        private Dictionary<string, int?> _typeCodes = new Dictionary<string, int?>(); + 388615        private Dictionary<string, int?> _typeCodes = new Dictionary<string, int?>();  16  17        public bool CanExecute(OrganizationRequest request)  4218        { @@ -242,13 +242,13 @@

 337200        }  201  202        public Type GetResponsibleRequestType() - 3855203        { - 3855204            return typeof(ExecuteFetchRequest); - 3855205        } + 3861203        { + 3861204            return typeof(ExecuteFetchRequest); + 3861205        }  206    }  207} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm b/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm index 14754670..30d03619 100644 --- a/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm @@ -126,13 +126,13 @@

 4287        }  88  89        public Type GetResponsibleRequestType() - 385590        { - 385591            return typeof(ExecuteMultipleRequest); - 385592        } + 386190        { + 386191            return typeof(ExecuteMultipleRequest); + 386192        }  93    }  94} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm b/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm index 5ce349c1..a9794143 100644 --- a/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm +++ b/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm @@ -72,14 +72,14 @@

 633        }  34  35        public Type GetResponsibleRequestType() - 197536        { - 197537            return typeof(ExecuteTransactionRequest); - 197538        } + 197836        { + 197837            return typeof(ExecuteTransactionRequest); + 197838        }  39    }  40}  41#endif - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_GrantAccessRequestExecutor.htm b/test/reports/FakeXrmEasy_GrantAccessRequestExecutor.htm index 76481b1e..e269a66a 100644 --- a/test/reports/FakeXrmEasy_GrantAccessRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_GrantAccessRequestExecutor.htm @@ -57,13 +57,13 @@

 10819        }  20  21        public Type GetResponsibleRequestType() - 385522        { - 385523            return typeof(GrantAccessRequest); - 385524        } + 386122        { + 386123            return typeof(GrantAccessRequest); + 386124        }  25    }  26} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_InitializeFromRequestExecutor.htm b/test/reports/FakeXrmEasy_InitializeFromRequestExecutor.htm index 5bdc0ad7..150ef5ad 100644 --- a/test/reports/FakeXrmEasy_InitializeFromRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_InitializeFromRequestExecutor.htm @@ -54,9 +54,9 @@

 4215        }  16  17        public Type GetResponsibleRequestType() - 385518        { - 385519            return typeof(InitializeFromRequest); - 385520        } + 386118        { + 386119            return typeof(InitializeFromRequest); + 386120        }  21  22        public OrganizationResponse Execute(OrganizationRequest request, XrmFakedContext ctx)  4223        { @@ -144,6 +144,6 @@

 105} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm b/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm index 0f0a279f..f8cb303e 100644 --- a/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm @@ -123,13 +123,13 @@

 3084        }  85  86        public Type GetResponsibleRequestType() - 385587        { - 385588            return typeof(InsertOptionValueRequest); - 385589        } + 386187        { + 386188            return typeof(InsertOptionValueRequest); + 386189        }  90    }  91} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_InsertStatusValueRequestExecutor.htm b/test/reports/FakeXrmEasy_InsertStatusValueRequestExecutor.htm index 0547139a..a0fff997 100644 --- a/test/reports/FakeXrmEasy_InsertStatusValueRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_InsertStatusValueRequestExecutor.htm @@ -127,13 +127,13 @@

 688        }  89  90        public Type GetResponsibleRequestType() - 385591        { - 385592            return typeof(InsertStatusValueRequest); - 385593        } + 386191        { + 386192            return typeof(InsertStatusValueRequest); + 386193        }  94    }  95} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_InvoiceDetailInitializerService.htm b/test/reports/FakeXrmEasy_InvoiceDetailInitializerService.htm index 2efa38f2..c0ba41b4 100644 --- a/test/reports/FakeXrmEasy_InvoiceDetailInitializerService.htm +++ b/test/reports/FakeXrmEasy_InvoiceDetailInitializerService.htm @@ -161,6 +161,6 @@

 123} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_InvoiceInitializerService.htm b/test/reports/FakeXrmEasy_InvoiceInitializerService.htm index 92bda232..c19d0627 100644 --- a/test/reports/FakeXrmEasy_InvoiceInitializerService.htm +++ b/test/reports/FakeXrmEasy_InvoiceInitializerService.htm @@ -66,6 +66,6 @@

 28} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_LoseOpportunityRequestExecutor.htm b/test/reports/FakeXrmEasy_LoseOpportunityRequestExecutor.htm index e2808479..01eee958 100644 --- a/test/reports/FakeXrmEasy_LoseOpportunityRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_LoseOpportunityRequestExecutor.htm @@ -88,13 +88,13 @@

 649        }  50  51        public Type GetResponsibleRequestType() - 385552        { - 385553            return typeof(LoseOpportunityRequest); - 385554        } + 386152        { + 386153            return typeof(LoseOpportunityRequest); + 386154        }  55    }  56} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ModifyAccessRequestExecutor.htm b/test/reports/FakeXrmEasy_ModifyAccessRequestExecutor.htm index 8337154b..322360e5 100644 --- a/test/reports/FakeXrmEasy_ModifyAccessRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_ModifyAccessRequestExecutor.htm @@ -57,13 +57,13 @@

 1219        }  20  21        public Type GetResponsibleRequestType() - 385522        { - 385523            return typeof(ModifyAccessRequest); - 385524        } + 386122        { + 386123            return typeof(ModifyAccessRequest); + 386124        }  25    }  26} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_NavigateToNextEntityOrganizationRequestExecutor.htm b/test/reports/FakeXrmEasy_NavigateToNextEntityOrganizationRequestExecutor.htm index 3bb63018..18f414bc 100644 --- a/test/reports/FakeXrmEasy_NavigateToNextEntityOrganizationRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_NavigateToNextEntityOrganizationRequestExecutor.htm @@ -148,13 +148,13 @@

 6108        }  109  110        public Type GetResponsibleRequestType() - 3855111        { - 3855112            return typeof(OrganizationRequest); - 3855113        } + 3861111        { + 3861112            return typeof(OrganizationRequest); + 3861113        }  114    }  115} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ObjectExtensions.htm b/test/reports/FakeXrmEasy_ObjectExtensions.htm index 098bb834..06b46d08 100644 --- a/test/reports/FakeXrmEasy_ObjectExtensions.htm +++ b/test/reports/FakeXrmEasy_ObjectExtensions.htm @@ -218,6 +218,6 @@

D:\Git\fak  172} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_OrganizationServiceFaultInvalidArgument.htm b/test/reports/FakeXrmEasy_OrganizationServiceFaultInvalidArgument.htm index 588e0b41..ba7f267e 100644 --- a/test/reports/FakeXrmEasy_OrganizationServiceFaultInvalidArgument.htm +++ b/test/reports/FakeXrmEasy_OrganizationServiceFaultInvalidArgument.htm @@ -57,6 +57,6 @@

 20} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_OrganizationServiceFaultOperatorIsNotValidException.htm b/test/reports/FakeXrmEasy_OrganizationServiceFaultOperatorIsNotValidException.htm index bef25d12..ce89e9a8 100644 --- a/test/reports/FakeXrmEasy_OrganizationServiceFaultOperatorIsNotValidException.htm +++ b/test/reports/FakeXrmEasy_OrganizationServiceFaultOperatorIsNotValidException.htm @@ -57,6 +57,6 @@

 20} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm b/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm index dd20b326..1a4f38a4 100644 --- a/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm +++ b/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm @@ -60,6 +60,6 @@

 22} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_PickFromQueueRequestExecutor.htm b/test/reports/FakeXrmEasy_PickFromQueueRequestExecutor.htm index b74dcc24..06c67e2f 100644 --- a/test/reports/FakeXrmEasy_PickFromQueueRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_PickFromQueueRequestExecutor.htm @@ -113,15 +113,15 @@

 1074        }  75  76        public Type GetResponsibleRequestType() - 323977        { - 323978            return typeof(PickFromQueueRequest); - 323979        } + 324477        { + 324478            return typeof(PickFromQueueRequest); + 324479        }  80    }  81}  82  83#endif - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm b/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm index 432c52f3..cacd1c24 100644 --- a/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm @@ -64,13 +64,13 @@

 625        }  26  27        public Type GetResponsibleRequestType() - 385528        { - 385529            return typeof(PublishXmlRequest); - 385530        } + 386128        { + 386129            return typeof(PublishXmlRequest); + 386130        }  31    }  32} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_PullRequestException.htm b/test/reports/FakeXrmEasy_PullRequestException.htm index 074b7f82..440a9373 100644 --- a/test/reports/FakeXrmEasy_PullRequestException.htm +++ b/test/reports/FakeXrmEasy_PullRequestException.htm @@ -66,6 +66,6 @@

D:\Git\fake-xrm-  27} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_QualifyLeadRequestExecutor.htm b/test/reports/FakeXrmEasy_QualifyLeadRequestExecutor.htm index 4f111ff0..34555123 100644 --- a/test/reports/FakeXrmEasy_QualifyLeadRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_QualifyLeadRequestExecutor.htm @@ -144,13 +144,13 @@

 30105        }  106  107        public Type GetResponsibleRequestType() - 3855108        { - 3855109            return typeof(QualifyLeadRequest); - 3855110        } + 3861108        { + 3861109            return typeof(QualifyLeadRequest); + 3861110        }  111    }  112} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_QueryExpressionExtensions.htm b/test/reports/FakeXrmEasy_QueryExpressionExtensions.htm index e2aeb146..ac0df851 100644 --- a/test/reports/FakeXrmEasy_QueryExpressionExtensions.htm +++ b/test/reports/FakeXrmEasy_QueryExpressionExtensions.htm @@ -74,6 +74,6 @@

D  36} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ReferenceEqualityComparer.htm b/test/reports/FakeXrmEasy_ReferenceEqualityComparer.htm index a16c57df..7e58b3a9 100644 --- a/test/reports/FakeXrmEasy_ReferenceEqualityComparer.htm +++ b/test/reports/FakeXrmEasy_ReferenceEqualityComparer.htm @@ -210,6 +210,6 @@

D:\Git\fak  172} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RemoveFromQueueRequestExecutor.htm b/test/reports/FakeXrmEasy_RemoveFromQueueRequestExecutor.htm index 7f8c623d..6f19ff79 100644 --- a/test/reports/FakeXrmEasy_RemoveFromQueueRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RemoveFromQueueRequestExecutor.htm @@ -70,14 +70,14 @@

 531        }  32  33        public Type GetResponsibleRequestType() - 323934        { - 323935            return typeof(RemoveFromQueueRequest); - 323936        } + 324434        { + 324435            return typeof(RemoveFromQueueRequest); + 324436        }  37    }  38}  39#endif - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RemoveMembersTeamRequestExecutor.htm b/test/reports/FakeXrmEasy_RemoveMembersTeamRequestExecutor.htm index 599df4ab..82775706 100644 --- a/test/reports/FakeXrmEasy_RemoveMembersTeamRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RemoveMembersTeamRequestExecutor.htm @@ -111,13 +111,13 @@

 672        }  73  74        public Type GetResponsibleRequestType() - 385575        { - 385576            return typeof(RemoveMembersTeamRequest); - 385577        } + 386175        { + 386176            return typeof(RemoveMembersTeamRequest); + 386177        }  78    }  79} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RemoveUserFromRecordTeamRequestExecutor.htm b/test/reports/FakeXrmEasy_RemoveUserFromRecordTeamRequestExecutor.htm index 42bc320d..128b9d62 100644 --- a/test/reports/FakeXrmEasy_RemoveUserFromRecordTeamRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RemoveUserFromRecordTeamRequestExecutor.htm @@ -113,14 +113,14 @@

 574        }  75  76        public Type GetResponsibleRequestType() - 323977        { - 323978            return typeof(RemoveUserFromRecordTeamRequestExecutor); - 323979        } + 324477        { + 324478            return typeof(RemoveUserFromRecordTeamRequestExecutor); + 324479        }  80    }  81}  82#endif - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm index c7458582..36b324a7 100644 --- a/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm @@ -96,13 +96,13 @@

 3057        }  58  59        public Type GetResponsibleRequestType() - 385560        { - 385561            return typeof(RetrieveAttributeRequest); - 385562        } + 386160        { + 386161            return typeof(RetrieveAttributeRequest); + 386162        }  63    }  64} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveEntityRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveEntityRequestExecutor.htm index bd301e47..1bc9200f 100644 --- a/test/reports/FakeXrmEasy_RetrieveEntityRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveEntityRequestExecutor.htm @@ -107,13 +107,13 @@

 1267        }  68  69        public Type GetResponsibleRequestType() - 385570        { - 385571            return typeof(RetrieveEntityRequest); - 385572        } + 386170        { + 386171            return typeof(RetrieveEntityRequest); + 386172        }  73    }  74} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm index 4c878929..21a9caf1 100644 --- a/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm @@ -230,9 +230,9 @@

 19362188        }  189  190        public Type GetResponsibleRequestType() - 3855191        { - 3855192            return typeof(RetrieveMultipleRequest); - 3855193        } + 3861191        { + 3861192            return typeof(RetrieveMultipleRequest); + 3861193        }  194  195        private static List<Entity> GetDistinctEntities(IEnumerable<Entity> input)  18196        { @@ -252,6 +252,6 @@

 210} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveOptionSetRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveOptionSetRequestExecutor.htm index b459caa1..45b8a1ef 100644 --- a/test/reports/FakeXrmEasy_RetrieveOptionSetRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveOptionSetRequestExecutor.htm @@ -81,13 +81,13 @@

 642        }  43  44        public Type GetResponsibleRequestType() - 385545        { - 385546            return typeof(RetrieveOptionSetRequest); - 385547        } + 386145        { + 386146            return typeof(RetrieveOptionSetRequest); + 386147        }  48    }  49} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrievePrincipalAccessRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrievePrincipalAccessRequestExecutor.htm index d4bbd65d..8e74fbf7 100644 --- a/test/reports/FakeXrmEasy_RetrievePrincipalAccessRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrievePrincipalAccessRequestExecutor.htm @@ -56,13 +56,13 @@

 9618        }  19  20        public Type GetResponsibleRequestType() - 385521        { - 385522            return typeof(RetrievePrincipalAccessRequest); - 385523        } + 386121        { + 386122            return typeof(RetrievePrincipalAccessRequest); + 386123        }  24    }  25} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveRelationshipRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveRelationshipRequestExecutor.htm index 975097fe..670f56d5 100644 --- a/test/reports/FakeXrmEasy_RetrieveRelationshipRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveRelationshipRequestExecutor.htm @@ -104,13 +104,13 @@

 1864        }  65  66        public Type GetResponsibleRequestType() - 385567        { - 385568            return typeof(RetrieveRelationshipRequest); - 385569        } + 386167        { + 386168            return typeof(RetrieveRelationshipRequest); + 386169        }  70    }  71} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveRequestExecutor.htm index 125e4c1f..fb1799b1 100644 --- a/test/reports/FakeXrmEasy_RetrieveRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveRequestExecutor.htm @@ -178,13 +178,13 @@

 75139        }  140  141        public Type GetResponsibleRequestType() - 3951142        { - 3951143            return typeof(RetrieveRequest); - 3951144        } + 3957142        { + 3957143            return typeof(RetrieveRequest); + 3957144        }  145    }  146} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveSharedPrincipalsAndAccessRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveSharedPrincipalsAndAccessRequestExecutor.htm index 3332fcb7..d840c428 100644 --- a/test/reports/FakeXrmEasy_RetrieveSharedPrincipalsAndAccessRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveSharedPrincipalsAndAccessRequestExecutor.htm @@ -56,13 +56,13 @@

 3618        }  19  20        public Type GetResponsibleRequestType() - 385521        { - 385522            return typeof(RetrieveSharedPrincipalsAndAccessRequest); - 385523        } + 386121        { + 386122            return typeof(RetrieveSharedPrincipalsAndAccessRequest); + 386123        }  24    }  25} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveVersionRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveVersionRequestExecutor.htm index 3c47158c..4fc4c3c3 100644 --- a/test/reports/FakeXrmEasy_RetrieveVersionRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveVersionRequestExecutor.htm @@ -67,13 +67,13 @@

 629        }  30  31        public Type GetResponsibleRequestType() - 385532        { - 385533            return typeof(RetrieveVersionRequest); - 385534        } + 386132        { + 386133            return typeof(RetrieveVersionRequest); + 386134        }  35    }  36} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ReviseQuoteRequestExecutor.htm b/test/reports/FakeXrmEasy_ReviseQuoteRequestExecutor.htm index d165d4ac..ae665259 100644 --- a/test/reports/FakeXrmEasy_ReviseQuoteRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_ReviseQuoteRequestExecutor.htm @@ -146,13 +146,13 @@

 6107        }  108  109        public Type GetResponsibleRequestType() - 3855110        { - 3855111            return typeof(ReviseQuoteRequest); - 3855112        } + 3861110        { + 3861111            return typeof(ReviseQuoteRequest); + 3861112        }  113    }  114} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RevokeAccessRequestExecutor.htm b/test/reports/FakeXrmEasy_RevokeAccessRequestExecutor.htm index d2af9a12..41d98054 100644 --- a/test/reports/FakeXrmEasy_RevokeAccessRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RevokeAccessRequestExecutor.htm @@ -57,13 +57,13 @@

 1219        }  20  21        public Type GetResponsibleRequestType() - 385522        { - 385523            return typeof(RevokeAccessRequest); - 385524        } + 386122        { + 386123            return typeof(RevokeAccessRequest); + 386124        }  25    }  26} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm b/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm index b0f98a1e..9cd1b463 100644 --- a/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm @@ -69,13 +69,13 @@

 1231        }  32  33        public Type GetResponsibleRequestType() - 385534        { - 385535            return typeof(SetStateRequest); - 385536        } + 386134        { + 386135            return typeof(SetStateRequest); + 386136        }  37    }  38} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_TypeExtensions.htm b/test/reports/FakeXrmEasy_TypeExtensions.htm index a4d35548..af0d738e 100644 --- a/test/reports/FakeXrmEasy_TypeExtensions.htm +++ b/test/reports/FakeXrmEasy_TypeExtensions.htm @@ -81,6 +81,6 @@

D:\Git\fake-  41} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_TypedConditionExpression.htm b/test/reports/FakeXrmEasy_TypedConditionExpression.htm index 108d5a57..3e07bfa0 100644 --- a/test/reports/FakeXrmEasy_TypedConditionExpression.htm +++ b/test/reports/FakeXrmEasy_TypedConditionExpression.htm @@ -61,6 +61,6 @@

D:\Git  25} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm b/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm index ca06f83d..a8f240b1 100644 --- a/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm @@ -62,13 +62,13 @@

 1824        }  25  26        public Type GetResponsibleRequestType() - 385527        { - 385528            return typeof(UpdateRequest); - 385529        } + 386127        { + 386128            return typeof(UpdateRequest); + 386129        }  30    }  31} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm b/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm index fed9ede0..01ee520a 100644 --- a/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm @@ -62,13 +62,13 @@

 624        }  25  26        public Type GetResponsibleRequestType() - 385527        { - 385528            return typeof(WhoAmIRequest); - 385529        } + 386127        { + 386128            return typeof(WhoAmIRequest); + 386129        }  30    }  31} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_WinOpportunityRequestExecutor.htm b/test/reports/FakeXrmEasy_WinOpportunityRequestExecutor.htm index 9d21f6b6..15a6ecd7 100644 --- a/test/reports/FakeXrmEasy_WinOpportunityRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_WinOpportunityRequestExecutor.htm @@ -88,13 +88,13 @@

 649        }  50  51        public Type GetResponsibleRequestType() - 385552        { - 385553            return typeof(WinOpportunityRequest); - 385554        } + 386152        { + 386153            return typeof(WinOpportunityRequest); + 386154        }  55    }  56} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm b/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm index eded912a..5c0008b1 100644 --- a/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm +++ b/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm @@ -858,6 +858,6 @@

D:  796} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedContext.htm b/test/reports/FakeXrmEasy_XrmFakedContext.htm index 8b787d36..0993d09c 100644 --- a/test/reports/FakeXrmEasy_XrmFakedContext.htm +++ b/test/reports/FakeXrmEasy_XrmFakedContext.htm @@ -15,12 +15,12 @@

Summary

Class:FakeXrmEasy.XrmFakedContext Assembly:FakeXrmEasy File(s):D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Aggregations.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.CodeActivities.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Crud.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.DateTime.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Metadata.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Pipeline.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Plugins.cs
D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Queries.cs -Covered lines:2405 +Covered lines:2409 Uncovered lines:313 -Coverable lines:2718 -Total lines:4448 -Line coverage:88.4% -Branch coverage:72.6% +Coverable lines:2722 +Total lines:4451 +Line coverage:88.5% +Branch coverage:72.7%

Metrics

@@ -60,7 +60,7 @@

Metrics

FakeRetrieve(...)1100100 FakeCreate(...)1100100 FakeUpdate(...)1100100 -UpdateEntity(...)10100100 +UpdateEntity(...)11100100 ResolveEntityReference(...)5100100 ResolveEntityReferenceByAlternateKeys(...)1100100 FakeDelete(...)1100100 @@ -837,18 +837,18 @@

D:\Git\fake-xrm-e  16        protected const int EntityActiveStateCode = 0;  17        protected const int EntityInactiveStateCode = 1;  18 - 9462819        public bool ValidateReferences { get; set; } + 9465219        public bool ValidateReferences { get; set; }  20  21        #region CRUD  22        public Guid GetRecordUniqueId(EntityReference record) - 41723        { - 41724             if (string.IsNullOrWhiteSpace(record.LogicalName)) + 42323        { + 42324             if (string.IsNullOrWhiteSpace(record.LogicalName))  625            {  626                throw new InvalidOperationException("The entity logical name must not be null or empty.");  27            }  28  29            // Don't fail with invalid operation exception, if no record of this entity exists, but entity is known - 41130             if (!Data.ContainsKey(record.LogicalName) && !EntityMetadata.ContainsKey(record.LogicalName)) + 41730             if (!Data.ContainsKey(record.LogicalName) && !EntityMetadata.ContainsKey(record.LogicalName))  631            {  632                 if (ProxyTypesAssembly == null)  033                { @@ -862,7 +862,7 @@

D:\Git\fake-xrm-e  641            }  42  43#if !FAKE_XRM_EASY && !FAKE_XRM_EASY_2013 && !FAKE_XRM_EASY_2015 - 22044             if (record.Id == Guid.Empty && record.HasKeyAttributes()) + 22344             if (record.Id == Guid.Empty && record.HasKeyAttributes())  2445            {  2446                 if (EntityMetadata.ContainsKey(record.LogicalName))  2147                { @@ -888,13 +888,13 @@

D:\Git\fake-xrm-e  67            }  68  69#endif - 38770             if (record.Id == Guid.Empty) + 39370             if (record.Id == Guid.Empty)  671            {  672                throw new InvalidOperationException("The id must not be empty.");  73            }  74 - 38175            return record.Id; - 40276        } + 38775            return record.Id; + 40876        }  77  78        /// <summary>  79        /// A fake retrieve method that will query the FakedContext to retrieve the specified @@ -904,541 +904,544 @@

D:\Git\fake-xrm-e  83        /// <param name="fakedService">The faked service where the Retrieve method will be faked</param>  84        /// <returns></returns>  85        protected static void FakeRetrieve(XrmFakedContext context, IOrganizationService fakedService) - 288086        { - 288087            A.CallTo(() => fakedService.Retrieve(A<string>._, A<Guid>._, A<ColumnSet>._)) - 288088                .ReturnsLazily((string entityName, Guid id, ColumnSet columnSet) => - 360789                { - 360790                     if (string.IsNullOrWhiteSpace(entityName)) - 289891                    { - 289892                        throw new InvalidOperationException("The entity logical name must not be null or empty."); - 288093                    } - 288094 - 358995                     if (id == Guid.Empty) - 288696                    { - 288697                        throw new InvalidOperationException("The id must not be empty."); - 288098                    } - 288099 - 3583100                     if (columnSet == null) - 2892101                    { - 2892102                        throw new InvalidOperationException("The columnset parameter must not be null."); - 2880103                    } - 2880104 - 2880105                    // Don't fail with invalid operation exception, if no record of this entity exists, but entity is kn - 3571106                     if (!context.Data.ContainsKey(entityName)) - 2886107                    { - 2886108                         if (context.ProxyTypesAssembly == null) - 2880109                        { - 2880110                            throw new InvalidOperationException($"The entity logical name {entityName} is not valid."); - 2880111                        } - 2880112 - 2892113                         if (!context.ProxyTypesAssembly.GetTypes().Any(type => context.FindReflectedType(entityName) !=  - 2880114                        { - 2880115                            throw new InvalidOperationException($"The entity logical name {entityName} is not valid."); - 2880116                        } - 2886117                    } - 2880118 - 2880119                    //Return the subset of columns requested only - 3571120                    var reflectedType = context.FindReflectedType(entityName); - 2880121 - 2880122                    //Entity logical name exists, so , check if the requested entity exists - 3571123                     if (context.Data.ContainsKey(entityName) && context.Data[entityName] != null - 3571124                        && context.Data[entityName].ContainsKey(id)) - 3541125                    { - 2880126                        //Entity found => return only the subset of columns specified or all of them - 3541127                        var foundEntity = context.Data[entityName][id].Clone(reflectedType); - 3541128                         if (columnSet.AllColumns) - 3407129                        { - 3407130                            foundEntity.ApplyDateBehaviour(context); - 3407131                            return foundEntity; - 2880132                        } - 2880133                        else - 3014134                        { - 3014135                            var projected = foundEntity.ProjectAttributes(columnSet, context); - 3014136                            projected.ApplyDateBehaviour(context); - 3014137                            return projected; - 2880138                        } - 2880139                    } - 2880140                    else - 2910141                    { - 2880142                        // Entity not found in the context => FaultException - 2910143                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{entityName - 2880144                    } - 3541145                }); - 2880146        } + 288686        { + 288687            A.CallTo(() => fakedService.Retrieve(A<string>._, A<Guid>._, A<ColumnSet>._)) + 288688                .ReturnsLazily((string entityName, Guid id, ColumnSet columnSet) => + 362589                { + 362590                     if (string.IsNullOrWhiteSpace(entityName)) + 290491                    { + 290492                        throw new InvalidOperationException("The entity logical name must not be null or empty."); + 288693                    } + 288694 + 360795                     if (id == Guid.Empty) + 289296                    { + 289297                        throw new InvalidOperationException("The id must not be empty."); + 288698                    } + 288699 + 3601100                     if (columnSet == null) + 2898101                    { + 2898102                        throw new InvalidOperationException("The columnset parameter must not be null."); + 2886103                    } + 2886104 + 2886105                    // Don't fail with invalid operation exception, if no record of this entity exists, but entity is kn + 3589106                     if (!context.Data.ContainsKey(entityName)) + 2892107                    { + 2892108                         if (context.ProxyTypesAssembly == null) + 2886109                        { + 2886110                            throw new InvalidOperationException($"The entity logical name {entityName} is not valid."); + 2886111                        } + 2886112 + 2898113                         if (!context.ProxyTypesAssembly.GetTypes().Any(type => context.FindReflectedType(entityName) !=  + 2886114                        { + 2886115                            throw new InvalidOperationException($"The entity logical name {entityName} is not valid."); + 2886116                        } + 2892117                    } + 2886118 + 2886119                    //Return the subset of columns requested only + 3589120                    var reflectedType = context.FindReflectedType(entityName); + 2886121 + 2886122                    //Entity logical name exists, so , check if the requested entity exists + 3589123                     if (context.Data.ContainsKey(entityName) && context.Data[entityName] != null + 3589124                        && context.Data[entityName].ContainsKey(id)) + 3559125                    { + 2886126                        //Entity found => return only the subset of columns specified or all of them + 3559127                        var foundEntity = context.Data[entityName][id].Clone(reflectedType); + 3559128                         if (columnSet.AllColumns) + 3419129                        { + 3419130                            foundEntity.ApplyDateBehaviour(context); + 3419131                            return foundEntity; + 2886132                        } + 2886133                        else + 3026134                        { + 3026135                            var projected = foundEntity.ProjectAttributes(columnSet, context); + 3026136                            projected.ApplyDateBehaviour(context); + 3026137                            return projected; + 2886138                        } + 2886139                    } + 2886140                    else + 2916141                    { + 2886142                        // Entity not found in the context => FaultException + 2916143                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{entityName + 2886144                    } + 3559145                }); + 2886146        }  147        /// <summary>  148        /// Fakes the Create message  149        /// </summary>  150        /// <param name="context"></param>  151        /// <param name="fakedService"></param>  152        protected static void FakeCreate(XrmFakedContext context, IOrganizationService fakedService) - 2880153        { - 2880154            A.CallTo(() => fakedService.Create(A<Entity>._)) - 2880155                .ReturnsLazily((Entity e) => - 4090156                { - 4090157                    return context.CreateEntity(e); - 4030158                }); - 2880159        } + 2886153        { + 2886154            A.CallTo(() => fakedService.Create(A<Entity>._)) + 2886155                .ReturnsLazily((Entity e) => + 4096156                { + 4096157                    return context.CreateEntity(e); + 4036158                }); + 2886159        }  160  161        protected static void FakeUpdate(XrmFakedContext context, IOrganizationService fakedService) - 2880162        { - 2880163            A.CallTo(() => fakedService.Update(A<Entity>._)) - 2880164                .Invokes((Entity e) => - 3192165                { - 3192166                    context.UpdateEntity(e); - 3156167                }); - 2880168        } + 2886162        { + 2886163            A.CallTo(() => fakedService.Update(A<Entity>._)) + 2886164                .Invokes((Entity e) => + 3204165                { + 3204166                    context.UpdateEntity(e); + 3168167                }); + 2886168        }  169  170        protected void UpdateEntity(Entity e) - 312171        { - 312172             if (e == null) + 318171        { + 318172             if (e == null)  6173            {  6174                throw new InvalidOperationException("The entity must not be null");  175            } - 306176            e = e.Clone(e.GetType()); - 306177            e.Id = GetRecordUniqueId(e.ToEntityReferenceWithKeyAttributes()); + 312176            e = e.Clone(e.GetType()); + 312177            e.Id = GetRecordUniqueId(e.ToEntityReferenceWithKeyAttributes());  178  179            // Update specific validations: The entity record must exist in the context - 294180             if (Data.ContainsKey(e.LogicalName) && - 294181                Data[e.LogicalName].ContainsKey(e.Id)) - 282182            { - 282183                 if (this.UsePipelineSimulation) + 300180             if (Data.ContainsKey(e.LogicalName) && + 300181                Data[e.LogicalName].ContainsKey(e.Id)) + 288182            { + 288183                 if (this.UsePipelineSimulation)  24184                {  24185                    ExecutePipelineStage("Update", ProcessingStepStage.Preoperation, ProcessingStepMode.Synchronous, e);  24186                }  187  188                // Add as many attributes to the entity as the ones received (this will keep existing ones) - 282189                var cachedEntity = Data[e.LogicalName][e.Id]; - 3958190                foreach (var sAttributeName in e.Attributes.Keys.ToList()) - 1559191                { - 1559192                    var attribute = e[sAttributeName]; - 1559193                     if (attribute is DateTime) - 311194                    { - 311195                        cachedEntity[sAttributeName] = ConvertToUtc((DateTime)e[sAttributeName]); - 311196                    }197198                    else - 1248199                    { - 1248200                         if (attribute is EntityReference && ValidateReferences) - 51201                        { - 51202                            var target = (EntityReference)e[sAttributeName]; - 51203                            attribute = ResolveEntityReference(target); - 45204                        } - 1242205                        cachedEntity[sAttributeName] = attribute; - 1242206                    } - 1553207                }208209                // Update ModifiedOn - 276210                cachedEntity["modifiedon"] = DateTime.UtcNow; - 276211                cachedEntity["modifiedby"] = CallerId;212 - 276213                 if (this.UsePipelineSimulation) - 24214                { - 24215                    ExecutePipelineStage("Update", ProcessingStepStage.Postoperation, ProcessingStepMode.Synchronous, e)216 - 24217                    var clone = e.Clone(e.GetType()); - 24218                    ExecutePipelineStage("Update", ProcessingStepStage.Postoperation, ProcessingStepMode.Asynchronous, c - 24219                } - 276220            }221            else - 12222            {223                // The entity record was not found, return a CRM-ish update error message - 12224                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{e.LogicalName} wit225            } - 276226        }227228        protected EntityReference ResolveEntityReference(EntityReference er) - 225229        { - 225230             if (!Data.ContainsKey(er.LogicalName) || !Data[er.LogicalName].ContainsKey(er.Id)) - 24231            { - 24232                 if (er.Id == Guid.Empty && er.HasKeyAttributes()) - 12233                { - 12234                    return ResolveEntityReferenceByAlternateKeys(er);235                }236                else - 12237                { - 12238                    throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{er.LogicalName239                }240            } - 201241            return er; - 213242        }243244        protected EntityReference ResolveEntityReferenceByAlternateKeys(EntityReference er) - 12245        { - 12246            var resolvedId = GetRecordUniqueId(er);247 - 12248            return new EntityReference() - 12249            { - 12250                LogicalName = er.LogicalName, - 12251                Id = resolvedId - 12252            }; - 12253        }254        /// <summary>255        /// Fakes the delete method. Very similar to the Retrieve one256        /// </summary>257        /// <param name="context"></param>258        /// <param name="fakedService"></param>259        protected static void FakeDelete(XrmFakedContext context, IOrganizationService fakedService) - 2880260        { - 2880261            A.CallTo(() => fakedService.Delete(A<string>._, A<Guid>._)) - 2880262                .Invokes((string entityName, Guid id) => - 3024263                { - 3024264                     if (string.IsNullOrWhiteSpace(entityName)) - 2898265                    { - 2898266                        throw new InvalidOperationException("The entity logical name must not be null or empty."); - 2880267                    } - 2880268 - 3006269                     if (id == Guid.Empty) - 2886270                    { - 2886271                        throw new InvalidOperationException("The id must not be empty."); - 2880272                    } - 2880273 - 3000274                    var entityReference = new EntityReference(entityName, id); - 2880275 - 3000276                    context.DeleteEntity(entityReference); - 2982277                }); - 2880278        }279280        protected void DeleteEntity(EntityReference er) - 120281        {282            // Don't fail with invalid operation exception, if no record of this entity exists, but entity is known - 120283             if (!this.Data.ContainsKey(er.LogicalName)) - 12284            { - 12285                 if (this.ProxyTypesAssembly == null) - 6286                { - 6287                    throw new InvalidOperationException($"The entity logical name {er.LogicalName} is not valid.");288                }289 - 12290                 if (!this.ProxyTypesAssembly.GetTypes().Any(type => this.FindReflectedType(er.LogicalName) != null)) - 0291                { - 0292                    throw new InvalidOperationException($"The entity logical name {er.LogicalName} is not valid.");293                } - 6294            }295296            // Entity logical name exists, so , check if the requested entity exists - 114297             if (this.Data.ContainsKey(er.LogicalName) && this.Data[er.LogicalName] != null && - 114298                this.Data[er.LogicalName].ContainsKey(er.Id)) - 102299            { - 102300                 if (this.UsePipelineSimulation) - 18301                { - 18302                    ExecutePipelineStage("Delete", ProcessingStepStage.Preoperation, ProcessingStepMode.Synchronous, er) - 18303                }304305                // Entity found => return only the subset of columns specified or all of them - 102306                this.Data[er.LogicalName].Remove(er.Id); + 288189                var cachedEntity = Data[e.LogicalName][e.Id]; + 4000190                foreach (var sAttributeName in e.Attributes.Keys.ToList()) + 1571191                { + 1571192                    var attribute = e[sAttributeName]; + 1571193                     if (attribute == null) + 6194                    { + 6195                        cachedEntity.Attributes.Remove(sAttributeName); + 6196                    } + 1565197                     else if (attribute is DateTime) + 311198                    { + 311199                        cachedEntity[sAttributeName] = ConvertToUtc((DateTime)e[sAttributeName]); + 311200                    }201                    else + 1254202                    { + 1254203                         if (attribute is EntityReference && ValidateReferences) + 51204                        { + 51205                            var target = (EntityReference)e[sAttributeName]; + 51206                            attribute = ResolveEntityReference(target); + 45207                        } + 1248208                        cachedEntity[sAttributeName] = attribute; + 1248209                    } + 1565210                }211212                // Update ModifiedOn + 282213                cachedEntity["modifiedon"] = DateTime.UtcNow; + 282214                cachedEntity["modifiedby"] = CallerId;215 + 282216                 if (this.UsePipelineSimulation) + 24217                { + 24218                    ExecutePipelineStage("Update", ProcessingStepStage.Postoperation, ProcessingStepMode.Synchronous, e)219 + 24220                    var clone = e.Clone(e.GetType()); + 24221                    ExecutePipelineStage("Update", ProcessingStepStage.Postoperation, ProcessingStepMode.Asynchronous, c + 24222                } + 282223            }224            else + 12225            {226                // The entity record was not found, return a CRM-ish update error message + 12227                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{e.LogicalName} wit228            } + 282229        }230231        protected EntityReference ResolveEntityReference(EntityReference er) + 225232        { + 225233             if (!Data.ContainsKey(er.LogicalName) || !Data[er.LogicalName].ContainsKey(er.Id)) + 24234            { + 24235                 if (er.Id == Guid.Empty && er.HasKeyAttributes()) + 12236                { + 12237                    return ResolveEntityReferenceByAlternateKeys(er);238                }239                else + 12240                { + 12241                    throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{er.LogicalName242                }243            } + 201244            return er; + 213245        }246247        protected EntityReference ResolveEntityReferenceByAlternateKeys(EntityReference er) + 12248        { + 12249            var resolvedId = GetRecordUniqueId(er);250 + 12251            return new EntityReference() + 12252            { + 12253                LogicalName = er.LogicalName, + 12254                Id = resolvedId + 12255            }; + 12256        }257        /// <summary>258        /// Fakes the delete method. Very similar to the Retrieve one259        /// </summary>260        /// <param name="context"></param>261        /// <param name="fakedService"></param>262        protected static void FakeDelete(XrmFakedContext context, IOrganizationService fakedService) + 2886263        { + 2886264            A.CallTo(() => fakedService.Delete(A<string>._, A<Guid>._)) + 2886265                .Invokes((string entityName, Guid id) => + 3030266                { + 3030267                     if (string.IsNullOrWhiteSpace(entityName)) + 2904268                    { + 2904269                        throw new InvalidOperationException("The entity logical name must not be null or empty."); + 2886270                    } + 2886271 + 3012272                     if (id == Guid.Empty) + 2892273                    { + 2892274                        throw new InvalidOperationException("The id must not be empty."); + 2886275                    } + 2886276 + 3006277                    var entityReference = new EntityReference(entityName, id); + 2886278 + 3006279                    context.DeleteEntity(entityReference); + 2988280                }); + 2886281        }282283        protected void DeleteEntity(EntityReference er) + 120284        {285            // Don't fail with invalid operation exception, if no record of this entity exists, but entity is known + 120286             if (!this.Data.ContainsKey(er.LogicalName)) + 12287            { + 12288                 if (this.ProxyTypesAssembly == null) + 6289                { + 6290                    throw new InvalidOperationException($"The entity logical name {er.LogicalName} is not valid.");291                }292 + 12293                 if (!this.ProxyTypesAssembly.GetTypes().Any(type => this.FindReflectedType(er.LogicalName) != null)) + 0294                { + 0295                    throw new InvalidOperationException($"The entity logical name {er.LogicalName} is not valid.");296                } + 6297            }298299            // Entity logical name exists, so , check if the requested entity exists + 114300             if (this.Data.ContainsKey(er.LogicalName) && this.Data[er.LogicalName] != null && + 114301                this.Data[er.LogicalName].ContainsKey(er.Id)) + 102302            { + 102303                 if (this.UsePipelineSimulation) + 18304                { + 18305                    ExecutePipelineStage("Delete", ProcessingStepStage.Preoperation, ProcessingStepMode.Synchronous, er) + 18306                }  307 - 102308                 if (this.UsePipelineSimulation) - 18309                { - 18310                    ExecutePipelineStage("Delete", ProcessingStepStage.Postoperation, ProcessingStepMode.Synchronous, er - 18311                    ExecutePipelineStage("Delete", ProcessingStepStage.Postoperation, ProcessingStepMode.Asynchronous, e - 18312                } - 102313            }314            else - 12315            {316                // Entity not found in the context => throw not found exception317                // The entity record was not found, return a CRM-ish update error message - 12318                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{er.LogicalName} wi319            } - 102320        }321        #endregion322323        #region Other protected methods324        protected void EnsureEntityNameExistsInMetadata(string sEntityName) - 5781325        { - 6261326             if (Relationships.Values.Any(value => new[] { value.Entity1LogicalName, value.Entity2LogicalName, value.Inte - 456327            { - 456328                return;329            }330331            // Entity metadata is checked differently when we are using a ProxyTypesAssembly => we can infer that from t - 5325332             if (ProxyTypesAssembly != null) - 3960333            { - 3960334                var subClassType = FindReflectedType(sEntityName); - 3960335                 if (subClassType == null) - 0336                { - 0337                    throw new Exception($"Entity {sEntityName} does not exist in the metadata cache");338                } - 3960339            }340            //else if (!Data.ContainsKey(sEntityName))341            //{342            //    //No Proxy Types Assembly343            //    throw new Exception(string.Format("Entity {0} does not exist in the metadata cache", sEntityName));344            //}; - 5781345        }346347        protected void AddEntityDefaultAttributes(Entity e) - 27746348        {349            // Add createdon, modifiedon, createdby, modifiedby properties - 27746350             if (CallerId == null) - 2688351            { - 2688352                CallerId = new EntityReference("systemuser", Guid.NewGuid()); // Create a new instance by default - 2688353                 if (ValidateReferences) - 33354                { - 33355                     if (!Data.ContainsKey("systemuser")) - 33356                    { - 33357                        Data.Add("systemuser", new Dictionary<Guid, Entity>()); - 33358                    } - 33359                     if (!Data["systemuser"].ContainsKey(CallerId.Id)) - 33360                    { - 33361                        Data["systemuser"].Add(CallerId.Id, new Entity("systemuser") { Id = CallerId.Id }); - 33362                    } - 33363                }364 - 2688365            }366 - 27746367            var isManyToManyRelationshipEntity = e.LogicalName != null && this.Relationships.ContainsKey(e.LogicalName);368 - 27746369            EntityInitializerService.Initialize(e, CallerId.Id, this, isManyToManyRelationshipEntity); - 27746370        }308                // Entity found => return only the subset of columns specified or all of them + 102309                this.Data[er.LogicalName].Remove(er.Id);310 + 102311                 if (this.UsePipelineSimulation) + 18312                { + 18313                    ExecutePipelineStage("Delete", ProcessingStepStage.Postoperation, ProcessingStepMode.Synchronous, er + 18314                    ExecutePipelineStage("Delete", ProcessingStepStage.Postoperation, ProcessingStepMode.Asynchronous, e + 18315                } + 102316            }317            else + 12318            {319                // Entity not found in the context => throw not found exception320                // The entity record was not found, return a CRM-ish update error message + 12321                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{er.LogicalName} wi322            } + 102323        }324        #endregion325326        #region Other protected methods327        protected void EnsureEntityNameExistsInMetadata(string sEntityName) + 5781328        { + 6261329             if (Relationships.Values.Any(value => new[] { value.Entity1LogicalName, value.Entity2LogicalName, value.Inte + 456330            { + 456331                return;332            }333334            // Entity metadata is checked differently when we are using a ProxyTypesAssembly => we can infer that from t + 5325335             if (ProxyTypesAssembly != null) + 3960336            { + 3960337                var subClassType = FindReflectedType(sEntityName); + 3960338                 if (subClassType == null) + 0339                { + 0340                    throw new Exception($"Entity {sEntityName} does not exist in the metadata cache");341                } + 3960342            }343            //else if (!Data.ContainsKey(sEntityName))344            //{345            //    //No Proxy Types Assembly346            //    throw new Exception(string.Format("Entity {0} does not exist in the metadata cache", sEntityName));347            //}; + 5781348        }349350        protected void AddEntityDefaultAttributes(Entity e) + 27752351        {352            // Add createdon, modifiedon, createdby, modifiedby properties + 27752353             if (CallerId == null) + 2694354            { + 2694355                CallerId = new EntityReference("systemuser", Guid.NewGuid()); // Create a new instance by default + 2694356                 if (ValidateReferences) + 33357                { + 33358                     if (!Data.ContainsKey("systemuser")) + 33359                    { + 33360                        Data.Add("systemuser", new Dictionary<Guid, Entity>()); + 33361                    } + 33362                     if (!Data["systemuser"].ContainsKey(CallerId.Id)) + 33363                    { + 33364                        Data["systemuser"].Add(CallerId.Id, new Entity("systemuser") { Id = CallerId.Id }); + 33365                    } + 33366                }367 + 2694368            }369 + 27752370            var isManyToManyRelationshipEntity = e.LogicalName != null && this.Relationships.ContainsKey(e.LogicalName);  371372        protected void ValidateEntity(Entity e) - 28980373        { - 28980374             if (e == null) - 0375            { - 0376                throw new InvalidOperationException("The entity must not be null");377            }378379            // Validate the entity - 28980380             if (string.IsNullOrWhiteSpace(e.LogicalName)) - 12381            { - 12382                throw new InvalidOperationException("The LogicalName property must not be empty");383            }384 - 28968385             if (e.Id == Guid.Empty) - 6386            { - 6387                throw new InvalidOperationException("The Id property must not be empty");388            } - 28962389        }390391        protected internal Guid CreateEntity(Entity e) - 1240392        { - 1240393             if (e == null) - 6394            { - 6395                throw new InvalidOperationException("The entity must not be null");396            }397 - 1234398            var clone = e.Clone(e.GetType());399 - 1234400             if (clone.Id == Guid.Empty) - 949401            { - 949402                clone.Id = Guid.NewGuid(); // Add default guid if none present - 949403            }404405            // Hack for Dynamic Entities where the Id property doesn't populate the "entitynameid" primary key - 1234406            var primaryKeyAttribute = $"{e.LogicalName}id"; - 1234407             if (!clone.Attributes.ContainsKey(primaryKeyAttribute)) - 736408            { - 736409                clone[primaryKeyAttribute] = clone.Id; - 736410            }411 - 1234412            ValidateEntity(clone);413414            // Create specific validations - 1228415             if (clone.Id != Guid.Empty && Data.ContainsKey(clone.LogicalName) && - 1228416                Data[clone.LogicalName].ContainsKey(clone.Id)) - 24417            { - 24418                throw new InvalidOperationException($"There is already a record of entity {clone.LogicalName} with id {c419            }420421            // Create specific validations - 1204422             if (clone.Attributes.ContainsKey("statecode")) - 6423            { - 6424                throw new InvalidOperationException($"When creating an entity with logical name '{clone.LogicalName}', o425            }426 - 1198427            AddEntityWithDefaults(clone, false, this.UsePipelineSimulation);428 - 1186429             if (e.RelatedEntities.Count > 0) - 18430            { - 84431                foreach (var relationshipSet in e.RelatedEntities) - 18432                { - 18433                    var relationship = relationshipSet.Key;434 - 18435                    var entityReferenceCollection = new EntityReferenceCollection();436 - 114437                    foreach (var relatedEntity in relationshipSet.Value.Entities) - 30438                    { - 30439                        var relatedId = CreateEntity(relatedEntity); - 30440                        entityReferenceCollection.Add(new EntityReference(relatedEntity.LogicalName, relatedId)); - 30441                    }442 - 18443                     if (FakeMessageExecutors.ContainsKey(typeof(AssociateRequest))) - 18444                    { - 18445                        var request = new AssociateRequest - 18446                        { - 18447                            Target = clone.ToEntityReference(), - 18448                            Relationship = relationship, - 18449                            RelatedEntities = entityReferenceCollection - 18450                        }; - 18451                        FakeMessageExecutors[typeof(AssociateRequest)].Execute(request, this); - 12452                    }453                    else - 0454                    { - 0455                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(AssociateRequest));456                    } - 12457                } - 12458            }459 - 1180460            return clone.Id; - 1180461        } + 27752372            EntityInitializerService.Initialize(e, CallerId.Id, this, isManyToManyRelationshipEntity); + 27752373        }374375        protected void ValidateEntity(Entity e) + 28986376        { + 28986377             if (e == null) + 0378            { + 0379                throw new InvalidOperationException("The entity must not be null");380            }381382            // Validate the entity + 28986383             if (string.IsNullOrWhiteSpace(e.LogicalName)) + 12384            { + 12385                throw new InvalidOperationException("The LogicalName property must not be empty");386            }387 + 28974388             if (e.Id == Guid.Empty) + 6389            { + 6390                throw new InvalidOperationException("The Id property must not be empty");391            } + 28968392        }393394        protected internal Guid CreateEntity(Entity e) + 1240395        { + 1240396             if (e == null) + 6397            { + 6398                throw new InvalidOperationException("The entity must not be null");399            }400 + 1234401            var clone = e.Clone(e.GetType());402 + 1234403             if (clone.Id == Guid.Empty) + 949404            { + 949405                clone.Id = Guid.NewGuid(); // Add default guid if none present + 949406            }407408            // Hack for Dynamic Entities where the Id property doesn't populate the "entitynameid" primary key + 1234409            var primaryKeyAttribute = $"{e.LogicalName}id"; + 1234410             if (!clone.Attributes.ContainsKey(primaryKeyAttribute)) + 736411            { + 736412                clone[primaryKeyAttribute] = clone.Id; + 736413            }414 + 1234415            ValidateEntity(clone);416417            // Create specific validations + 1228418             if (clone.Id != Guid.Empty && Data.ContainsKey(clone.LogicalName) && + 1228419                Data[clone.LogicalName].ContainsKey(clone.Id)) + 24420            { + 24421                throw new InvalidOperationException($"There is already a record of entity {clone.LogicalName} with id {c422            }423424            // Create specific validations + 1204425             if (clone.Attributes.ContainsKey("statecode")) + 6426            { + 6427                throw new InvalidOperationException($"When creating an entity with logical name '{clone.LogicalName}', o428            }429 + 1198430            AddEntityWithDefaults(clone, false, this.UsePipelineSimulation);431 + 1186432             if (e.RelatedEntities.Count > 0) + 18433            { + 84434                foreach (var relationshipSet in e.RelatedEntities) + 18435                { + 18436                    var relationship = relationshipSet.Key;437 + 18438                    var entityReferenceCollection = new EntityReferenceCollection();439 + 114440                    foreach (var relatedEntity in relationshipSet.Value.Entities) + 30441                    { + 30442                        var relatedId = CreateEntity(relatedEntity); + 30443                        entityReferenceCollection.Add(new EntityReference(relatedEntity.LogicalName, relatedId)); + 30444                    }445 + 18446                     if (FakeMessageExecutors.ContainsKey(typeof(AssociateRequest))) + 18447                    { + 18448                        var request = new AssociateRequest + 18449                        { + 18450                            Target = clone.ToEntityReference(), + 18451                            Relationship = relationship, + 18452                            RelatedEntities = entityReferenceCollection + 18453                        }; + 18454                        FakeMessageExecutors[typeof(AssociateRequest)].Execute(request, this); + 12455                    }456                    else + 0457                    { + 0458                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(AssociateRequest));459                    } + 12460                } + 12461            }  462463        protected internal void AddEntityWithDefaults(Entity e, bool clone = false, bool usePluginPipeline = false) - 27746464        {465            // Create the entity with defaults - 27746466            AddEntityDefaultAttributes(e);467 - 27746468             if (usePluginPipeline) - 42469            { - 42470                ExecutePipelineStage("Create", ProcessingStepStage.Preoperation, ProcessingStepMode.Synchronous, e); - 42471            }472473            // Store - 27746474             AddEntity(clone ? e.Clone(e.GetType()) : e); + 1180463            return clone.Id; + 1180464        }465466        protected internal void AddEntityWithDefaults(Entity e, bool clone = false, bool usePluginPipeline = false) + 27752467        {468            // Create the entity with defaults + 27752469            AddEntityDefaultAttributes(e);470 + 27752471             if (usePluginPipeline) + 42472            { + 42473                ExecutePipelineStage("Create", ProcessingStepStage.Preoperation, ProcessingStepMode.Synchronous, e); + 42474            }  475 - 27722476             if (usePluginPipeline) - 42477            { - 42478                ExecutePipelineStage("Create", ProcessingStepStage.Postoperation, ProcessingStepMode.Synchronous, e); - 42479                ExecutePipelineStage("Create", ProcessingStepStage.Postoperation, ProcessingStepMode.Asynchronous, e); - 42480            } - 27722481        }482483        protected internal void AddEntity(Entity e) - 27746484        {485            //Automatically detect proxy types assembly if an early bound type was used. - 27746486             if (ProxyTypesAssembly == null && - 27746487                e.GetType().IsSubclassOf(typeof(Entity))) - 1360488            { - 1360489                ProxyTypesAssembly = Assembly.GetAssembly(e.GetType()); - 1360490            }491 - 27746492            ValidateEntity(e); //Entity must have a logical name and an Id493 - 517782494            foreach (var sAttributeName in e.Attributes.Keys.ToList()) - 217293495            { - 217293496                var attribute = e[sAttributeName]; - 217293497                 if (attribute is DateTime) - 56102498                { - 56102499                    e[sAttributeName] = ConvertToUtc((DateTime)e[sAttributeName]); - 56102500                } - 217293501                 if (attribute is EntityReference && ValidateReferences) - 174502                { - 174503                    var target = (EntityReference)e[sAttributeName]; - 174504                    e[sAttributeName] = ResolveEntityReference(target); - 168505                } - 217287506            }507508            //Add the entity collection - 27728509             if (!Data.ContainsKey(e.LogicalName)) - 4459510            { - 4459511                Data.Add(e.LogicalName, new Dictionary<Guid, Entity>()); - 4459512            }513 - 27728514             if (Data[e.LogicalName].ContainsKey(e.Id)) - 6515            { - 6516                Data[e.LogicalName][e.Id] = e; - 6517            }518            else - 27722519            { - 27722520                Data[e.LogicalName].Add(e.Id, e); - 27722521            }522523            //Update metadata for that entity - 27728524             if (!AttributeMetadataNames.ContainsKey(e.LogicalName)) - 4459525                AttributeMetadataNames.Add(e.LogicalName, new Dictionary<string, string>());526527            //Update attribute metadata - 27728528             if (ProxyTypesAssembly != null) - 5990529            {530                //If the context is using a proxy types assembly then we can just guess the metadata from the generated  - 5990531                var type = FindReflectedType(e.LogicalName); - 5990532                 if (type != null) - 5984533                { - 5984534                    var props = type.GetProperties(); - 3004854535                    foreach (var p in props) - 1493451536                    { - 1493451537                         if (!AttributeMetadataNames[e.LogicalName].ContainsKey(p.Name)) - 722109538                            AttributeMetadataNames[e.LogicalName].Add(p.Name, p.Name); - 1493451539                    } - 5984540                }541                else - 6542                    throw new Exception(string.Format("Couldnt find reflected type for {0}", e.LogicalName));543 - 5984544            }545            else - 21738546            {547                //If dynamic entities are being used, then the only way of guessing if a property exists is just by chec548                //if the entity has the attribute in the dictionary - 401832549                foreach (var attKey in e.Attributes.Keys) - 168309550                { - 168309551                     if (!AttributeMetadataNames[e.LogicalName].ContainsKey(attKey)) - 13705552                        AttributeMetadataNames[e.LogicalName].Add(attKey, attKey); - 168309553                } - 21738554            }555556 - 27722557        }476            // Store + 27752477             AddEntity(clone ? e.Clone(e.GetType()) : e);478 + 27728479             if (usePluginPipeline) + 42480            { + 42481                ExecutePipelineStage("Create", ProcessingStepStage.Postoperation, ProcessingStepMode.Synchronous, e); + 42482                ExecutePipelineStage("Create", ProcessingStepStage.Postoperation, ProcessingStepMode.Asynchronous, e); + 42483            } + 27728484        }485486        protected internal void AddEntity(Entity e) + 27752487        {488            //Automatically detect proxy types assembly if an early bound type was used. + 27752489             if (ProxyTypesAssembly == null && + 27752490                e.GetType().IsSubclassOf(typeof(Entity))) + 1366491            { + 1366492                ProxyTypesAssembly = Assembly.GetAssembly(e.GetType()); + 1366493            }494 + 27752495            ValidateEntity(e); //Entity must have a logical name and an Id496 + 518234497            foreach (var sAttributeName in e.Attributes.Keys.ToList()) + 217510498            { + 217510499                var attribute = e[sAttributeName]; + 217510500                 if (attribute is DateTime) + 56114501                { + 56114502                    e[sAttributeName] = ConvertToUtc((DateTime)e[sAttributeName]); + 56114503                } + 217510504                 if (attribute is EntityReference && ValidateReferences) + 174505                { + 174506                    var target = (EntityReference)e[sAttributeName]; + 174507                    e[sAttributeName] = ResolveEntityReference(target); + 168508                } + 217504509            }510511            //Add the entity collection + 27734512             if (!Data.ContainsKey(e.LogicalName)) + 4465513            { + 4465514                Data.Add(e.LogicalName, new Dictionary<Guid, Entity>()); + 4465515            }516 + 27734517             if (Data[e.LogicalName].ContainsKey(e.Id)) + 6518            { + 6519                Data[e.LogicalName][e.Id] = e; + 6520            }521            else + 27728522            { + 27728523                Data[e.LogicalName].Add(e.Id, e); + 27728524            }525526            //Update metadata for that entity + 27734527             if (!AttributeMetadataNames.ContainsKey(e.LogicalName)) + 4465528                AttributeMetadataNames.Add(e.LogicalName, new Dictionary<string, string>());529530            //Update attribute metadata + 27734531             if (ProxyTypesAssembly != null) + 5996532            {533                //If the context is using a proxy types assembly then we can just guess the metadata from the generated  + 5996534                var type = FindReflectedType(e.LogicalName); + 5996535                 if (type != null) + 5990536                { + 5990537                    var props = type.GetProperties(); + 3007598538                    foreach (var p in props) + 1494814539                    { + 1494814540                         if (!AttributeMetadataNames[e.LogicalName].ContainsKey(p.Name)) + 723472541                            AttributeMetadataNames[e.LogicalName].Add(p.Name, p.Name); + 1494814542                    } + 5990543                }544                else + 6545                    throw new Exception(string.Format("Couldnt find reflected type for {0}", e.LogicalName));546 + 5990547            }548            else + 21738549            {550                //If dynamic entities are being used, then the only way of guessing if a property exists is just by chec551                //if the entity has the attribute in the dictionary + 401964552                foreach (var attKey in e.Attributes.Keys) + 168375553                { + 168375554                     if (!AttributeMetadataNames[e.LogicalName].ContainsKey(attKey)) + 13729555                        AttributeMetadataNames[e.LogicalName].Add(attKey, attKey); + 168375556                } + 21738557            }  558559        protected internal bool AttributeExistsInMetadata(string sEntityName, string sAttributeName) - 5806560        { - 6118561            var relationships = this.Relationships.Values.Where(value => new[] { value.Entity1LogicalName, value.Entity2 - 6082562             if (relationships.Any(e => e.Entity1Attribute == sAttributeName || e.Entity2Attribute == sAttributeName)) - 102563            { - 102564                return true;565            }566567            //Early bound types - 5704568             if (ProxyTypesAssembly != null) - 4842569            {570                //Check if attribute exists in the early bound type - 4842571                var earlyBoundType = FindReflectedType(sEntityName); - 4842572                 if (earlyBoundType != null) - 4842573                {574                    //Get that type properties - 4842575                    var attributeFound = earlyBoundType - 4842576                        .GetProperties() - 440147577                        .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0) - 435444578                        .Where(pi => (pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true)[0] as Attribut - 4842579                        .FirstOrDefault();580 - 4842581                     if (attributeFound != null) - 4818582                        return true;559 + 27728560        }561562        protected internal bool AttributeExistsInMetadata(string sEntityName, string sAttributeName) + 5812563        { + 6124564            var relationships = this.Relationships.Values.Where(value => new[] { value.Entity1LogicalName, value.Entity2 + 6088565             if (relationships.Any(e => e.Entity1Attribute == sAttributeName || e.Entity2Attribute == sAttributeName)) + 102566            { + 102567                return true;568            }569570            //Early bound types + 5710571             if (ProxyTypesAssembly != null) + 4848572            {573                //Check if attribute exists in the early bound type + 4848574                var earlyBoundType = FindReflectedType(sEntityName); + 4848575                 if (earlyBoundType != null) + 4848576                {577                    //Get that type properties + 4848578                    var attributeFound = earlyBoundType + 4848579                        .GetProperties() + 440608580                        .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0) + 435894581                        .Where(pi => (pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true)[0] as Attribut + 4848582                        .FirstOrDefault();  583 - 24584                     if (attributeFound == null && EntityMetadata.ContainsKey(sEntityName)) - 0585                    {586                        //Try with metadata - 0587                        return AttributeExistsInInjectedMetadata(sEntityName, sAttributeName);588                    }589                    else - 24590                    { - 24591                        return false;592                    }593                }594                //Try with metadata - 0595                return false;596            }597 - 862598             if (EntityMetadata.ContainsKey(sEntityName)) - 0599            {600                //Try with metadata - 0601                return AttributeExistsInInjectedMetadata(sEntityName, sAttributeName);602            }603604            //Dynamic entities and not entity metadata injected for entity => just return true if not found - 862605            return true; - 5806606        }607608        protected internal bool AttributeExistsInInjectedMetadata(string sEntityName, string sAttributeName) - 0609        { - 0610            var attributeInMetadata = FindAttributeTypeInInjectedMetadata(sEntityName, sAttributeName); - 0611            return attributeInMetadata != null; - 0612        }613614        protected internal DateTime ConvertToUtc(DateTime attribute) - 56413615        { - 56413616            return DateTime.SpecifyKind(attribute, DateTimeKind.Utc); - 56413617        }618        #endregion619    }620} + 4848584                     if (attributeFound != null) + 4824585                        return true;586 + 24587                     if (attributeFound == null && EntityMetadata.ContainsKey(sEntityName)) + 0588                    {589                        //Try with metadata + 0590                        return AttributeExistsInInjectedMetadata(sEntityName, sAttributeName);591                    }592                    else + 24593                    { + 24594                        return false;595                    }596                }597                //Try with metadata + 0598                return false;599            }600 + 862601             if (EntityMetadata.ContainsKey(sEntityName)) + 0602            {603                //Try with metadata + 0604                return AttributeExistsInInjectedMetadata(sEntityName, sAttributeName);605            }606607            //Dynamic entities and not entity metadata injected for entity => just return true if not found + 862608            return true; + 5812609        }610611        protected internal bool AttributeExistsInInjectedMetadata(string sEntityName, string sAttributeName) + 0612        { + 0613            var attributeInMetadata = FindAttributeTypeInInjectedMetadata(sEntityName, sAttributeName); + 0614            return attributeInMetadata != null; + 0615        }616617        protected internal DateTime ConvertToUtc(DateTime attribute) + 56425618        { + 56425619            return DateTime.SpecifyKind(attribute, DateTimeKind.Utc); + 56425620        }621        #endregion622    }623}

D:\Git\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.cs

@@ -1467,22 +1470,22 @@

D:\Git\fake-xrm-easy\  20    /// </summary>  21    public partial class XrmFakedContext : IXrmContext  22    { - 1092823        protected internal IOrganizationService Service { get; set; } + 1094623        protected internal IOrganizationService Service { get; set; }  24  25        private IServiceEndpointNotificationService _serviceEndpointNotificationService;  26 - 404727        private readonly Lazy<XrmFakedTracingService> _tracingService = new Lazy<XrmFakedTracingService>(() => new XrmFa + 405327        private readonly Lazy<XrmFakedTracingService> _tracingService = new Lazy<XrmFakedTracingService>(() => new XrmFa  28  29        /// <summary>  30        /// All proxy type assemblies available on mocked database.  31        /// </summary> - 13513332        private List<Assembly> ProxyTypesAssemblies { get; set; } + 13520532        private List<Assembly> ProxyTypesAssemblies { get; set; }  33  27034        protected internal XrmFakedTracingService TracingService => _tracingService.Value;  35 - 472436        protected internal bool Initialised { get; set; } + 473636        protected internal bool Initialised { get; set; }  37 - 11016638        public Dictionary<string, Dictionary<Guid, Entity>> Data { get; set; } + 11028038        public Dictionary<string, Dictionary<Guid, Entity>> Data { get; set; }  39  40        /// <summary>  41        /// Specify which assembly is used to search for early-bound proxy @@ -1493,23 +1496,23 @@

D:\Git\fake-xrm-easy\  46        /// instead.  47        /// </summary>  48        public Assembly ProxyTypesAssembly { - 9955149          get { + 9957549          get {  50            // TODO What we should do when ProxyTypesAssemblies contains multiple assemblies? One shouldn't throw except - 9955151            return ProxyTypesAssemblies.FirstOrDefault(); - 9955152          } - 204753          set { - 204754            ProxyTypesAssemblies = new List<Assembly>(); - 409455             if(value != null) { - 204756              ProxyTypesAssemblies.Add(value); - 204757            } - 204758          } + 9957551            return ProxyTypesAssemblies.FirstOrDefault(); + 9957552          } + 205353          set { + 205354            ProxyTypesAssemblies = new List<Assembly>(); + 410655             if(value != null) { + 205356              ProxyTypesAssemblies.Add(value); + 205357            } + 205358          }  59        }  60  61        /// <summary>  62        /// Sets the user to assign the CreatedBy and ModifiedBy properties when entities are added to the context.  63        /// All requests will be executed on behalf of this user  64        /// </summary> - 5887365        public EntityReference CallerId { get; set; } + 5889765        public EntityReference CallerId { get; set; }  66  28267        public EntityReference BusinessUnitId { get; set; }  68 @@ -1518,86 +1521,86 @@

D:\Git\fake-xrm-easy\  71        /// <summary>  72        /// Probably should be replaced by FakeMessageExecutors, more generic, which can use custom interfaces rather th  73        /// </summary> - 581774        private Dictionary<Type, ServiceRequestExecution> ExecutionMocks { get; set; } + 582374        private Dictionary<Type, ServiceRequestExecution> ExecutionMocks { get; set; }  75 - 983776        private Dictionary<Type, IFakeMessageExecutor> FakeMessageExecutors { get; set; } + 984376        private Dictionary<Type, IFakeMessageExecutor> FakeMessageExecutors { get; set; }  77 - 392178        private Dictionary<string, IFakeMessageExecutor> GenericFakeMessageExecutors { get; set; } + 392778        private Dictionary<string, IFakeMessageExecutor> GenericFakeMessageExecutors { get; set; }  79 - 4392080        private Dictionary<string, XrmFakedRelationship> Relationships { get; set; } + 4393880        private Dictionary<string, XrmFakedRelationship> Relationships { get; set; }  81  82 - 3160783        public IEntityInitializerService EntityInitializerService { get; set; } - 414484        public IAccessRightsRepository AccessRightsRepository { get; set; } + 3161983        public IEntityInitializerService EntityInitializerService { get; set; } + 415084        public IAccessRightsRepository AccessRightsRepository { get; set; }  85 - 1949686        public int MaxRetrieveCount { get; set; } + 1950286        public int MaxRetrieveCount { get; set; }  87 - 3161988        public EntityInitializationLevel InitializationLevel { get; set; } + 3163188        public EntityInitializationLevel InitializationLevel { get; set; }  89 - 385590        public XrmFakedContext() - 385591        { - 385592            MaxRetrieveCount = 5000; + 386190        public XrmFakedContext() + 386191        { + 386192            MaxRetrieveCount = 5000;  93 - 385594            AttributeMetadataNames = new Dictionary<string, Dictionary<string, string>>(); - 385595            Data = new Dictionary<string, Dictionary<Guid, Entity>>(); - 385596            ExecutionMocks = new Dictionary<Type, ServiceRequestExecution>(); - 385597            OptionSetValuesMetadata = new Dictionary<string, OptionSetMetadata>(); - 385598            StatusAttributeMetadata = new Dictionary<string, StatusAttributeMetadata>(); + 386194            AttributeMetadataNames = new Dictionary<string, Dictionary<string, string>>(); + 386195            Data = new Dictionary<string, Dictionary<Guid, Entity>>(); + 386196            ExecutionMocks = new Dictionary<Type, ServiceRequestExecution>(); + 386197            OptionSetValuesMetadata = new Dictionary<string, OptionSetMetadata>(); + 386198            StatusAttributeMetadata = new Dictionary<string, StatusAttributeMetadata>();  99 - 3855100            FakeMessageExecutors = Assembly.GetExecutingAssembly() - 3855101                .GetTypes() - 739857102                .Where(t => t.GetInterfaces().Contains(typeof(IFakeMessageExecutor))) - 169131103                .Select(t => Activator.CreateInstance(t) as IFakeMessageExecutor) - 334407104                .ToDictionary(t => t.GetResponsibleRequestType(), t => t); + 3861100            FakeMessageExecutors = Assembly.GetExecutingAssembly() + 3861101                .GetTypes() + 741008102                .Where(t => t.GetInterfaces().Contains(typeof(IFakeMessageExecutor))) + 169394103                .Select(t => Activator.CreateInstance(t) as IFakeMessageExecutor) + 334927104                .ToDictionary(t => t.GetResponsibleRequestType(), t => t);  105 - 3855106            GenericFakeMessageExecutors = new Dictionary<string, IFakeMessageExecutor>(); + 3861106            GenericFakeMessageExecutors = new Dictionary<string, IFakeMessageExecutor>();  107 - 3855108            Relationships = new Dictionary<string, XrmFakedRelationship>(); + 3861108            Relationships = new Dictionary<string, XrmFakedRelationship>();  109 - 3855110            EntityInitializerService = new DefaultEntityInitializerService(); + 3861110            EntityInitializerService = new DefaultEntityInitializerService();  111 - 3855112            AccessRightsRepository = new AccessRightsRepository(); + 3861112            AccessRightsRepository = new AccessRightsRepository();  113 - 3855114            SystemTimeZone = TimeZoneInfo.Local; - 3855115            DateBehaviour = DefaultDateBehaviour(); + 3861114            SystemTimeZone = TimeZoneInfo.Local; + 3861115            DateBehaviour = DefaultDateBehaviour();  116 - 3855117            EntityMetadata = new Dictionary<string, EntityMetadata>(); + 3861117            EntityMetadata = new Dictionary<string, EntityMetadata>();  118 - 3855119            UsePipelineSimulation = false; + 3861119            UsePipelineSimulation = false;  120 - 3855121            InitializationLevel = EntityInitializationLevel.Default; + 3861121            InitializationLevel = EntityInitializationLevel.Default;  122 - 3855123            ProxyTypesAssemblies = new List<Assembly>(); - 3855124        } + 3861123            ProxyTypesAssemblies = new List<Assembly>(); + 3861124        }  125  126        /// <summary>  127        /// Initializes the context with the provided entities  128        /// </summary>  129        /// <param name="entities"></param>  130        public virtual void Initialize(IEnumerable<Entity> entities) - 2374131        { - 2374132             if (Initialised) + 2380131        { + 2380132             if (Initialised)  6133            {  6134                throw new Exception("Initialize should be called only once per unit test execution and XrmFakedContext i  135            }  136 - 2368137             if (entities == null) + 2374137             if (entities == null)  6138            {  6139                throw new InvalidOperationException("The entities parameter must be not null");  140            }  141 - 59498142            foreach (var e in entities) - 26212143            { - 26212144                AddEntityWithDefaults(e, true); - 26200145            } + 59528142            foreach (var e in entities) + 26218143            { + 26218144                AddEntityWithDefaults(e, true); + 26206145            }  146 - 2350147            Initialised = true; - 2350148        } + 2356147            Initialised = true; + 2356148        }  149  150        public void Initialize(Entity e) - 63151        { - 63152            this.Initialize(new List<Entity>() { e }); - 63153        } + 69151        { + 69152            this.Initialize(new List<Entity>() { e }); + 69153        }  154  155        /// <summary>  156        /// Enables support for the early-cound types exposed in a specified assembly. @@ -1714,14 +1717,14 @@

D:\Git\fake-xrm-easy\  18267        }  268  269        public virtual IOrganizationService GetOrganizationService() - 1741270        { - 1741271             if (this is XrmRealContext) + 1771270        { + 1771271             if (this is XrmRealContext)  0272            {  0273                Service = GetOrganizationService();  0274                return Service;  275            } - 1741276            return GetFakedOrganizationService(this); - 1741277        } + 1771276            return GetFakedOrganizationService(this); + 1771277        }  278  279        /// <summary>  280        /// Deprecated. Use GetOrganizationService instead @@ -1729,36 +1732,36 @@

D:\Git\fake-xrm-easy\  282        /// <returns></returns>  283        [Obsolete("Use GetOrganizationService instead")]  284        public IOrganizationService GetFakedOrganizationService() - 2013285        { - 2013286            return GetFakedOrganizationService(this); - 2013287        } + 1989285        { + 1989286            return GetFakedOrganizationService(this); + 1989287        }  288  289        protected IOrganizationService GetFakedOrganizationService(XrmFakedContext context) - 3754290        { - 3754291             if (context.Service != null) + 3760290        { + 3760291             if (context.Service != null)  874292            {  874293                return context.Service;  294            }  295 - 2880296            var fakedService = A.Fake<IOrganizationService>(); + 2886296            var fakedService = A.Fake<IOrganizationService>();  297  298            //Fake CRUD methods - 2880299            FakeRetrieve(context, fakedService); - 2880300            FakeCreate(context, fakedService); - 2880301            FakeUpdate(context, fakedService); - 2880302            FakeDelete(context, fakedService); + 2886299            FakeRetrieve(context, fakedService); + 2886300            FakeCreate(context, fakedService); + 2886301            FakeUpdate(context, fakedService); + 2886302            FakeDelete(context, fakedService);  303  304            //Fake / Intercept Retrieve Multiple Requests - 2880305            FakeRetrieveMultiple(context, fakedService); + 2886305            FakeRetrieveMultiple(context, fakedService);  306  307            //Fake / Intercept other requests - 2880308            FakeExecute(context, fakedService); - 2880309            FakeAssociate(context, fakedService); - 2880310            FakeDisassociate(context, fakedService); - 2880311            context.Service = fakedService; + 2886308            FakeExecute(context, fakedService); + 2886309            FakeAssociate(context, fakedService); + 2886310            FakeDisassociate(context, fakedService); + 2886311            context.Service = fakedService;  312 - 2880313            return context.Service; - 3754314        } + 2886313            return context.Service; + 3760314        }  315  316        /// <summary>  317        /// Fakes the Execute method of the organization service. @@ -1767,89 +1770,89 @@

D:\Git\fake-xrm-easy\  320        /// <param name="context"></param>  321        /// <param name="fakedService"></param>  322        public static void FakeExecute(XrmFakedContext context, IOrganizationService fakedService) - 2880323        { - 2880324            A.CallTo(() => fakedService.Execute(A<OrganizationRequest>._)) - 2880325                .ReturnsLazily((OrganizationRequest req) => - 4782326                { - 4782327                     if (context.ExecutionMocks.ContainsKey(req.GetType())) - 2892328                    { - 2892329                        return context.ExecutionMocks[req.GetType()].Invoke(req); - 2880330                    } - 2880331 - 4770332                     if (context.FakeMessageExecutors.ContainsKey(req.GetType())) - 4770333                    { - 4770334                         if (context.FakeMessageExecutors[req.GetType()].CanExecute(req)) - 4752335                        { - 4752336                            return context.FakeMessageExecutors[req.GetType()].Execute(req, context); - 2880337                        } - 2898338                    } - 2880339 - 2898340                     if (req.GetType() == typeof(OrganizationRequest) && context.GenericFakeMessageExecutors.ContainsKey( - 2892341                    { - 2892342                        return context.GenericFakeMessageExecutors[req.RequestName].Execute(req, context); - 2880343                    } - 2880344 - 2886345                    throw PullRequestException.NotImplementedOrganizationRequest(req.GetType()); - 4514346                }); - 2880347        } + 2886323        { + 2886324            A.CallTo(() => fakedService.Execute(A<OrganizationRequest>._)) + 2886325                .ReturnsLazily((OrganizationRequest req) => + 4788326                { + 4788327                     if (context.ExecutionMocks.ContainsKey(req.GetType())) + 2898328                    { + 2898329                        return context.ExecutionMocks[req.GetType()].Invoke(req); + 2886330                    } + 2886331 + 4776332                     if (context.FakeMessageExecutors.ContainsKey(req.GetType())) + 4776333                    { + 4776334                         if (context.FakeMessageExecutors[req.GetType()].CanExecute(req)) + 4758335                        { + 4758336                            return context.FakeMessageExecutors[req.GetType()].Execute(req, context); + 2886337                        } + 2904338                    } + 2886339 + 2904340                     if (req.GetType() == typeof(OrganizationRequest) && context.GenericFakeMessageExecutors.ContainsKey( + 2898341                    { + 2898342                        return context.GenericFakeMessageExecutors[req.RequestName].Execute(req, context); + 2886343                    } + 2886344 + 2892345                    throw PullRequestException.NotImplementedOrganizationRequest(req.GetType()); + 4520346                }); + 2886347        }  348  349        public static void FakeAssociate(XrmFakedContext context, IOrganizationService fakedService) - 2880350        { - 2880351            A.CallTo(() => fakedService.Associate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollection - 2880352                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC - 2976353                { - 2976354                     if (context.FakeMessageExecutors.ContainsKey(typeof(AssociateRequest))) - 2976355                    { - 2976356                        var request = new AssociateRequest() - 2976357                        { - 2976358                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, - 2976359                            Relationship = relationship, - 2976360                            RelatedEntities = entityCollection - 2976361                        }; - 2976362                        context.FakeMessageExecutors[typeof(AssociateRequest)].Execute(request, context); - 2976363                    } - 2880364                    else - 2880365                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(AssociateRequest)); - 2976366                }); - 2880367        } + 2886350        { + 2886351            A.CallTo(() => fakedService.Associate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollection + 2886352                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC + 2982353                { + 2982354                     if (context.FakeMessageExecutors.ContainsKey(typeof(AssociateRequest))) + 2982355                    { + 2982356                        var request = new AssociateRequest() + 2982357                        { + 2982358                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, + 2982359                            Relationship = relationship, + 2982360                            RelatedEntities = entityCollection + 2982361                        }; + 2982362                        context.FakeMessageExecutors[typeof(AssociateRequest)].Execute(request, context); + 2982363                    } + 2886364                    else + 2886365                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(AssociateRequest)); + 2982366                }); + 2886367        }  368  369        public static void FakeDisassociate(XrmFakedContext context, IOrganizationService fakedService) - 2880370        { - 2880371            A.CallTo(() => fakedService.Disassociate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollect - 2880372                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC - 2898373                { - 2898374                     if (context.FakeMessageExecutors.ContainsKey(typeof(DisassociateRequest))) - 2898375                    { - 2898376                        var request = new DisassociateRequest() - 2898377                        { - 2898378                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, - 2898379                            Relationship = relationship, - 2898380                            RelatedEntities = entityCollection - 2898381                        }; - 2898382                        context.FakeMessageExecutors[typeof(DisassociateRequest)].Execute(request, context); - 2898383                    } - 2880384                    else - 2880385                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(DisassociateRequest)); - 2898386                }); - 2880387        } + 2886370        { + 2886371            A.CallTo(() => fakedService.Disassociate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollect + 2886372                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC + 2904373                { + 2904374                     if (context.FakeMessageExecutors.ContainsKey(typeof(DisassociateRequest))) + 2904375                    { + 2904376                        var request = new DisassociateRequest() + 2904377                        { + 2904378                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, + 2904379                            Relationship = relationship, + 2904380                            RelatedEntities = entityCollection + 2904381                        }; + 2904382                        context.FakeMessageExecutors[typeof(DisassociateRequest)].Execute(request, context); + 2904383                    } + 2886384                    else + 2886385                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(DisassociateRequest)); + 2904386                }); + 2886387        }  388  389        public static void FakeRetrieveMultiple(XrmFakedContext context, IOrganizationService fakedService) - 2880390        { + 2886390        {  391            //refactored from RetrieveMultipleExecutor - 2880392            A.CallTo(() => fakedService.RetrieveMultiple(A<QueryBase>._)) - 2880393                .ReturnsLazily((QueryBase req) => - 4214394                { - 4214395                    var request = new RetrieveMultipleRequest() - 4214396                    { - 4214397                        Query = req - 4214398                    }; - 2880399 - 4214400                    var executor = new RetrieveMultipleRequestExecutor(); - 4214401                    var response = executor.Execute(request, context) as RetrieveMultipleResponse; - 2880402 - 4182403                    return response.EntityCollection; - 4182404                }); - 2880405        } + 2886392            A.CallTo(() => fakedService.RetrieveMultiple(A<QueryBase>._)) + 2886393                .ReturnsLazily((QueryBase req) => + 4220394                { + 4220395                    var request = new RetrieveMultipleRequest() + 4220396                    { + 4220397                        Query = req + 4220398                    }; + 2886399 + 4220400                    var executor = new RetrieveMultipleRequestExecutor(); + 4220401                    var response = executor.Execute(request, context) as RetrieveMultipleResponse; + 2886402 + 4188403                    return response.EntityCollection; + 4188404                }); + 2886405        }  406  407        public IServiceEndpointNotificationService GetFakedServiceEndpointNotificationService()  12408        { @@ -1872,61 +1875,61 @@

D:\Git\fake-x  6{  7    public partial class XrmFakedContext : IXrmContext  8    { - 38559        public TimeZoneInfo SystemTimeZone { get; set; } + 38619        public TimeZoneInfo SystemTimeZone { get; set; }  10 - 2691911        public Dictionary<string, Dictionary<string, DateTimeAttributeBehavior>> DateBehaviour { get; set; } + 2694111        public Dictionary<string, Dictionary<string, DateTimeAttributeBehavior>> DateBehaviour { get; set; }  12  13        private static Dictionary<string, Dictionary<string, DateTimeAttributeBehavior>> DefaultDateBehaviour() - 385514        { + 386114        {  15#if FAKE_XRM_EASY || FAKE_XRM_EASY_2013 - 124616            return new Dictionary<string, Dictionary<string, DateTimeAttributeBehavior>>(); + 124816            return new Dictionary<string, Dictionary<string, DateTimeAttributeBehavior>>();  17#else - 260918            return new Dictionary<string, Dictionary<string, DateTimeAttributeBehavior>> - 260919            { - 260920                { - 260921                    "contact", new Dictionary<string, DateTimeAttributeBehavior> - 260922                    { - 260923                        { "anniversary", DateTimeAttributeBehavior.DateOnly }, - 260924                        { "birthdate", DateTimeAttributeBehavior.DateOnly } - 260925                    } - 260926                }, - 260927                { - 260928                    "invoice", new Dictionary<string, DateTimeAttributeBehavior> - 260929                    { - 260930                        { "duedate", DateTimeAttributeBehavior.DateOnly } - 260931                    } - 260932                }, - 260933                { - 260934                    "lead", new Dictionary<string, DateTimeAttributeBehavior> - 260935                    { - 260936                        { "estimatedclosedate", DateTimeAttributeBehavior.DateOnly } - 260937                    } - 260938                }, - 260939                { - 260940                    "opportunity", new Dictionary<string, DateTimeAttributeBehavior> - 260941                    { - 260942                        { "actualclosedate", DateTimeAttributeBehavior.DateOnly }, - 260943                        { "estimatedclosedate", DateTimeAttributeBehavior.DateOnly }, - 260944                        { "finaldecisiondate", DateTimeAttributeBehavior.DateOnly } - 260945                    } - 260946                }, - 260947                { - 260948                    "product", new Dictionary<string, DateTimeAttributeBehavior> - 260949                    { - 260950                        { "validfromdate", DateTimeAttributeBehavior.DateOnly }, - 260951                        { "validtodate", DateTimeAttributeBehavior.DateOnly } - 260952                    } - 260953                }, - 260954                { - 260955                    "quote", new Dictionary<string, DateTimeAttributeBehavior> - 260956                    { - 260957                        { "closedon", DateTimeAttributeBehavior.DateOnly }, - 260958                        { "dueby", DateTimeAttributeBehavior.DateOnly } - 260959                    } - 260960                } - 260961            }; + 261318            return new Dictionary<string, Dictionary<string, DateTimeAttributeBehavior>> + 261319            { + 261320                { + 261321                    "contact", new Dictionary<string, DateTimeAttributeBehavior> + 261322                    { + 261323                        { "anniversary", DateTimeAttributeBehavior.DateOnly }, + 261324                        { "birthdate", DateTimeAttributeBehavior.DateOnly } + 261325                    } + 261326                }, + 261327                { + 261328                    "invoice", new Dictionary<string, DateTimeAttributeBehavior> + 261329                    { + 261330                        { "duedate", DateTimeAttributeBehavior.DateOnly } + 261331                    } + 261332                }, + 261333                { + 261334                    "lead", new Dictionary<string, DateTimeAttributeBehavior> + 261335                    { + 261336                        { "estimatedclosedate", DateTimeAttributeBehavior.DateOnly } + 261337                    } + 261338                }, + 261339                { + 261340                    "opportunity", new Dictionary<string, DateTimeAttributeBehavior> + 261341                    { + 261342                        { "actualclosedate", DateTimeAttributeBehavior.DateOnly }, + 261343                        { "estimatedclosedate", DateTimeAttributeBehavior.DateOnly }, + 261344                        { "finaldecisiondate", DateTimeAttributeBehavior.DateOnly } + 261345                    } + 261346                }, + 261347                { + 261348                    "product", new Dictionary<string, DateTimeAttributeBehavior> + 261349                    { + 261350                        { "validfromdate", DateTimeAttributeBehavior.DateOnly }, + 261351                        { "validtodate", DateTimeAttributeBehavior.DateOnly } + 261352                    } + 261353                }, + 261354                { + 261355                    "quote", new Dictionary<string, DateTimeAttributeBehavior> + 261356                    { + 261357                        { "closedon", DateTimeAttributeBehavior.DateOnly }, + 261358                        { "dueby", DateTimeAttributeBehavior.DateOnly } + 261359                    } + 261360                } + 261361            };  62#endif - 385563        } + 386163        }  64    }  65} @@ -1948,22 +1951,22 @@

D:\Git\fake-x  11        /// <summary>  12        /// Stores some minimal metadata info if dynamic entities are used and no injected metadata was used  13        /// </summary> - 243643514        protected internal Dictionary<string, Dictionary<string, string>> AttributeMetadataNames { get; set; } + 243926914        protected internal Dictionary<string, Dictionary<string, string>> AttributeMetadataNames { get; set; }  15  16        /// <summary>  17        /// Stores fake global option set metadata  18        /// </summary> - 402919        public Dictionary<string, OptionSetMetadata> OptionSetValuesMetadata { get; set; } + 403519        public Dictionary<string, OptionSetMetadata> OptionSetValuesMetadata { get; set; }  20  21        /// <summary>  22        /// Stores fake global status values metadata  23        /// </summary> - 388524        public Dictionary<string, StatusAttributeMetadata> StatusAttributeMetadata { get; set; } + 389124        public Dictionary<string, StatusAttributeMetadata> StatusAttributeMetadata { get; set; }  25  26        /// <summary>  27        /// Stores fake entity metadata  28        /// </summary> - 532029        protected internal Dictionary<string, EntityMetadata> EntityMetadata { get; set; } + 532629        protected internal Dictionary<string, EntityMetadata> EntityMetadata { get; set; }  30  31  32        public void InitializeMetadata(IEnumerable<EntityMetadata> entityMetadataList) @@ -2057,7 +2060,7 @@

D:\Git\fake-x  9{  10    public partial class XrmFakedContext : IXrmContext  11    { - 589912        public bool UsePipelineSimulation { get; set; } + 591712        public bool UsePipelineSimulation { get; set; }  13  14        /// <summary>  15        /// Registers the <typeparamref name="TPlugin"/> as a SDK Message Processing Step for the Entity <typeparamref n @@ -2690,12 +2693,12 @@

D:\Git\fake-xr  21    public partial class XrmFakedContext : IXrmContext  22    {  23        protected internal Type FindReflectedType(string logicalName) - 2759124        { - 2759125            var types = - 7884126                ProxyTypesAssemblies.Select(a => FindReflectedType(logicalName, a)) - 7884127                                    .Where(t => t != null); + 2762124        { + 2762125            var types = + 7893126                ProxyTypesAssemblies.Select(a => FindReflectedType(logicalName, a)) + 7893127                                    .Where(t => t != null);  28 - 2759129             if(types.Count() > 1) { + 2762129             if(types.Count() > 1) {  030                var errorMsg = $"Type { logicalName } is defined in multiple assemblies: ";  031                foreach(var type in types) {  032                    errorMsg += type.Assembly @@ -2707,8 +2710,8 @@

D:\Git\fake-xr  038                throw new InvalidOperationException(errorMsg);  39            }  40 - 2759141            return types.SingleOrDefault(); - 2759142        } + 2762141            return types.SingleOrDefault(); + 2762142        }  43  44        /// <summary>  45        /// Finds reflected type for given entity from given assembly. @@ -2727,10 +2730,10 @@

D:\Git\fake-xr  58        /// </returns>  59        private static Type FindReflectedType(string logicalName,  60                                              Assembly assembly) - 5125061        { + 5131061        {  62            try - 5125063            { - 5125064                 if (assembly == null) + 5131063            { + 5131064                 if (assembly == null)  065                {  066                    throw new ArgumentNullException(nameof(assembly));  67                } @@ -2742,13 +2745,13 @@

D:\Git\fake-xr  73                        .FirstOrDefault(t => t.GetCustomAttributes<EntityLogicalNameAttribute>(true).First().LogicalName  74  75                */ - 5125076                var subClassType = assembly.GetTypes() - 689303877                        .Where(t => typeof(Entity).IsAssignableFrom(t)) - 420056278                        .Where(t => t.GetCustomAttributes(typeof(EntityLogicalNameAttribute), true).Length > 0) - 420056279                        .Where(t => ((EntityLogicalNameAttribute)t.GetCustomAttributes(typeof(EntityLogicalNameAttribute - 5125080                        .FirstOrDefault(); + 5131076                var subClassType = assembly.GetTypes() + 689453877                        .Where(t => typeof(Entity).IsAssignableFrom(t)) + 420068278                        .Where(t => t.GetCustomAttributes(typeof(EntityLogicalNameAttribute), true).Length > 0) + 420068279                        .Where(t => ((EntityLogicalNameAttribute)t.GetCustomAttributes(typeof(EntityLogicalNameAttribute + 5131080                        .FirstOrDefault();  81 - 5125082                return subClassType; + 5131082                return subClassType;  83            }  084            catch (ReflectionTypeLoadException exception)  085            { @@ -2762,7 +2765,7 @@

D:\Git\fake-xr  93  094                throw new Exception("XrmFakedContext.FindReflectedType: " + s);  95            } - 5125096        } + 5131096        }  97  98        protected internal Type FindAttributeTypeInInjectedMetadata(string sEntityName, string sAttributeName)  1499        { @@ -2907,7 +2910,7 @@

D:\Git\fake-xr  238        private static PropertyInfo GetEarlyBoundTypeAttribute(Type earlyBoundType, string attributeName)  3179239        {  3179240            var attributeInfo = earlyBoundType.GetProperties() - 196742241                .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0) + 196827241                .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0)  190500242                .Where(pi => (pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true)[0] as AttributeLogical  3179243                .FirstOrDefault();  244 @@ -4690,6 +4693,6 @@

D:\Git\fake-xr  2021} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm b/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm index 176efa44..bd0b0e92 100644 --- a/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm +++ b/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm @@ -149,6 +149,6 @@

D:\Git  113} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedRelationship.htm b/test/reports/FakeXrmEasy_XrmFakedRelationship.htm index 40fd449e..efa0b582 100644 --- a/test/reports/FakeXrmEasy_XrmFakedRelationship.htm +++ b/test/reports/FakeXrmEasy_XrmFakedRelationship.htm @@ -102,6 +102,6 @@

D:\Git\fake-xrm-  64} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedTracingService.htm b/test/reports/FakeXrmEasy_XrmFakedTracingService.htm index 2357379a..37d02549 100644 --- a/test/reports/FakeXrmEasy_XrmFakedTracingService.htm +++ b/test/reports/FakeXrmEasy_XrmFakedTracingService.htm @@ -74,6 +74,6 @@

D:\Git\fake-xr  35} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm b/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm index bffb38a9..1fefdeb2 100644 --- a/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm +++ b/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm @@ -98,6 +98,6 @@

D:\Git\fake-x  69} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm b/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm index 3bc5286a..dcf4178c 100644 --- a/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm +++ b/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm @@ -132,6 +132,6 @@

D:\Git\fa  95} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmRealContext.htm b/test/reports/FakeXrmEasy_XrmRealContext.htm index 02ebb6f5..dcfdbe3f 100644 --- a/test/reports/FakeXrmEasy_XrmRealContext.htm +++ b/test/reports/FakeXrmEasy_XrmRealContext.htm @@ -175,6 +175,6 @@

D:\Git\fake-xrm-easy\F  132} - + \ No newline at end of file diff --git a/test/reports/combined.js b/test/reports/combined.js index de553d2c..35c8fc4a 100644 --- a/test/reports/combined.js +++ b/test/reports/combined.js @@ -316,7 +316,7 @@ var assemblies = [ "classes" : [ { "name" : "FakeXrmEasy.Extensions.ArrayExtensions", "reportPath" : "FakeXrmEasy_ArrayExtensions.htm", "coveredLines" : 6, "uncoveredLines" : 0, "coverableLines" : 6, "totalLines" : 172, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 4, "totalBranches" : 4, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.ArrayTraverse", "reportPath" : "FakeXrmEasy_ArrayTraverse.htm", "coveredLines" : 20, "uncoveredLines" : 3, "coverableLines" : 23, "totalLines" : 172, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 7, "totalBranches" : 8, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "FakeXrmEasy.Extensions.EntityExtensions", "reportPath" : "FakeXrmEasy_EntityExtensions.htm", "coveredLines" : 270, "uncoveredLines" : 81, "coverableLines" : 351, "totalLines" : 534, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 176, "totalBranches" : 214, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "FakeXrmEasy.Extensions.EntityExtensions", "reportPath" : "FakeXrmEasy_EntityExtensions.htm", "coveredLines" : 277, "uncoveredLines" : 81, "coverableLines" : 358, "totalLines" : 542, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 174, "totalBranches" : 212, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.EntityMetadataExtensions", "reportPath" : "FakeXrmEasy_EntityMetadataExtensions.htm", "coveredLines" : 23, "uncoveredLines" : 0, "coverableLines" : 23, "totalLines" : 47, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 2, "totalBranches" : 2, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.EntityReferenceExtensions", "reportPath" : "FakeXrmEasy_EntityReferenceExtensions.htm", "coveredLines" : 4, "uncoveredLines" : 3, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 1, "totalBranches" : 2, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.FetchXml.XmlExtensionsForFetchXml", "reportPath" : "FakeXrmEasy_XmlExtensionsForFetchXml.htm", "coveredLines" : 462, "uncoveredLines" : 31, "coverableLines" : 493, "totalLines" : 796, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 295, "totalBranches" : 465, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, @@ -377,7 +377,7 @@ var assemblies = [ { "name" : "FakeXrmEasy.Services.DefaultEntityInitializerService", "reportPath" : "FakeXrmEasy_DefaultEntityInitializerService.htm", "coveredLines" : 36, "uncoveredLines" : 3, "coverableLines" : 39, "totalLines" : 74, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 10, "totalBranches" : 10, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Services.InvoiceDetailInitializerService", "reportPath" : "FakeXrmEasy_InvoiceDetailInitializerService.htm", "coveredLines" : 75, "uncoveredLines" : 3, "coverableLines" : 78, "totalLines" : 123, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 32, "totalBranches" : 32, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Services.InvoiceInitializerService", "reportPath" : "FakeXrmEasy_InvoiceInitializerService.htm", "coveredLines" : 7, "uncoveredLines" : 3, "coverableLines" : 10, "totalLines" : 28, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 1, "totalBranches" : 2, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "FakeXrmEasy.XrmFakedContext", "reportPath" : "FakeXrmEasy_XrmFakedContext.htm", "coveredLines" : 2405, "uncoveredLines" : 313, "coverableLines" : 2718, "totalLines" : 4448, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 719, "totalBranches" : 989, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "FakeXrmEasy.XrmFakedContext", "reportPath" : "FakeXrmEasy_XrmFakedContext.htm", "coveredLines" : 2409, "uncoveredLines" : 313, "coverableLines" : 2722, "totalLines" : 4451, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 721, "totalBranches" : 991, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.XrmFakedPluginExecutionContext", "reportPath" : "FakeXrmEasy_XrmFakedPluginExecutionContext.htm", "coveredLines" : 34, "uncoveredLines" : 3, "coverableLines" : 37, "totalLines" : 113, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.XrmFakedRelationship", "reportPath" : "FakeXrmEasy_XrmFakedRelationship.htm", "coveredLines" : 27, "uncoveredLines" : 0, "coverableLines" : 27, "totalLines" : 64, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.XrmFakedTracingService", "reportPath" : "FakeXrmEasy_XrmFakedTracingService.htm", "coveredLines" : 18, "uncoveredLines" : 0, "coverableLines" : 18, "totalLines" : 35, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 2, "totalBranches" : 2, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, diff --git a/test/reports/index.htm b/test/reports/index.htm index 0948e0f5..183637a6 100644 --- a/test/reports/index.htm +++ b/test/reports/index.htm @@ -12,15 +12,15 @@

Summary

-Generated on:05/02/2019 - 12:12:42 +Generated on:07/02/2019 - 19:02:30 Parser:MultiReportParser (6x OpenCoverParser) Assemblies:1 Classes:70 Files:75 -Covered lines:5424 +Covered lines:5435 Uncovered lines:614 -Coverable lines:6038 -Total lines:10812 +Coverable lines:6049 +Total lines:10823 Line coverage:89.8% Branch coverage:73.7% @@ -44,10 +44,10 @@

Assemblies

NameCoveredUncoveredCoverableTotalLine coverageBranch coverage -FakeXrmEasy542461460381081289.8%
  
73.7%
  
+FakeXrmEasy543561460491082389.8%
  
73.7%
  
FakeXrmEasy.Extensions.ArrayExtensions606172100%
 
100%
 
FakeXrmEasy.Extensions.ArrayTraverse2032317286.9%
  
87.5%
  
-FakeXrmEasy.Extensions.EntityExtensions2708135153476.9%
  
82.2%
  
+FakeXrmEasy.Extensions.EntityExtensions2778135854277.3%
  
82%
  
FakeXrmEasy.Extensions.EntityMetadataExtensions2302347100%
 
100%
 
FakeXrmEasy.Extensions.EntityReferenceExtensions4372457.1%
  
50%
  
FakeXrmEasy.Extensions.FetchXml.XmlExtensionsForFetchXml4623149379693.7%
  
63.4%
  
@@ -108,7 +108,7 @@

Assemblies

FakeXrmEasy.Services.DefaultEntityInitializerService363397492.3%
  
100%
 
FakeXrmEasy.Services.InvoiceDetailInitializerService7537812396.1%
  
100%
 
FakeXrmEasy.Services.InvoiceInitializerService73102870%
  
50%
  
-FakeXrmEasy.XrmFakedContext24053132718444888.4%
  
72.6%
  
+FakeXrmEasy.XrmFakedContext24093132722445188.5%
  
72.7%
  
FakeXrmEasy.XrmFakedPluginExecutionContext3433711391.8%
  
 
FakeXrmEasy.XrmFakedRelationship2702764100%
 
 
FakeXrmEasy.XrmFakedTracingService1801835100%
 
100%
 
@@ -117,6 +117,6 @@

Assemblies

FakeXrmEasy.XrmRealContext5926113296.7%
  
70%
  
- + \ No newline at end of file