From 0a98d48ffcd15d01de2621a759af00b9910bf738 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 23 May 2017 21:03:11 +0200 Subject: [PATCH] Updated version --- DevToolkitSamples/Properties/AssemblyInfo.cs | 6 +- FakeXrmEasy.2013/Properties/AssemblyInfo.cs | 6 +- FakeXrmEasy.2015/Properties/AssemblyInfo.cs | 6 +- FakeXrmEasy.2016/Properties/AssemblyInfo.cs | 6 +- FakeXrmEasy.365/Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- FakeXrmEasy.Tests/Properties/AssemblyInfo.cs | 6 +- FakeXrmEasy/Properties/AssemblyInfo.cs | 6 +- Install-scripts/2011/Install.ps1 | 2 +- Install-scripts/2013/Install.ps1 | 2 +- Install-scripts/2015/Install.ps1 | 2 +- Install-scripts/2016/Install.ps1 | 2 +- Install-scripts/365/Install.ps1 | 2 +- README.md | 12 +- build.fsx | 4 +- .../FakeXrmEasy_AssignRequestExecutor.htm | 8 +- .../FakeXrmEasy_AssociateRequestExecutor.htm | 8 +- .../FakeXrmEasy_CreateRequestExecutor.htm | 8 +- .../FakeXrmEasy_DeleteRequestExecutor.htm | 8 +- ...akeXrmEasy_DisassociateRequestExecutor.htm | 8 +- test/reports/FakeXrmEasy_EntityExtensions.htm | 515 +++---- ...XrmEasy_ExecuteMultipleRequestExecutor.htm | 8 +- ...FakeXrmEasy_ExecuteTransactionExecutor.htm | 8 +- ...mEasy_InsertOptionValueRequestExecutor.htm | 8 +- ...eFaultQueryBuilderNoAttributeException.htm | 2 +- .../FakeXrmEasy_PublishXmlRequestExecutor.htm | 8 +- .../FakeXrmEasy_PullRequestException.htm | 2 +- ...mEasy_RetrieveAttributeRequestExecutor.htm | 8 +- ...rmEasy_RetrieveMultipleRequestExecutor.htm | 94 +- .../FakeXrmEasy_SetStateRequestExecutor.htm | 8 +- test/reports/FakeXrmEasy_TypeExtensions.htm | 24 +- .../FakeXrmEasy_UpdateRequestExecutor.htm | 8 +- .../FakeXrmEasy_WhoAmIRequestExecutor.htm | 8 +- .../FakeXrmEasy_XmlExtensionsForFetchXml.htm | 2 +- test/reports/FakeXrmEasy_XrmFakedContext.htm | 1361 +++++++++-------- ...XrmEasy_XrmFakedPluginExecutionContext.htm | 2 +- .../FakeXrmEasy_XrmFakedRelationship.htm | 2 +- .../FakeXrmEasy_XrmFakedTracingService.htm | 2 +- .../FakeXrmEasy_XrmFakedWorkflowContext.htm | 2 +- ...akeXrmEasy_XrmOrderByAttributeComparer.htm | 2 +- test/reports/badge_branchcoverage.svg | 2 +- test/reports/badge_combined.svg | 4 +- test/reports/badge_linecoverage.svg | 2 +- test/reports/combined.js | 6 +- test/reports/index.htm | 24 +- 48 files changed, 1134 insertions(+), 1110 deletions(-) diff --git a/DevToolkitSamples/Properties/AssemblyInfo.cs b/DevToolkitSamples/Properties/AssemblyInfo.cs index 451f9887..7c986ad1 100644 --- a/DevToolkitSamples/Properties/AssemblyInfo.cs +++ b/DevToolkitSamples/Properties/AssemblyInfo.cs @@ -33,6 +33,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.2013/Properties/AssemblyInfo.cs b/FakeXrmEasy.2013/Properties/AssemblyInfo.cs index 3c66551e..63d051af 100644 --- a/FakeXrmEasy.2013/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.2013/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.2015/Properties/AssemblyInfo.cs b/FakeXrmEasy.2015/Properties/AssemblyInfo.cs index 33ee174a..4b1064ef 100644 --- a/FakeXrmEasy.2015/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.2015/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.2016/Properties/AssemblyInfo.cs b/FakeXrmEasy.2016/Properties/AssemblyInfo.cs index 7db3d7b9..4d4780a6 100644 --- a/FakeXrmEasy.2016/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.2016/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.365/Properties/AssemblyInfo.cs b/FakeXrmEasy.365/Properties/AssemblyInfo.cs index 4376fcd3..1d3d7280 100644 --- a/FakeXrmEasy.365/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.365/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs index f4299d0c..a8c71e1a 100644 --- a/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.2013/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs index d6b4282f..1f74079b 100644 --- a/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.2015/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs index 8b730306..6662915e 100644 --- a/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.2016/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs index acc367b3..772bf43e 100644 --- a/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests.365/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs b/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs index 6d6569fb..4df17999 100644 --- a/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy.Tests/Properties/AssemblyInfo.cs @@ -31,6 +31,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.29.2.0")] -[assembly: AssemblyVersion("1.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] +// [assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] diff --git a/FakeXrmEasy/Properties/AssemblyInfo.cs b/FakeXrmEasy/Properties/AssemblyInfo.cs index 9ca727f7..074d8495 100644 --- a/FakeXrmEasy/Properties/AssemblyInfo.cs +++ b/FakeXrmEasy/Properties/AssemblyInfo.cs @@ -32,6 +32,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.29.2.0")] -[assembly: AssemblyFileVersion("1.29.2.0")] -[assembly: AssemblyInformationalVersion("1.29.2.0 - master - ed2e7f")] +[assembly: AssemblyVersion("1.29.3.0")] +[assembly: AssemblyFileVersion("1.29.3.0")] +[assembly: AssemblyInformationalVersion("1.29.3.0 - master - e4e64b")] diff --git a/Install-scripts/2011/Install.ps1 b/Install-scripts/2011/Install.ps1 index d6a9a55d..db5ed8ae 100644 --- a/Install-scripts/2011/Install.ps1 +++ b/Install-scripts/2011/Install.ps1 @@ -1,4 +1,4 @@ param($installPath, $toolsPath, $package, $project) -$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2011?version=1.29.2") +$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2011?version=1.29.3") diff --git a/Install-scripts/2013/Install.ps1 b/Install-scripts/2013/Install.ps1 index c6640bad..4f2f8069 100644 --- a/Install-scripts/2013/Install.ps1 +++ b/Install-scripts/2013/Install.ps1 @@ -1,3 +1,3 @@ param($installPath, $toolsPath, $package, $project) -$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2013?version=1.29.2") +$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2013?version=1.29.3") diff --git a/Install-scripts/2015/Install.ps1 b/Install-scripts/2015/Install.ps1 index 6f774caf..0c47b77b 100644 --- a/Install-scripts/2015/Install.ps1 +++ b/Install-scripts/2015/Install.ps1 @@ -1,4 +1,4 @@ param($installPath, $toolsPath, $package, $project) -$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2015?version=1.29.2") +$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2015?version=1.29.3") diff --git a/Install-scripts/2016/Install.ps1 b/Install-scripts/2016/Install.ps1 index e4c2c5c9..f0ffc2f7 100644 --- a/Install-scripts/2016/Install.ps1 +++ b/Install-scripts/2016/Install.ps1 @@ -1,4 +1,4 @@ param($installPath, $toolsPath, $package, $project) -$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2016?version=1.29.2") +$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-2016?version=1.29.3") diff --git a/Install-scripts/365/Install.ps1 b/Install-scripts/365/Install.ps1 index b745db74..2d032287 100644 --- a/Install-scripts/365/Install.ps1 +++ b/Install-scripts/365/Install.ps1 @@ -1,4 +1,4 @@ param($installPath, $toolsPath, $package, $project) -$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-365?version=1.29.2") +$DTE.ItemOperations.Navigate("http://dynamicsvalue.com/get-started/nuget-install-365?version=1.29.3") diff --git a/README.md b/README.md index 1b489df7..2afd052f 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ |Build|Line Coverage|Branch Coverage| |-----------|-----|-----------------| -|[![Build status](https://ci.appveyor.com/api/projects/status/2g8yc8jg817746du?svg=true)](https://ci.appveyor.com/project/Jordi/fake-xrm-easy)|[![Line coverage](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/badge_linecoverage.svg?v=1.29.2)](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/index.htm?v=1.29.2)|[![Branch coverage](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/badge_branchcoverage.svg?v=1.29.2)](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/index.htm?v=1.29.2)| +|[![Build status](https://ci.appveyor.com/api/projects/status/2g8yc8jg817746du?svg=true)](https://ci.appveyor.com/project/Jordi/fake-xrm-easy)|[![Line coverage](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/badge_linecoverage.svg?v=1.29.3)](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/index.htm?v=1.29.3)|[![Branch coverage](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/badge_branchcoverage.svg?v=1.29.3)](https://cdn.rawgit.com/jordimontana82/fake-xrm-easy/master/test/reports/index.htm?v=1.29.3)| |Version|NuGet| |-----------|-----| -|Dynamics 365|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.365?v=1.29.2)](https://www.nuget.org/packages/fakexrmeasy.365)| -|Dynamics CRM 2016|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.2016?v=1.29.2)](https://www.nuget.org/packages/fakexrmeasy.2016)| -|Dynamics CRM 2015|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.2015?v=1.29.2)](https://www.nuget.org/packages/fakexrmeasy.2015)| -|Dynamics CRM 2013|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.2013?v=1.29.2)](https://www.nuget.org/packages/fakexrmeasy.2013)| -|Dynamics CRM 2011|[![Nuget](https://buildstats.info/nuget/fakexrmeasy?v=1.29.2)](https://www.nuget.org/packages/fakexrmeasy)| +|Dynamics 365|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.365?v=1.29.3)](https://www.nuget.org/packages/fakexrmeasy.365)| +|Dynamics CRM 2016|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.2016?v=1.29.3)](https://www.nuget.org/packages/fakexrmeasy.2016)| +|Dynamics CRM 2015|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.2015?v=1.29.3)](https://www.nuget.org/packages/fakexrmeasy.2015)| +|Dynamics CRM 2013|[![Nuget](https://buildstats.info/nuget/fakexrmeasy.2013?v=1.29.3)](https://www.nuget.org/packages/fakexrmeasy.2013)| +|Dynamics CRM 2011|[![Nuget](https://buildstats.info/nuget/fakexrmeasy?v=1.29.3)](https://www.nuget.org/packages/fakexrmeasy)| The framework to streamline unit testing in Dynamics CRM by faking the IOrganizationService to work with an In-Memory context. diff --git a/build.fsx b/build.fsx index 15650da7..7125497e 100644 --- a/build.fsx +++ b/build.fsx @@ -45,8 +45,8 @@ let nugetDeployDir = @"[Enter_NuGet_Url]" let packagesDir = @".\packages\" let nuGetCommandLine = @".\tools\nuget\nuget286.exe" -let mutable previousVersion = "1.29.1" -let mutable version = "1.29.2" //Copy this into previousVersion before publishing packages... +let mutable previousVersion = "1.29.2" +let mutable version = "1.29.3" //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_AssignRequestExecutor.htm b/test/reports/FakeXrmEasy_AssignRequestExecutor.htm index 5ce4e30c..beb19dfe 100644 --- a/test/reports/FakeXrmEasy_AssignRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AssignRequestExecutor.htm @@ -89,13 +89,13 @@

 550        }  51  52        public Type GetResponsibleRequestType() - 220953        { - 220954            return typeof (AssignRequest); - 220955        } + 221453        { + 221454            return typeof (AssignRequest); + 221455        }  56    }  57} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm b/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm index 429d4a14..9c83a327 100644 --- a/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_AssociateRequestExecutor.htm @@ -141,13 +141,13 @@

 115102        }  103  104        public Type GetResponsibleRequestType() - 2209105        { - 2209106            return typeof(AssociateRequest); - 2209107        } + 2214105        { + 2214106            return typeof(AssociateRequest); + 2214107        }  108    }  109} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_CreateRequestExecutor.htm b/test/reports/FakeXrmEasy_CreateRequestExecutor.htm index 1b9b8aa4..2ad30e11 100644 --- a/test/reports/FakeXrmEasy_CreateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_CreateRequestExecutor.htm @@ -67,13 +67,13 @@

 10229        }  30  31        public Type GetResponsibleRequestType() - 220932        { - 220933            return typeof(CreateRequest); - 220934        } + 221432        { + 221433            return typeof(CreateRequest); + 221434        }  35    }  36} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm b/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm index 84135650..70f4f243 100644 --- a/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_DeleteRequestExecutor.htm @@ -71,13 +71,13 @@

 532        }  33  34        public Type GetResponsibleRequestType() - 220935        { - 220936            return typeof(DeleteRequest); - 220937        } + 221435        { + 221436            return typeof(DeleteRequest); + 221437        }  38    }  39} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm b/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm index 260ef818..112c72dc 100644 --- a/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_DisassociateRequestExecutor.htm @@ -108,13 +108,13 @@

 2069        }  70  71        public Type GetResponsibleRequestType() - 220972        { - 220973            return typeof(DisassociateRequest); - 220974        } + 221472        { + 221473            return typeof(DisassociateRequest); + 221474        }  75    }  76} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_EntityExtensions.htm b/test/reports/FakeXrmEasy_EntityExtensions.htm index a4a0ad4c..f363f0a4 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):C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\Extensions\EntityExtensions.cs -Covered lines:202 +Covered lines:205 Uncovered lines:60 -Coverable lines:262 -Total lines:405 -Line coverage:77% -Branch coverage:79.7% +Coverable lines:265 +Total lines:408 +Line coverage:77.3% +Branch coverage:78.7%

Metrics

@@ -32,9 +32,9 @@

Metrics

ProjectAttributes(...)11100100 ProjectAttributes(...)1293.0284.62 CloneAttribute(...)2194.4491.89 -Clone(...)891.3080 +Clone(...)891.3060 Clone(...)100 -Clone(...)910085.71 +Clone(...)810085.71 JoinAttributes(...)945.7144.44 JoinAttributes(...)1000 KeySelector(...)893.1092.31 @@ -88,10 +88,10 @@

C:\Code\f  8039        }  40  41        public static void ProjectAttributes(Entity e, Entity projected, LinkEntity le, XrmFakedContext context) - 45542        { - 45543             var sAlias = string.IsNullOrWhiteSpace(le.EntityAlias) ? le.LinkToEntityName : le.EntityAlias; + 46042        { + 46043             var sAlias = string.IsNullOrWhiteSpace(le.EntityAlias) ? le.LinkToEntityName : le.EntityAlias;  44 - 45545             if (le.Columns.AllColumns) + 46045             if (le.Columns.AllColumns)  1046            {  52047                foreach (var attKey in e.Attributes.Keys)  24548                { @@ -102,38 +102,38 @@

C:\Code\f  24553                }  1054            }  55            else - 44556            { - 175557                foreach (var attKey in le.Columns.Columns) - 21058                { + 45056            { + 178057                foreach (var attKey in le.Columns.Columns) + 21558                {  59 - 21060                    var linkedAttKey = sAlias + "." + attKey; - 21061                     if (e.Attributes.ContainsKey(linkedAttKey)) + 21560                    var linkedAttKey = sAlias + "." + attKey; + 21561                     if (e.Attributes.ContainsKey(linkedAttKey))  19062                        projected[linkedAttKey] = e[linkedAttKey]; - 21063                } - 44564            } + 21563                } + 45064            }  65  66 - 140567            foreach (var nestedLinkedEntity in le.LinkEntities) + 142067            foreach (var nestedLinkedEntity in le.LinkEntities)  2068            {  2069                ProjectAttributes(e, projected, nestedLinkedEntity, context);  2070            } - 45571        } + 46071        }  72  73        public static Entity ProjectAttributes(this Entity e, QueryExpression qe, XrmFakedContext context) - 243774        { - 243775             if (qe.ColumnSet == null) return e; + 244274        { + 244275             if (qe.ColumnSet == null) return e;  76 - 243777             if (qe.ColumnSet.AllColumns) + 244277             if (qe.ColumnSet.AllColumns)  109878            {  109879                return e; //return all the original attributes  80            }  81            else - 133982            { + 134482            {  83                //Return selected list of attributes in a projected entity - 133984                Entity projected = null; + 134484                Entity projected = null;  85  86                //However, if we are using proxy types, we must create a instance of the appropiate class - 133987                 if (context.ProxyTypesAssembly != null) + 134487                 if (context.ProxyTypesAssembly != null)  107988                {  107989                    var subClassType = context.FindReflectedType(e.LogicalName);  107990                     if (subClassType != null) @@ -146,9 +146,9 @@

C:\Code\f  097                        projected = new Entity(e.LogicalName) { Id = e.Id }; //fallback to generic type if type not foun  107998                }  99                else - 260100                    projected = new Entity(e.LogicalName) { Id = e.Id }; + 265100                    projected = new Entity(e.LogicalName) { Id = e.Id };  101 - 8467102                foreach (var attKey in qe.ColumnSet.Columns) + 8482102                foreach (var attKey in qe.ColumnSet.Columns)  2230103                {  104                    //Check if attribute really exists in metadata  2230105                     if (!context.AttributeExistsInMetadata(e.LogicalName, attKey)) @@ -163,113 +163,113 @@

C:\Code\f  2220114                }  115  116                //Plus attributes from joins - 4857117                foreach(var le in qe.LinkEntities) - 435118                { - 435119                    ProjectAttributes(e, projected, le, context); - 435120                } + 4882117                foreach(var le in qe.LinkEntities) + 440118                { + 440119                    ProjectAttributes(e, projected, le, context); + 440120                }  121                //foreach (var attKey in e.Attributes.Keys)  122                //{  123                //    if(e[attKey] is AliasedValue && !projected.Attributes.ContainsKey(attKey))  124                //        projected[attKey] = e[attKey];  125                //} - 1329126                return projected; + 1334126                return projected;  127            } - 2427128        } + 2432128        }  129  130        public static object CloneAttribute(object attributeValue) - 214186131        { - 214186132             if (attributeValue == null) - 48235133                return null; + 214471131        { + 214471132             if (attributeValue == null) + 48300133                return null;  134 - 165951135            var type = attributeValue.GetType(); - 165951136             if (type == typeof(string)) + 166171135            var type = attributeValue.GetType(); + 166171136             if (type == typeof(string))  10056137                return new string((attributeValue as string).ToCharArray());  138 - 155895139             else if (type == typeof(EntityReference) - 155895140                    #if FAKE_XRM_EASY - 155895141                            || type == typeof(Microsoft.Xrm.Client.CrmEntityReference) - 155895142                    #endif - 155895143                    ) - 48315144            { - 48315145                var original = (attributeValue as EntityReference); - 48315146                var clone = new EntityReference(original.LogicalName, original.Id); - 48315147                clone.Name = CloneAttribute(original.Name) as string; - 48315148                return clone; + 156115139             else if (type == typeof(EntityReference) + 156115140                    #if FAKE_XRM_EASY + 156115141                            || type == typeof(Microsoft.Xrm.Client.CrmEntityReference) + 156115142                    #endif + 156115143                    ) + 48380144            { + 48380145                var original = (attributeValue as EntityReference); + 48380146                var clone = new EntityReference(original.LogicalName, original.Id); + 48380147                clone.Name = CloneAttribute(original.Name) as string; + 48380148                return clone;  149            } - 107580150             else if (type == typeof(BooleanManagedProperty)) + 107735150             else if (type == typeof(BooleanManagedProperty))  15151            {  15152                var original = (attributeValue as BooleanManagedProperty);  15153                return new BooleanManagedProperty(original.Value);  154            }  155 - 107565156             else if (type == typeof(OptionSetValue)) - 23218157            { - 23218158                var original = (attributeValue as OptionSetValue); - 23218159                return new OptionSetValue(original.Value); + 107720156             else if (type == typeof(OptionSetValue)) + 23243157            { + 23243158                var original = (attributeValue as OptionSetValue); + 23243159                return new OptionSetValue(original.Value);  160            } - 84347161             else if (type == typeof(AliasedValue)) - 5812162            { - 5812163                var original = (attributeValue as AliasedValue); - 5812164                return new AliasedValue(original.EntityLogicalName, original.AttributeLogicalName, CloneAttribute(origin + 84477161             else if (type == typeof(AliasedValue)) + 5847162            { + 5847163                var original = (attributeValue as AliasedValue); + 5847164                return new AliasedValue(original.EntityLogicalName, original.AttributeLogicalName, CloneAttribute(origin  165            }  166 - 78535167             else if (type == typeof(Money)) + 78630167             else if (type == typeof(Money))  227168            {  227169                var original = (attributeValue as Money);  227170                return new Money(original.Value);  171            }  172 - 78308173             else if (attributeValue.GetType() == typeof (EntityCollection)) + 78403173             else if (attributeValue.GetType() == typeof (EntityCollection))  10174            {  10175                var collection = attributeValue as EntityCollection;  20176                return new EntityCollection(collection.Entities.Select(e => e.Clone(e.GetType())).ToList());  177            }  178 - 78298179             else if (type == typeof (int) || type == typeof (Int64)) - 1290180                return attributeValue; //Not a reference type - 77008181             else if (type == typeof (decimal)) + 78393179             else if (type == typeof (int) || type == typeof (Int64)) + 1310180                return attributeValue; //Not a reference type + 77083181             else if (type == typeof (decimal))  68182                return attributeValue; //Not a reference type - 76940183             else if (type == typeof (double)) + 77015183             else if (type == typeof (double))  225184                return attributeValue; //Not a reference type - 76715185             else if (type == typeof (float)) + 76790185             else if (type == typeof (float))  30186                return attributeValue; //Not a reference type - 76685187             else if (type == typeof (byte)) + 76760187             else if (type == typeof (byte))  0188                return attributeValue; //Not a reference type - 76685189             else if (type == typeof (float)) + 76760189             else if (type == typeof (float))  0190                return attributeValue; //Not a reference type - 76685191             else if (type == typeof (bool)) + 76760191             else if (type == typeof (bool))  140192                return attributeValue; //Not a reference type - 76545193             else if (type == typeof (Guid)) - 30325194                return attributeValue; //Not a reference type - 46220195             else if (type == typeof (DateTime)) - 46205196                return attributeValue; //Not a reference type + 76620193             else if (type == typeof (Guid)) + 30350194                return attributeValue; //Not a reference type + 46270195             else if (type == typeof (DateTime)) + 46255196                return attributeValue; //Not a reference type  15197             else if (attributeValue is Enum)  15198                return attributeValue; //Not a reference type  199  0200            throw new Exception(string.Format("Attribute type not supported when trying to clone attribute '{0}'", type. - 214186201        } + 214471201        }  202  203        public static Entity Clone(this Entity e) - 1885204        { - 1885205            var cloned = new Entity(e.LogicalName); - 1885206            cloned.Id = e.Id; - 1885207            cloned.LogicalName = e.LogicalName; + 1900204        { + 1900205            var cloned = new Entity(e.LogicalName); + 1900206            cloned.Id = e.Id; + 1900207            cloned.LogicalName = e.LogicalName;  208 - 1885209             if (e.FormattedValues != null) - 1885210            { - 1885211                var formattedValues = new FormattedValueCollection(); - 5655212                foreach (var key in e.FormattedValues.Keys) + 1900209             if (e.FormattedValues != null) + 1900210            { + 1900211                var formattedValues = new FormattedValueCollection(); + 5700212                foreach (var key in e.FormattedValues.Keys)  0213                    formattedValues.Add(key, e.FormattedValues[key]);  214 - 1885215                cloned.Inject("FormattedValues", formattedValues); - 1885216            } + 1900215                cloned.Inject("FormattedValues", formattedValues); + 1900216            }  217 - 34119218            foreach (var attKey in e.Attributes.Keys) - 14232219            { - 14232220                 cloned[attKey] = e[attKey] != null ? CloneAttribute(e[attKey]) : null; - 14232221            } - 1885222            return cloned; - 1885223        } + 34324218            foreach (var attKey in e.Attributes.Keys) + 14312219            { + 14312220                 cloned[attKey] = e[attKey] != null ? CloneAttribute(e[attKey]) : null; + 14312221            } + 1900222            return cloned; + 1900223        }  224  225        public static T Clone<T>(this Entity e) where T: Entity  0226        { @@ -277,183 +277,186 @@

C:\Code\f  0228        }  229  230        public static Entity Clone(this Entity e, Type t) - 24839231        { - 24839232             if (t == null) + 24854231        { + 24854232             if (t == null)  70233                return e.Clone();  234 - 24769235            var cloned = Activator.CreateInstance(t) as Entity; - 24769236            cloned.Id = e.Id; - 24769237            cloned.LogicalName = e.LogicalName; + 24784235            var cloned = Activator.CreateInstance(t) as Entity; + 24784236            cloned.Id = e.Id; + 24784237            cloned.LogicalName = e.LogicalName;  238 - 24769239             if(e.FormattedValues != null) - 24769240            { - 24769241                var formattedValues = new FormattedValueCollection(); - 74337242                foreach (var key in e.FormattedValues.Keys) + 24784239             if(e.FormattedValues != null) + 24784240            { + 24784241                var formattedValues = new FormattedValueCollection(); + 74382242                foreach (var key in e.FormattedValues.Keys)  15243                    formattedValues.Add(key, e.FormattedValues[key]);  244 - 24769245                cloned.Inject("FormattedValues", formattedValues); - 24769246            } + 24784245                cloned.Inject("FormattedValues", formattedValues); + 24784246            }  247 - 363761248            foreach (var attKey in e.Attributes.Keys) - 144727249            { - 144727250                 cloned[attKey] = e[attKey] != null ? CloneAttribute(e[attKey]) : null; - 144727251            } - 24769252            return cloned; - 24839253        }254255        /// <summary>256        /// Extension method to join the attributes of entity e and otherEntity257        /// </summary>258        /// <param name="e"></param>259        /// <param name="otherEntity"></param>260        /// <param name="attributes"></param>261        /// <returns></returns>262        public static Entity JoinAttributes(this Entity e, Entity otherEntity, ColumnSet columnSet, string alias, XrmFak - 977263        { - 1046264             if (otherEntity == null) return e; //Left Join where otherEntity was not matched265 - 908266            otherEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, which would cause 267 - 908268             if (columnSet.AllColumns) - 908269            { - 16894270                foreach (var attKey in otherEntity.Attributes.Keys) - 7085271                { - 7085272                    e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherEntity[attKey]); - 7085273                } - 908274            }275            else - 0276            {277                //Return selected list of attributes - 0278                foreach (var attKey in columnSet.Columns) - 0279                { - 0280                     if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) - 0281                    { - 0282                        OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); - 0283                    }284 - 0285                     if (otherEntity.Attributes.ContainsKey(attKey)) - 0286                    { - 0287                        e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherEntity[attKey]); - 0288                    }289                    else - 0290                    { - 0291                        e[alias + "." + attKey] = new AliasedValue(alias, attKey, null); - 0292                    }293 - 0294                } - 0295            } - 908296            return e; - 977297        }298299        public static Entity JoinAttributes(this Entity e, IEnumerable<Entity> otherEntities, ColumnSet columnSet, strin - 0300        { - 0301            foreach (var otherEntity in otherEntities) { - 0302                var otherClonedEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, whic303 - 0304                 if (columnSet.AllColumns) - 0305                { - 0306                    foreach (var attKey in otherClonedEntity.Attributes.Keys) - 0307                    { - 0308                        e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherClonedEntity[attKey]); - 0309                    } - 0310                }311                else - 0312                {313                    //Return selected list of attributes - 0314                    foreach (var attKey in columnSet.Columns) - 0315                    { - 0316                         if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) - 0317                        { - 0318                            OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); - 0319                        }320 - 0321                         if (otherClonedEntity.Attributes.ContainsKey(attKey)) - 0322                        { - 0323                            e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherClonedEntity[attKey]); - 0324                        } - 0325                        else { - 0326                            e[alias + "." + attKey] = new AliasedValue(alias, attKey, null); + 363656248            foreach (var attKey in e.Attributes.Keys) + 144652249            { + 144652250                 if (e[attKey] != null) + 144527251                { + 144527252                    cloned[attKey] = CloneAttribute(e[attKey]); + 144527253                } + 144652254            } + 24784255            return cloned; + 24854256        }257258        /// <summary>259        /// Extension method to join the attributes of entity e and otherEntity260        /// </summary>261        /// <param name="e"></param>262        /// <param name="otherEntity"></param>263        /// <param name="attributes"></param>264        /// <returns></returns>265        public static Entity JoinAttributes(this Entity e, Entity otherEntity, ColumnSet columnSet, string alias, XrmFak + 982266        { + 1051267             if (otherEntity == null) return e; //Left Join where otherEntity was not matched268 + 913269            otherEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, which would cause 270 + 913271             if (columnSet.AllColumns) + 913272            { + 16979273                foreach (var attKey in otherEntity.Attributes.Keys) + 7120274                { + 7120275                    e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherEntity[attKey]); + 7120276                } + 913277            }278            else + 0279            {280                //Return selected list of attributes + 0281                foreach (var attKey in columnSet.Columns) + 0282                { + 0283                     if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) + 0284                    { + 0285                        OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); + 0286                    }287 + 0288                     if (otherEntity.Attributes.ContainsKey(attKey)) + 0289                    { + 0290                        e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherEntity[attKey]); + 0291                    }292                    else + 0293                    { + 0294                        e[alias + "." + attKey] = new AliasedValue(alias, attKey, null); + 0295                    }296 + 0297                } + 0298            } + 913299            return e; + 982300        }301302        public static Entity JoinAttributes(this Entity e, IEnumerable<Entity> otherEntities, ColumnSet columnSet, strin + 0303        { + 0304            foreach (var otherEntity in otherEntities) { + 0305                var otherClonedEntity = otherEntity.Clone(); //To avoid joining entities from/to the same entities, whic306 + 0307                 if (columnSet.AllColumns) + 0308                { + 0309                    foreach (var attKey in otherClonedEntity.Attributes.Keys) + 0310                    { + 0311                        e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherClonedEntity[attKey]); + 0312                    } + 0313                }314                else + 0315                {316                    //Return selected list of attributes + 0317                    foreach (var attKey in columnSet.Columns) + 0318                    { + 0319                         if (!context.AttributeExistsInMetadata(otherEntity.LogicalName, attKey)) + 0320                        { + 0321                            OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(attKey); + 0322                        }323 + 0324                         if (otherClonedEntity.Attributes.ContainsKey(attKey)) + 0325                        { + 0326                            e[alias + "." + attKey] = new AliasedValue(alias, attKey, otherClonedEntity[attKey]);  0327                        } - 0328                    } - 0329                } - 0330            } - 0331            return e; - 0332        }333334        /// <summary>335        /// Returns the key for the attribute name selected (could an entity reference or a primary key or a guid)336        /// </summary>337        /// <param name="e"></param>338        /// <param name="sAttributeName"></param>339        /// <returns></returns>340        public static Guid KeySelector(this Entity e, string sAttributeName, XrmFakedContext context) - 2090341        { - 2090342             if(sAttributeName.Contains(".")) - 90343            {344                //Do not lowercase the alias prefix - 90345                var splitted = sAttributeName.Split('.'); - 90346                sAttributeName = string.Format("{0}.{1}", splitted[0], splitted[1].ToLower()); - 90347            }348            else - 2000349            { - 2000350                sAttributeName = sAttributeName.ToLower(); - 2000351            }352353 - 2090354             if (!e.Attributes.ContainsKey(sAttributeName)) - 135355            {356                //Check if it is the primary key - 135357                 if (sAttributeName.Contains("id") && - 135358                   e.LogicalName.ToLower().Equals(sAttributeName.Substring(0, sAttributeName.Length - 2))) - 0359                { - 0360                    return e.Id;361                } - 135362                return Guid.Empty; //Atrribute is null or doesn´t exists so it can´t be joined363            }364 - 1955365            object keyValue = null; - 1955366             if(e[sAttributeName] is AliasedValue) - 90367            { - 90368                keyValue = (e[sAttributeName] as AliasedValue).Value; - 90369            }370            else - 1865371            { - 1865372                keyValue = e[sAttributeName]; - 1865373            }374 - 1955375             if (keyValue is EntityReference) - 698376                return (keyValue as EntityReference).Id; - 1257377             if (keyValue is Guid) - 1217378                return ((Guid)keyValue);379 - 40380            return Guid.Empty; - 2090381        } + 0328                        else { + 0329                            e[alias + "." + attKey] = new AliasedValue(alias, attKey, null); + 0330                        } + 0331                    } + 0332                } + 0333            } + 0334            return e; + 0335        }336337        /// <summary>338        /// Returns the key for the attribute name selected (could an entity reference or a primary key or a guid)339        /// </summary>340        /// <param name="e"></param>341        /// <param name="sAttributeName"></param>342        /// <returns></returns>343        public static Guid KeySelector(this Entity e, string sAttributeName, XrmFakedContext context) + 2100344        { + 2100345             if(sAttributeName.Contains(".")) + 90346            {347                //Do not lowercase the alias prefix + 90348                var splitted = sAttributeName.Split('.'); + 90349                sAttributeName = string.Format("{0}.{1}", splitted[0], splitted[1].ToLower()); + 90350            }351            else + 2010352            { + 2010353                sAttributeName = sAttributeName.ToLower(); + 2010354            }355356 + 2100357             if (!e.Attributes.ContainsKey(sAttributeName)) + 165358            {359                //Check if it is the primary key + 165360                 if (sAttributeName.Contains("id") && + 165361                   e.LogicalName.ToLower().Equals(sAttributeName.Substring(0, sAttributeName.Length - 2))) + 0362                { + 0363                    return e.Id;364                } + 165365                return Guid.Empty; //Atrribute is null or doesn´t exists so it can´t be joined366            }367 + 1935368            object keyValue = null; + 1935369             if(e[sAttributeName] is AliasedValue) + 90370            { + 90371                keyValue = (e[sAttributeName] as AliasedValue).Value; + 90372            }373            else + 1845374            { + 1845375                keyValue = e[sAttributeName]; + 1845376            }377 + 1935378             if (keyValue is EntityReference) + 703379                return (keyValue as EntityReference).Id; + 1232380             if (keyValue is Guid) + 1222381                return ((Guid)keyValue);  382383        /// <summary>384        /// Extension method to "hack" internal set properties on sealed classes via reflection385        /// </summary>386        /// <param name="e"></param>387        /// <param name="property"></param>388        /// <param name="value"></param>389        public static void Inject(this Entity e, string property, object value) - 26659390        { - 26659391            e.GetType().GetProperty(property).SetValue(e, value, null); - 26659392        }393394        public static void SetValueIfEmpty(this Entity e, string property, object value) - 23960395        { - 23960396            var containsKey = e.Attributes.ContainsKey(property); - 23960397             if (!containsKey || containsKey && e[property] == null) - 23858398            { - 23858399                e[property] = value; - 23858400            } - 23960401        }402403404    }405} + 10383            return Guid.Empty; + 2100384        }385386        /// <summary>387        /// Extension method to "hack" internal set properties on sealed classes via reflection388        /// </summary>389        /// <param name="e"></param>390        /// <param name="property"></param>391        /// <param name="value"></param>392        public static void Inject(this Entity e, string property, object value) + 26689393        { + 26689394            e.GetType().GetProperty(property).SetValue(e, value, null); + 26689395        }396397        public static void SetValueIfEmpty(this Entity e, string property, object value) + 24010398        { + 24010399            var containsKey = e.Attributes.ContainsKey(property); + 24010400             if (!containsKey || containsKey && e[property] == null) + 23908401            { + 23908402                e[property] = value; + 23908403            } + 24010404        }405406407    }408} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm b/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm index af451d70..ece3a76c 100644 --- a/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_ExecuteMultipleRequestExecutor.htm @@ -128,13 +128,13 @@

 3589        }  90  91        public Type GetResponsibleRequestType() - 220992        { - 220993            return typeof(ExecuteMultipleRequest); - 220994        } + 221492        { + 221493            return typeof(ExecuteMultipleRequest); + 221494        }  95    }  96} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm b/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm index f473cf70..4bdbe190 100644 --- a/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm +++ b/test/reports/FakeXrmEasy_ExecuteTransactionExecutor.htm @@ -73,14 +73,14 @@

 434        }  35  36        public Type GetResponsibleRequestType() - 88837        { - 88838            return typeof(ExecuteTransactionRequest); - 88839        } + 89037        { + 89038            return typeof(ExecuteTransactionRequest); + 89039        }  40    }  41}  42#endif - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm b/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm index e26d84e7..c3a21a17 100644 --- a/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_InsertOptionValueRequestExecutor.htm @@ -94,13 +94,13 @@

 1055        }  56  57        public Type GetResponsibleRequestType() - 220958        { - 220959            return typeof(InsertOptionValueRequest); - 220960        } + 221458        { + 221459            return typeof(InsertOptionValueRequest); + 221460        }  61    }  62} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm b/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm index 3f5f6b2e..fa3ab476 100644 --- a/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm +++ b/test/reports/FakeXrmEasy_OrganizationServiceFaultQueryBuilderNoAttributeException.htm @@ -65,6 +65,6 @@

 27} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm b/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm index 469c3ba6..a32aab33 100644 --- a/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_PublishXmlRequestExecutor.htm @@ -67,13 +67,13 @@

 528        }  29  30        public Type GetResponsibleRequestType() - 220931        { - 220932            return typeof(PublishXmlRequest); - 220933        } + 221431        { + 221432            return typeof(PublishXmlRequest); + 221433        }  34    }  35} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_PullRequestException.htm b/test/reports/FakeXrmEasy_PullRequestException.htm index efb5c01e..3e735a4d 100644 --- a/test/reports/FakeXrmEasy_PullRequestException.htm +++ b/test/reports/FakeXrmEasy_PullRequestException.htm @@ -67,6 +67,6 @@

C:\Code\fake-xr  28} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm index 5224d6d6..d99e4845 100644 --- a/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveAttributeRequestExecutor.htm @@ -59,13 +59,13 @@

 21        }  22  23        public Type GetResponsibleRequestType() - 220924        { - 220925            return typeof(RetrieveAttributeRequest); - 220926        } + 221424        { + 221425            return typeof(RetrieveAttributeRequest); + 221426        }  27    }  28} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm b/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm index f6113968..978458a0 100644 --- a/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_RetrieveMultipleRequestExecutor.htm @@ -20,7 +20,7 @@

Summary

Coverable lines:123 Total lines:188 Line coverage:91.8% -Branch coverage:84.2% +Branch coverage:81.5%

Metrics

@@ -29,7 +29,7 @@

Metrics

CanExecute(...)100 Execute(...)2391.4682.76 -PopulateFormattedValues(...)5100100 +PopulateFormattedValues(...)510080 GetFormattedValueForValue(...)510085.71 GetResponsibleRequestType()1100100 @@ -59,31 +59,31 @@

 018        }  19  20        public OrganizationResponse Execute(OrganizationRequest req, XrmFakedContext ctx) - 110121        { - 110122            var request = req as RetrieveMultipleRequest; - 110123            List<Entity> list = null; - 110124            PagingInfo pageInfo = null; - 110125            int? topCount = null; + 110621        { + 110622            var request = req as RetrieveMultipleRequest; + 110623            List<Entity> list = null; + 110624            PagingInfo pageInfo = null; + 110625            int? topCount = null;  26 - 110127             if (request.Query is QueryExpression) - 78228            { - 78229                var qe = request.Query as QueryExpression; + 110627             if (request.Query is QueryExpression) + 78728            { + 78729                var qe = request.Query as QueryExpression;  30 - 78231                pageInfo = qe.PageInfo; - 78232                topCount = qe.TopCount; + 78731                pageInfo = qe.PageInfo; + 78732                topCount = qe.TopCount;  33  34                //need to request 1 extra to get a fill if there are more records - 78235                 if (topCount != null) + 78735                 if (topCount != null)  036                    qe.TopCount = topCount + 1;  37  38 - 78239                 if (qe.PageInfo.Count > 0) + 78739                 if (qe.PageInfo.Count > 0)  11040                    qe.TopCount = qe.PageInfo.Count + 1;  41 - 78242                var linqQuery = XrmFakedContext.TranslateQueryExpressionToLinq(ctx, request.Query as QueryExpression); - 78243                list = linqQuery.ToList(); + 78742                var linqQuery = XrmFakedContext.TranslateQueryExpressionToLinq(ctx, request.Query as QueryExpression); + 78743                list = linqQuery.ToList();  44 - 78245            } + 78745            }  31946             else if (request.Query is FetchExpression)  29947            {  29948                var fetchXml = (request.Query as FetchExpression).Query; @@ -144,27 +144,27 @@

 103            else  0104                throw PullRequestException.NotImplementedOrganizationRequest(request.Query.GetType());  105 - 2773106            list.ForEach(e => PopulateFormattedValues(e)); - 1076107            var recordCount = list.Count(); - 1076108            var pageSize = recordCount ; - 1076109            int pageNumber = 1; - 1211110             if (pageInfo != null && pageInfo.PageNumber > 0 && pageInfo.Count>0) { + 2783106            list.ForEach(e => PopulateFormattedValues(e)); + 1081107            var recordCount = list.Count(); + 1081108            var pageSize = recordCount ; + 1081109            int pageNumber = 1; + 1216110             if (pageInfo != null && pageInfo.PageNumber > 0 && pageInfo.Count>0) {  135111                pageSize = pageInfo.Count;  135112                pageNumber = pageInfo.PageNumber;  135113            } - 941114             else if (topCount != null) + 946114             else if (topCount != null)  0115                pageSize = topCount.Value;  116 - 1076117            var response = new RetrieveMultipleResponse - 1076118            { - 1076119 - 1076120                Results = new ParameterCollection - 1076121                                 { - 1076122                                    { "EntityCollection", new EntityCollection(list.Take(pageSize).ToList()) } - 1076123                                 } - 1076124            }; - 1076125            response.EntityCollection.MoreRecords = recordCount > pageSize; - 1076126             if (response.EntityCollection.MoreRecords) + 1081117            var response = new RetrieveMultipleResponse + 1081118            { + 1081119 + 1081120                Results = new ParameterCollection + 1081121                                 { + 1081122                                    { "EntityCollection", new EntityCollection(list.Take(pageSize).ToList()) } + 1081123                                 } + 1081124            }; + 1081125            response.EntityCollection.MoreRecords = recordCount > pageSize; + 1081126             if (response.EntityCollection.MoreRecords)  25127            {  25128                var first = response.EntityCollection.Entities.First();  25129                var last = response.EntityCollection.Entities.Last(); @@ -173,8 +173,8 @@

 25132                    pageNumber, first.LogicalName , last.Id.ToString("B").ToUpper(), first.Id.ToString("B").ToUpper());  25133            }  134 - 1076135            return response; - 1076136        } + 1081135            return response; + 1081136        }  137  138  139 @@ -183,13 +183,13 @@

 142        /// </summary>  143        /// <param name="e"></param>  144        protected void PopulateFormattedValues(Entity e) - 1697145        { + 1702145        {  146            //Iterate through attributes and retrieve formatted values based on type - 25711147            foreach(var attKey in e.Attributes.Keys) - 10310148            { - 10310149                var value = e[attKey]; - 10310150                string formattedValue = ""; - 10310151                 if(value != null) + 25666147            foreach(var attKey in e.Attributes.Keys) + 10280148            { + 10280149                var value = e[attKey]; + 10280150                string formattedValue = ""; + 10280151                 if(value != null)  10280152                {  10280153                    bool bShouldAdd = false;  10280154                    formattedValue = GetFormattedValueForValue(value, out bShouldAdd); @@ -198,8 +198,8 @@

 5157                        e.FormattedValues.Add(attKey, formattedValue);  5158                    }  10280159                } - 10310160            } - 1697161        } + 10280160            } + 1702161        }  162  163        protected string GetFormattedValueForValue(object value, out bool bShouldAddFormattedValue)  12822164        { @@ -222,13 +222,13 @@

 12822181        }  182  183        public Type GetResponsibleRequestType() - 2209184        { - 2209185            return typeof(RetrieveMultipleRequest); - 2209186        } + 2214184        { + 2214185            return typeof(RetrieveMultipleRequest); + 2214186        }  187    }  188} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm b/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm index 929f2efe..b3a28e18 100644 --- a/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_SetStateRequestExecutor.htm @@ -72,13 +72,13 @@

 534        }  35  36        public Type GetResponsibleRequestType() - 220937        { - 220938            return typeof(SetStateRequest); - 220939        } + 221437        { + 221438            return typeof(SetStateRequest); + 221439        }  40    }  41} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_TypeExtensions.htm b/test/reports/FakeXrmEasy_TypeExtensions.htm index 96a77a60..fe0fcdb4 100644 --- a/test/reports/FakeXrmEasy_TypeExtensions.htm +++ b/test/reports/FakeXrmEasy_TypeExtensions.htm @@ -47,19 +47,19 @@

C:\Code\fak  8    public static class TypeExtensions  9    {  10        public static bool IsOptionSet(this Type t) - 259311        { - 259312            var nullableType = Nullable.GetUnderlyingType(t); - 259313             return t == typeof(OptionSetValue) - 259314                || t.IsEnum - 259315                || nullableType != null && nullableType.IsEnum; - 259316        } + 258711        { + 258712            var nullableType = Nullable.GetUnderlyingType(t); + 258713             return t == typeof(OptionSetValue) + 258714                || t.IsEnum + 258715                || nullableType != null && nullableType.IsEnum; + 258716        }  17  18        public static bool IsDateTime(this Type t) - 75219        { - 75220            var nullableType = Nullable.GetUnderlyingType(t); - 75221            return t == typeof(DateTime) - 75222                || nullableType != null && nullableType == typeof(DateTime); - 75223        } + 74619        { + 74620            var nullableType = Nullable.GetUnderlyingType(t); + 74621            return t == typeof(DateTime) + 74622                || nullableType != null && nullableType == typeof(DateTime); + 74623        }  24  25        public static bool IsNullableEnum(this Type t)  026        { @@ -72,6 +72,6 @@

C:\Code\fak  33} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm b/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm index 901bed81..b7a58090 100644 --- a/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_UpdateRequestExecutor.htm @@ -64,13 +64,13 @@

 1526        }  27  28        public Type GetResponsibleRequestType() - 220929        { - 220930            return typeof(UpdateRequest); - 220931        } + 221429        { + 221430            return typeof(UpdateRequest); + 221431        }  32    }  33} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm b/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm index bd6999bb..84a03152 100644 --- a/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm +++ b/test/reports/FakeXrmEasy_WhoAmIRequestExecutor.htm @@ -66,13 +66,13 @@

 528        }  29  30        public Type GetResponsibleRequestType() - 220931        { - 220932            return typeof(WhoAmIRequest); - 220933        } + 221431        { + 221432            return typeof(WhoAmIRequest); + 221433        }  34    }  35} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm b/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm index 05ec12dd..e4df284d 100644 --- a/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm +++ b/test/reports/FakeXrmEasy_XmlExtensionsForFetchXml.htm @@ -735,6 +735,6 @@

C  679} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedContext.htm b/test/reports/FakeXrmEasy_XrmFakedContext.htm index 0f3e824b..835332c9 100644 --- a/test/reports/FakeXrmEasy_XrmFakedContext.htm +++ b/test/reports/FakeXrmEasy_XrmFakedContext.htm @@ -15,11 +15,11 @@

Summary

Class:FakeXrmEasy.XrmFakedContext Assembly:FakeXrmEasy File(s):C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Aggregations.cs
C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.CodeActivities.cs
C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Crud.cs
C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.cs
C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Metadata.cs
C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Plugins.cs
C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Queries.cs -Covered lines:1573 -Uncovered lines:177 -Coverable lines:1750 -Total lines:2848 -Line coverage:89.8% +Covered lines:1580 +Uncovered lines:182 +Coverable lines:1762 +Total lines:2867 +Line coverage:89.6% Branch coverage:69.1% @@ -80,7 +80,9 @@

Metrics

FakeRetrieveMultiple(...)1100100 FakeRetrieveAttributeRequest(...)100 GetDefaultPluginContext()210066.67 -GetFakedPluginContext(...)4100100 +GetFakedPluginContext(...)1100100 +PopulateExecutionContextPropertiesFromFakedContext(...)4100100 +GetFakedExecutionContext(...)100 ExecutePluginWith(...)1100100 ExecutePluginWith(...)1100100 ExecutePluginWith(...)1100100 @@ -755,113 +757,113 @@

C:\Code\fake-xrm  27        /// <param name="fakedService">The faked service where the Retrieve method will be faked</param>  28        /// <returns></returns>  29        protected static void FakeRetrieve(XrmFakedContext context, IOrganizationService fakedService) - 159030        { - 159031            A.CallTo(() => fakedService.Retrieve(A<string>._, A<Guid>._, A<ColumnSet>._)) - 159032                .ReturnsLazily((string entityName, Guid id, ColumnSet columnSet) => - 185533                { - 185534                     if (string.IsNullOrWhiteSpace(entityName)) - 160535                    { - 160536                        throw new InvalidOperationException("The entity logical name must not be null or empty."); - 159037                    } - 159038 - 184039                     if (id == Guid.Empty) - 159540                    { - 159541                        throw new InvalidOperationException("The id must not be empty."); - 159042                    } - 159043 - 183544                     if (columnSet == null) - 160045                    { - 160046                        throw new InvalidOperationException("The columnset parameter must not be null."); - 159047                    } - 159048 - 159049                    // Don't fail with invalid operation exception, if no record of this entity exists, but entity is kn - 182550                     if (!context.Data.ContainsKey(entityName)) - 159551                    { - 159552                         if (context.ProxyTypesAssembly == null) - 159053                        { - 159054                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. - 159055                            entityName)); - 159056                        } - 159057 - 160058                         if (!context.ProxyTypesAssembly.GetTypes().Any(type => context.FindReflectedType(entityName) !=  - 159059                        { - 159060                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. - 159061                            entityName)); - 159062                        } - 159563                    } - 159064 - 159065                    //Return the subset of columns requested only - 182566                    var reflectedType = context.FindReflectedType(entityName); - 159067 - 159068                    //Entity logical name exists, so , check if the requested entity exists - 182569                     if (context.Data.ContainsKey(entityName) && context.Data[entityName] != null - 182570                        && context.Data[entityName].ContainsKey(id)) - 181071                    { - 159072                        //Entity found => return only the subset of columns specified or all of them - 181073                         if (columnSet.AllColumns) - 173074                            return context.Data[entityName][id].Clone(reflectedType); - 159075                        else - 167076                        { - 167077                            Entity foundEntity = null; - 167078                            foundEntity = context.Data[entityName][id].Clone(reflectedType); - 167079                            Entity projected = foundEntity.ProjectAttributes(columnSet, context); - 167080                            return projected; - 159081                        } - 159082                    } - 159083                    else - 160584                    { - 159085                        //Entity not found in the context => return null - 160586                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), string.Format - 159087                    } - 181088                }); - 159089        } + 159530        { + 159531            A.CallTo(() => fakedService.Retrieve(A<string>._, A<Guid>._, A<ColumnSet>._)) + 159532                .ReturnsLazily((string entityName, Guid id, ColumnSet columnSet) => + 186033                { + 186034                     if (string.IsNullOrWhiteSpace(entityName)) + 161035                    { + 161036                        throw new InvalidOperationException("The entity logical name must not be null or empty."); + 159537                    } + 159538 + 184539                     if (id == Guid.Empty) + 160040                    { + 160041                        throw new InvalidOperationException("The id must not be empty."); + 159542                    } + 159543 + 184044                     if (columnSet == null) + 160545                    { + 160546                        throw new InvalidOperationException("The columnset parameter must not be null."); + 159547                    } + 159548 + 159549                    // Don't fail with invalid operation exception, if no record of this entity exists, but entity is kn + 183050                     if (!context.Data.ContainsKey(entityName)) + 160051                    { + 160052                         if (context.ProxyTypesAssembly == null) + 159553                        { + 159554                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. + 159555                            entityName)); + 159556                        } + 159557 + 160558                         if (!context.ProxyTypesAssembly.GetTypes().Any(type => context.FindReflectedType(entityName) !=  + 159559                        { + 159560                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. + 159561                            entityName)); + 159562                        } + 160063                    } + 159564 + 159565                    //Return the subset of columns requested only + 183066                    var reflectedType = context.FindReflectedType(entityName); + 159567 + 159568                    //Entity logical name exists, so , check if the requested entity exists + 183069                     if (context.Data.ContainsKey(entityName) && context.Data[entityName] != null + 183070                        && context.Data[entityName].ContainsKey(id)) + 181571                    { + 159572                        //Entity found => return only the subset of columns specified or all of them + 181573                         if (columnSet.AllColumns) + 173574                            return context.Data[entityName][id].Clone(reflectedType); + 159575                        else + 167576                        { + 167577                            Entity foundEntity = null; + 167578                            foundEntity = context.Data[entityName][id].Clone(reflectedType); + 167579                            Entity projected = foundEntity.ProjectAttributes(columnSet, context); + 167580                            return projected; + 159581                        } + 159582                    } + 159583                    else + 161084                    { + 159585                        //Entity not found in the context => return null + 161086                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), string.Format + 159587                    } + 181588                }); + 159589        }  90        /// <summary>  91        /// Fakes the Create message  92        /// </summary>  93        /// <param name="context"></param>  94        /// <param name="fakedService"></param>  95        protected static void FakeCreate(XrmFakedContext context, IOrganizationService fakedService) - 159096        { - 159097            A.CallTo(() => fakedService.Create(A<Entity>._)) - 159098                .ReturnsLazily((Entity e) => - 232299                { - 2322100                    context.CreateEntity(e); - 1590101 - 2282102                    return e.Id; - 2282103                }); + 159596        { + 159597            A.CallTo(() => fakedService.Create(A<Entity>._)) + 159598                .ReturnsLazily((Entity e) => + 232799                { + 2327100                    context.CreateEntity(e); + 1595101 + 2287102                    return e.Id; + 2287103                });  104 - 1590105        } + 1595105        }  106  107        protected static void FakeUpdate(XrmFakedContext context, IOrganizationService fakedService) - 1590108        { - 1590109            A.CallTo(() => fakedService.Update(A<Entity>._)) - 1590110                .Invokes((Entity e) => - 1675111                { - 1675112                    context.ValidateEntity(e); - 1590113 - 1590114                    //Update specific validations: The entity record must exist in the context - 1660115                     if (context.Data.ContainsKey(e.LogicalName) && - 1660116                        context.Data[e.LogicalName].ContainsKey(e.Id)) - 1650117                    { - 1590118                        //Add as many attributes to the entity as the ones received (this will keep existing ones) - 1650119                        var cachedEntity = context.Data[e.LogicalName][e.Id]; - 1950120                        foreach (var sAttributeName in e.Attributes.Keys.ToList()) - 1680121                        { - 1680122                            cachedEntity[sAttributeName] = e[sAttributeName]; - 1680123                        } - 1590124 - 1590125                        // Update ModifiedOn - 1650126                        cachedEntity["modifiedon"] = DateTime.UtcNow; - 1650127                        cachedEntity["modifiedby"] = context.CallerId; - 1650128                    } - 1590129                    else - 1600130                    { - 1590131                        //The entity record was not found, return a CRM-ish update error message - 1600132                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), string.Format - 1590133                    } - 1650134                }); + 1595108        { + 1595109            A.CallTo(() => fakedService.Update(A<Entity>._)) + 1595110                .Invokes((Entity e) => + 1680111                { + 1680112                    context.ValidateEntity(e); + 1595113 + 1595114                    //Update specific validations: The entity record must exist in the context + 1665115                     if (context.Data.ContainsKey(e.LogicalName) && + 1665116                        context.Data[e.LogicalName].ContainsKey(e.Id)) + 1655117                    { + 1595118                        //Add as many attributes to the entity as the ones received (this will keep existing ones) + 1655119                        var cachedEntity = context.Data[e.LogicalName][e.Id]; + 1955120                        foreach (var sAttributeName in e.Attributes.Keys.ToList()) + 1685121                        { + 1685122                            cachedEntity[sAttributeName] = e[sAttributeName]; + 1685123                        } + 1595124 + 1595125                        // Update ModifiedOn + 1655126                        cachedEntity["modifiedon"] = DateTime.UtcNow; + 1655127                        cachedEntity["modifiedby"] = context.CallerId; + 1655128                    } + 1595129                    else + 1605130                    { + 1595131                        //The entity record was not found, return a CRM-ish update error message + 1605132                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), string.Format + 1595133                    } + 1655134                });  135 - 1590136        } + 1595136        }  137  138        /// <summary>  139        /// Fakes the delete method. Very similar to the Retrieve one @@ -869,49 +871,49 @@

C:\Code\fake-xrm  141        /// <param name="context"></param>  142        /// <param name="fakedService"></param>  143        protected static void FakeDelete(XrmFakedContext context, IOrganizationService fakedService) - 1590144        { - 1590145            A.CallTo(() => fakedService.Delete(A<string>._, A<Guid>._)) - 1590146                .Invokes((string entityName, Guid id) => - 1665147                { - 1665148                     if (string.IsNullOrWhiteSpace(entityName)) - 1605149                    { - 1605150                        throw new InvalidOperationException("The entity logical name must not be null or empty."); - 1590151                    } - 1590152 - 1650153                     if (id == Guid.Empty) - 1595154                    { - 1595155                        throw new InvalidOperationException("The id must not be empty."); - 1590156                    } - 1590157 - 1590158                    // Don't fail with invalid operation exception, if no record of this entity exists, but entity is kn - 1645159                     if (!context.Data.ContainsKey(entityName)) - 1600160                    { - 1600161                         if (context.ProxyTypesAssembly == null) - 1595162                        { - 1595163                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. - 1590164                        } - 1590165 - 1600166                         if (!context.ProxyTypesAssembly.GetTypes().Any(type => context.FindReflectedType(entityName) !=  - 1590167                        { - 1590168                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. - 1590169                        } - 1595170                    } - 1590171 - 1590172                    //Entity logical name exists, so , check if the requested entity exists - 1640173                     if (context.Data.ContainsKey(entityName) && context.Data[entityName] != null && context.Data[entityN - 1630174                    { - 1590175                        //Entity found => return only the subset of columns specified or all of them - 1630176                        context.Data[entityName].Remove(id); - 1630177                    } - 1590178                    else - 1600179                    { - 1590180                        //Entity not found in the context => throw not found exception - 1590181                        //The entity record was not found, return a CRM-ish update error message - 1600182                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), - 1600183                            string.Format("{0} with Id {1} Does Not Exist", entityName, id)); - 1590184                    } - 1630185                }); - 1590186        } + 1595144        { + 1595145            A.CallTo(() => fakedService.Delete(A<string>._, A<Guid>._)) + 1595146                .Invokes((string entityName, Guid id) => + 1670147                { + 1670148                     if (string.IsNullOrWhiteSpace(entityName)) + 1610149                    { + 1610150                        throw new InvalidOperationException("The entity logical name must not be null or empty."); + 1595151                    } + 1595152 + 1655153                     if (id == Guid.Empty) + 1600154                    { + 1600155                        throw new InvalidOperationException("The id must not be empty."); + 1595156                    } + 1595157 + 1595158                    // Don't fail with invalid operation exception, if no record of this entity exists, but entity is kn + 1650159                     if (!context.Data.ContainsKey(entityName)) + 1605160                    { + 1605161                         if (context.ProxyTypesAssembly == null) + 1600162                        { + 1600163                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. + 1595164                        } + 1595165 + 1605166                         if (!context.ProxyTypesAssembly.GetTypes().Any(type => context.FindReflectedType(entityName) !=  + 1595167                        { + 1595168                            throw new InvalidOperationException(string.Format("The entity logical name {0} is not valid. + 1595169                        } + 1600170                    } + 1595171 + 1595172                    //Entity logical name exists, so , check if the requested entity exists + 1645173                     if (context.Data.ContainsKey(entityName) && context.Data[entityName] != null && context.Data[entityN + 1635174                    { + 1595175                        //Entity found => return only the subset of columns specified or all of them + 1635176                        context.Data[entityName].Remove(id); + 1635177                    } + 1595178                    else + 1605179                    { + 1595180                        //Entity not found in the context => throw not found exception + 1595181                        //The entity record was not found, return a CRM-ish update error message + 1605182                        throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), + 1605183                            string.Format("{0} with Id {1} Does Not Exist", entityName, id)); + 1595184                    } + 1635185                }); + 1595186        }  187  188        //protected static void FakeEnableProxyTypes(XrmFakedContext context, OrganizationServiceProxy fakedService)  189        //{ @@ -933,13 +935,13 @@

C:\Code\fake-xrm  205  206        #region Other protected methods  207        protected void EnsureEntityNameExistsInMetadata(string sEntityName) - 2180208        { - 2515209             if (Relationships.Values.Any(value => new[] { value.Entity1LogicalName, value.Entity2LogicalName, value.Inte + 2195208        { + 2530209             if (Relationships.Values.Any(value => new[] { value.Entity1LogicalName, value.Entity2LogicalName, value.Inte  330210            {  330211                return;  212            }  213            //Entity metadata is checked differently when we are using a ProxyTypesAssembly => we can infer that from th - 1850214             if (ProxyTypesAssembly != null) + 1865214             if (ProxyTypesAssembly != null)  1420215            {  1420216                var subClassType = FindReflectedType(sEntityName);  1420217                 if (subClassType == null) @@ -952,35 +954,35 @@

C:\Code\fake-xrm  224            //    //No Proxy Types Assembly  225            //    throw new Exception(string.Format("Entity {0} does not exist in the metadata cache", sEntityName));  226            //}; - 2180227        } + 2195227        }  228  229        protected void AddEntityDefaultAttributes(Entity e) - 4789230        { + 4799230        {  231            //Add createdon, modifiedon, createdby, modifiedby properties - 4789232             if (CallerId == null) - 1470233                CallerId = new EntityReference("systemuser", Guid.NewGuid()); //Create a new instance by default + 4799232             if (CallerId == null) + 1475233                CallerId = new EntityReference("systemuser", Guid.NewGuid()); //Create a new instance by default  234 - 4789235            EntityInitializerService.Initialize(e, CallerId.Id); - 4789236        } + 4799235            EntityInitializerService.Initialize(e, CallerId.Id); + 4799236        }  237  238        protected void ValidateEntity(Entity e) - 5626239        { - 5626240             if (e == null) + 5636239        { + 5636240             if (e == null)  5241            {  5242                throw new InvalidOperationException("The entity must not be null");  243            }  244  245            //Validate the entity - 5621246             if (string.IsNullOrWhiteSpace(e.LogicalName)) + 5631246             if (string.IsNullOrWhiteSpace(e.LogicalName))  15247            {  15248                throw new InvalidOperationException("The LogicalName property must not be empty");  249            }  250 - 5606251             if (e.Id == Guid.Empty) + 5616251             if (e.Id == Guid.Empty)  10252            {  10253                throw new InvalidOperationException("The Id property must not be empty");  254            } - 5596255        } + 5606255        }  256  257        protected internal void CreateEntity(Entity e)  757258        { @@ -1040,45 +1042,45 @@

C:\Code\fake-xrm  717312        }  313  314        protected internal void AddEntityWithDefaults(Entity e) - 4789315        { - 4789316            var clone = e.Clone(e.GetType()); - 4789317            AddEntityDefaultAttributes(clone); - 4789318            AddEntity(clone); - 4774319        } + 4799315        { + 4799316            var clone = e.Clone(e.GetType()); + 4799317            AddEntityDefaultAttributes(clone); + 4799318            AddEntity(clone); + 4784319        }  320  321        protected internal void AddEntity(Entity e) - 4789322        { + 4799322        {  323            //Automatically detect proxy types assembly if an early bound type was used. - 4789324             if (ProxyTypesAssembly == null && - 4789325                e.GetType().IsSubclassOf(typeof(Entity))) + 4799324             if (ProxyTypesAssembly == null && + 4799325                e.GetType().IsSubclassOf(typeof(Entity)))  781326            {  781327                ProxyTypesAssembly = Assembly.GetAssembly(e.GetType());  781328            }  329 - 4789330            ValidateEntity(e); //Entity must have a logical name and an Id + 4799330            ValidateEntity(e); //Entity must have a logical name and an Id  331  332            //Add the entity collection - 4779333             if (!Data.ContainsKey(e.LogicalName)) - 2147334            { - 2147335                Data.Add(e.LogicalName, new Dictionary<Guid, Entity>()); - 2147336            } + 4789333             if (!Data.ContainsKey(e.LogicalName)) + 2157334            { + 2157335                Data.Add(e.LogicalName, new Dictionary<Guid, Entity>()); + 2157336            }  337 - 4779338             if (Data[e.LogicalName].ContainsKey(e.Id)) + 4789338             if (Data[e.LogicalName].ContainsKey(e.Id))  5339            {  5340                Data[e.LogicalName][e.Id] = e;  5341            }  342            else - 4774343            { - 4774344                Data[e.LogicalName].Add(e.Id, e); - 4774345            } + 4784343            { + 4784344                Data[e.LogicalName].Add(e.Id, e); + 4784345            }  346  347  348            //Update metadata for that entity - 4779349             if (!AttributeMetadata.ContainsKey(e.LogicalName)) - 2147350                AttributeMetadata.Add(e.LogicalName, new Dictionary<string, string>()); + 4789349             if (!AttributeMetadata.ContainsKey(e.LogicalName)) + 2157350                AttributeMetadata.Add(e.LogicalName, new Dictionary<string, string>());  351  352            //Update attribute metadata - 4779353             if (ProxyTypesAssembly != null) + 4789353             if (ProxyTypesAssembly != null)  3722354            {  355                //If the context is using a proxy types assembly then we can just guess the metadata from the generated   3722356                var type = FindReflectedType(e.LogicalName); @@ -1096,23 +1098,23 @@

C:\Code\fake-xrm  368  3717369            }  370            else - 1057371            { + 1067371            {  372                //If dynamic entities are being used, then the only way of guessing if a property exists is just by chec  373                //if the entity has the attribute in the dictionary - 18345374                foreach (var attKey in e.Attributes.Keys) - 7587375                { - 7587376                     if (!AttributeMetadata[e.LogicalName].ContainsKey(attKey)) - 3874377                        AttributeMetadata[e.LogicalName].Add(attKey, attKey); - 7587378                } - 1057379            } + 18455374                foreach (var attKey in e.Attributes.Keys) + 7627375                { + 7627376                     if (!AttributeMetadata[e.LogicalName].ContainsKey(attKey)) + 3929377                        AttributeMetadata[e.LogicalName].Add(attKey, attKey); + 7627378                } + 1067379            }  380  381 - 4774382        } + 4784382        }  383  384        protected internal bool AttributeExistsInMetadata(string sEntityName, string sAttributeName) - 2707385        { + 2712385        {  386            //Early bound types - 2707387             if (ProxyTypesAssembly != null) + 2712387             if (ProxyTypesAssembly != null)  2327388            {  389                //Check if attribute exists in the early bound type  2327390                var earlyBoundType = FindReflectedType(sEntityName); @@ -1121,8 +1123,8 @@

C:\Code\fake-xrm  393                    //Get that type properties  2327394                    var attributeFound = earlyBoundType  2327395                        .GetProperties() - 232168396                        .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0) - 229243397                        .Where(pi => (pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true)[0] as Attribut + 231985396                        .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0) + 229155397                        .Where(pi => (pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true)[0] as Attribut  2327398                        .FirstOrDefault();  399  2327400                    return attributeFound != null; @@ -1131,8 +1133,8 @@

C:\Code\fake-xrm  403            }  404  405            //Dynamic entities => just return true - 380406            return true; - 2707407        } + 385406            return true; + 2712407        }  408        #endregion  409  410    } @@ -1166,87 +1168,87 @@

C:\Code\fake-xrm-eas  21    /// </summary>  22    public partial class XrmFakedContext : IXrmContext  23    { - 129844124        protected Dictionary<string, Dictionary<string, string>> AttributeMetadata { get; set; } + 129856124        protected Dictionary<string, Dictionary<string, string>> AttributeMetadata { get; set; }  25 - 588926        protected internal IOrganizationService Service { get; set; } + 590426        protected internal IOrganizationService Service { get; set; }  27 - 258228        protected internal bool Initialised { get; set; } + 259228        protected internal bool Initialised { get; set; }  29 - 2695330        public Dictionary<string, Dictionary<Guid, Entity>> Data { get; set; } + 2701830        public Dictionary<string, Dictionary<Guid, Entity>> Data { get; set; }  31 - 3153532        public Assembly ProxyTypesAssembly { get; set; } + 3159032        public Assembly ProxyTypesAssembly { get; set; }  33  34        /// <summary>  35        /// Sets the user to assign the CreatedBy and ModifiedBy properties when entities are added to the context.  36        /// All requests will be executed on behalf of this user  37        /// </summary> - 1125338        public EntityReference CallerId { get; set; } + 1127838        public EntityReference CallerId { get; set; }  39  40        public delegate OrganizationResponse ServiceRequestExecution(OrganizationRequest req);  41  42        /// <summary>  43        /// Probably should be replaced by FakeMessageExecutors, more generic, which can use custom interfaces rather th  44        /// </summary> - 350645        private Dictionary<Type, ServiceRequestExecution> ExecutionMocks { get; set; } + 351145        private Dictionary<Type, ServiceRequestExecution> ExecutionMocks { get; set; }  46 - 496847        private Dictionary<Type, IFakeMessageExecutor> FakeMessageExecutors { get; set; } + 497347        private Dictionary<Type, IFakeMessageExecutor> FakeMessageExecutors { get; set; }  48 - 220949        private Dictionary<string, IFakeMessageExecutor> GenericFakeMessageExecutors { get; set; } + 221449        private Dictionary<string, IFakeMessageExecutor> GenericFakeMessageExecutors { get; set; }  50 - 491451        private Dictionary<string, XrmFakedRelationship> Relationships { get; set; } + 493451        private Dictionary<string, XrmFakedRelationship> Relationships { get; set; }  52 - 227953        public Dictionary<string, OptionSetMetadata> OptionSetValuesMetadata { get; set; } + 228453        public Dictionary<string, OptionSetMetadata> OptionSetValuesMetadata { get; set; }  54  19055        protected internal XrmFakedTracingService _tracingService { get; set; }  56 - 699857        public IEntityInitializerService EntityInitializerService { get; set; } - 239958        public IAccessRightsRepository AccessRightsRepository { get; set; } + 701357        public IEntityInitializerService EntityInitializerService { get; set; } + 240458        public IAccessRightsRepository AccessRightsRepository { get; set; }  59 - 220960        public XrmFakedContext() - 220961        { - 220962            AttributeMetadata = new Dictionary<string, Dictionary<string, string>>(); - 220963            Data = new Dictionary<string, Dictionary<Guid, Entity>>(); - 220964            ExecutionMocks = new Dictionary<Type, ServiceRequestExecution>(); - 220965            OptionSetValuesMetadata = new Dictionary<string, OptionSetMetadata>(); + 221460        public XrmFakedContext() + 221461        { + 221462            AttributeMetadata = new Dictionary<string, Dictionary<string, string>>(); + 221463            Data = new Dictionary<string, Dictionary<Guid, Entity>>(); + 221464            ExecutionMocks = new Dictionary<Type, ServiceRequestExecution>(); + 221465            OptionSetValuesMetadata = new Dictionary<string, OptionSetMetadata>();  66 - 220967            FakeMessageExecutors = Assembly.GetExecutingAssembly() - 220968                .GetTypes() - 29910369                .Where(t => t.GetInterfaces().Contains(typeof(IFakeMessageExecutor))) - 6053170                .Select(t => Activator.CreateInstance(t) as IFakeMessageExecutor) - 11885371                .ToDictionary(t => t.GetResponsibleRequestType(), t => t); + 221467            FakeMessageExecutors = Assembly.GetExecutingAssembly() + 221468                .GetTypes() + 30199469                .Where(t => t.GetInterfaces().Contains(typeof(IFakeMessageExecutor))) + 6066870                .Select(t => Activator.CreateInstance(t) as IFakeMessageExecutor) + 11912271                .ToDictionary(t => t.GetResponsibleRequestType(), t => t);  72 - 220973            GenericFakeMessageExecutors = new Dictionary<string, IFakeMessageExecutor>(); + 221473            GenericFakeMessageExecutors = new Dictionary<string, IFakeMessageExecutor>();  74 - 220975            Relationships = new Dictionary<string, XrmFakedRelationship>(); + 221475            Relationships = new Dictionary<string, XrmFakedRelationship>();  76 - 220977            EntityInitializerService = new DefaultEntityInitializerService(); + 221477            EntityInitializerService = new DefaultEntityInitializerService();  78 - 220979            AccessRightsRepository = new AccessRightsRepository(); - 220980        } + 221479            AccessRightsRepository = new AccessRightsRepository(); + 221480        }  81  82        /// <summary>  83        /// Initializes the context with the provided entities  84        /// </summary>  85        /// <param name="entities"></param>  86        public virtual void Initialize(IEnumerable<Entity> entities) - 130187        { - 130188             if (Initialised) + 130687        { + 130688             if (Initialised)  589            {  590                throw new Exception("Initialize should be called only once per unit test execution and XrmFakedContext i  91            }  92 - 129693             if (entities == null) + 130193             if (entities == null)  594            {  595                throw new InvalidOperationException("The entities parameter must be not null");  96            }  97 - 1194798            foreach (var e in entities) - 404299            { - 4042100                AddEntityWithDefaults(e); - 4032101            } + 1198298            foreach (var e in entities) + 405299            { + 4052100                AddEntityWithDefaults(e); + 4042101            }  102 - 1281103            Initialised = true; - 1281104        } + 1286103            Initialised = true; + 1286104        }  105  106        public void AddExecutionMock<T>(ServiceRequestExecution mock) where T : OrganizationRequest  15107        { @@ -1339,14 +1341,14 @@

C:\Code\fake-xrm-eas  10194        }  195  196        public virtual IOrganizationService GetOrganizationService() - 425197        { - 425198             if (this is XrmRealContext) + 430197        { + 430198             if (this is XrmRealContext)  0199            {  0200                Service = GetOrganizationService();  0201                return Service;  202            } - 425203            return GetFakedOrganizationService(this); - 425204        } + 430203            return GetFakedOrganizationService(this); + 430204        }  205  206        /// <summary>  207        /// Returns a faked organization service that works against this context @@ -1358,31 +1360,31 @@

C:\Code\fake-xrm-eas  1702213        }  214  215        protected IOrganizationService GetFakedOrganizationService(XrmFakedContext context) - 2127216        { - 2127217             if (context.Service != null) + 2132216        { + 2132217             if (context.Service != null)  537218            {  537219                return context.Service;  220            }  221 - 1590222            var fakedService = A.Fake<IOrganizationService>(); + 1595222            var fakedService = A.Fake<IOrganizationService>();  223  224            //Fake CRUD methods - 1590225            FakeRetrieve(context, fakedService); - 1590226            FakeCreate(context, fakedService); - 1590227            FakeUpdate(context, fakedService); - 1590228            FakeDelete(context, fakedService); + 1595225            FakeRetrieve(context, fakedService); + 1595226            FakeCreate(context, fakedService); + 1595227            FakeUpdate(context, fakedService); + 1595228            FakeDelete(context, fakedService);  229  230            //Fake / Intercept Retrieve Multiple Requests - 1590231            FakeRetrieveMultiple(context, fakedService); + 1595231            FakeRetrieveMultiple(context, fakedService);  232  233            //Fake / Intercept other requests - 1590234            FakeExecute(context, fakedService); - 1590235            FakeAssociate(context, fakedService); - 1590236            FakeDisassociate(context, fakedService); - 1590237            context.Service = fakedService; + 1595234            FakeExecute(context, fakedService); + 1595235            FakeAssociate(context, fakedService); + 1595236            FakeDisassociate(context, fakedService); + 1595237            context.Service = fakedService;  238 - 1590239            return context.Service; - 2127240        } + 1595239            return context.Service; + 2132240        }  241  242        /// <summary>  243        /// Fakes the Execute method of the organization service. @@ -1391,87 +1393,87 @@

C:\Code\fake-xrm-eas  246        /// <param name="context"></param>  247        /// <param name="fakedService"></param>  248        public static void FakeExecute(XrmFakedContext context, IOrganizationService fakedService) - 1590249        { - 1590250            A.CallTo(() => fakedService.Execute(A<OrganizationRequest>._)) - 1590251                .ReturnsLazily((OrganizationRequest req) => - 2837252                { - 1590253 - 2837254                     if (context.ExecutionMocks.ContainsKey(req.GetType())) - 1600255                    { - 1600256                        return context.ExecutionMocks[req.GetType()].Invoke(req); - 1590257                    } - 2827258                     if (context.FakeMessageExecutors.ContainsKey(req.GetType())) - 2827259                    { - 2827260                        return context.FakeMessageExecutors[req.GetType()].Execute(req, context); - 1590261                    } - 1590262                     if (req.GetType() == typeof(OrganizationRequest) && context.GenericFakeMessageExecutors.ContainsKey( - 1590263                    { - 1590264                        return context.GenericFakeMessageExecutors[req.RequestName].Execute(req,context); - 1590265                    } - 1590266 - 1590267                    throw PullRequestException.NotImplementedOrganizationRequest(req.GetType()); - 2692268                }); - 1590269        } + 1595249        { + 1595250            A.CallTo(() => fakedService.Execute(A<OrganizationRequest>._)) + 1595251                .ReturnsLazily((OrganizationRequest req) => + 2842252                { + 1595253 + 2842254                     if (context.ExecutionMocks.ContainsKey(req.GetType())) + 1605255                    { + 1605256                        return context.ExecutionMocks[req.GetType()].Invoke(req); + 1595257                    } + 2832258                     if (context.FakeMessageExecutors.ContainsKey(req.GetType())) + 2832259                    { + 2832260                        return context.FakeMessageExecutors[req.GetType()].Execute(req, context); + 1595261                    } + 1595262                     if (req.GetType() == typeof(OrganizationRequest) && context.GenericFakeMessageExecutors.ContainsKey( + 1595263                    { + 1595264                        return context.GenericFakeMessageExecutors[req.RequestName].Execute(req,context); + 1595265                    } + 1595266 + 1595267                    throw PullRequestException.NotImplementedOrganizationRequest(req.GetType()); + 2697268                }); + 1595269        }  270  271        public static void FakeAssociate(XrmFakedContext context, IOrganizationService fakedService) - 1590272        { - 1590273            A.CallTo(() => fakedService.Associate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollection - 1590274                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC - 1670275                { - 1590276 - 1670277                     if (context.FakeMessageExecutors.ContainsKey(typeof(AssociateRequest))) - 1670278                    { - 1670279                        var request = new AssociateRequest() - 1670280                        { - 1670281                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, - 1670282                            Relationship = relationship, - 1670283                            RelatedEntities = entityCollection - 1670284                        }; - 1670285                        context.FakeMessageExecutors[typeof(AssociateRequest)].Execute(request, context); - 1670286                    } - 1590287                    else - 1590288                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(AssociateRequest)); - 1670289                }); - 1590290        } + 1595272        { + 1595273            A.CallTo(() => fakedService.Associate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollection + 1595274                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC + 1675275                { + 1595276 + 1675277                     if (context.FakeMessageExecutors.ContainsKey(typeof(AssociateRequest))) + 1675278                    { + 1675279                        var request = new AssociateRequest() + 1675280                        { + 1675281                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, + 1675282                            Relationship = relationship, + 1675283                            RelatedEntities = entityCollection + 1675284                        }; + 1675285                        context.FakeMessageExecutors[typeof(AssociateRequest)].Execute(request, context); + 1675286                    } + 1595287                    else + 1595288                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(AssociateRequest)); + 1675289                }); + 1595290        }  291  292        public static void FakeDisassociate(XrmFakedContext context, IOrganizationService fakedService) - 1590293        { - 1590294            A.CallTo(() => fakedService.Disassociate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollect - 1590295                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC - 1605296                { - 1590297 - 1605298                     if (context.FakeMessageExecutors.ContainsKey(typeof(DisassociateRequest))) - 1605299                    { - 1605300                        var request = new DisassociateRequest() - 1605301                        { - 1605302                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, - 1605303                            Relationship = relationship, - 1605304                            RelatedEntities = entityCollection - 1605305                        }; - 1605306                        context.FakeMessageExecutors[typeof(DisassociateRequest)].Execute(request, context); - 1605307                    } - 1590308                    else - 1590309                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(DisassociateRequest)); - 1605310                }); - 1590311        } + 1595293        { + 1595294            A.CallTo(() => fakedService.Disassociate(A<string>._, A<Guid>._, A<Relationship>._, A<EntityReferenceCollect + 1595295                .Invokes((string entityName, Guid entityId, Relationship relationship, EntityReferenceCollection entityC + 1610296                { + 1595297 + 1610298                     if (context.FakeMessageExecutors.ContainsKey(typeof(DisassociateRequest))) + 1610299                    { + 1610300                        var request = new DisassociateRequest() + 1610301                        { + 1610302                            Target = new EntityReference() { Id = entityId, LogicalName = entityName }, + 1610303                            Relationship = relationship, + 1610304                            RelatedEntities = entityCollection + 1610305                        }; + 1610306                        context.FakeMessageExecutors[typeof(DisassociateRequest)].Execute(request, context); + 1610307                    } + 1595308                    else + 1595309                        throw PullRequestException.NotImplementedOrganizationRequest(typeof(DisassociateRequest)); + 1610310                }); + 1595311        }  312  313        public static void FakeRetrieveMultiple(XrmFakedContext context, IOrganizationService fakedService) - 1590314        { + 1595314        {  315            //refactored from RetrieveMultipleExecutor - 1590316            A.CallTo(() => fakedService.RetrieveMultiple(A<QueryBase>._)) - 1590317                .ReturnsLazily((QueryBase req) => - 2096318                { - 2096319                    var request = new RetrieveMultipleRequest() - 2096320                    { - 2096321                        Query = req - 2096322                    }; - 1590323 - 2096324                    var executor = new RetrieveMultipleRequestExecutor(); - 2096325                    var response = executor.Execute(request, context) as RetrieveMultipleResponse; - 1590326 - 2076327                    return response.EntityCollection; - 2076328                }); - 1590329        } + 1595316            A.CallTo(() => fakedService.RetrieveMultiple(A<QueryBase>._)) + 1595317                .ReturnsLazily((QueryBase req) => + 2106318                { + 2106319                    var request = new RetrieveMultipleRequest() + 2106320                    { + 2106321                        Query = req + 2106322                    }; + 1595323 + 2106324                    var executor = new RetrieveMultipleRequestExecutor(); + 2106325                    var response = executor.Execute(request, context) as RetrieveMultipleResponse; + 1595326 + 2086327                    return response.EntityCollection; + 2086328                }); + 1595329        }  330  331  332    } @@ -1551,219 +1553,238 @@

C:\Code\fake-  7532                PostEntityImages = new EntityImageCollection()  7533            };  7534        }35        protected IPluginExecutionContext GetFakedPluginContext(XrmFakedPluginExecutionContext ctx) - 10036        { - 10037            var context = A.Fake<IPluginExecutionContext>();38 - 10039            var newUserId = Guid.NewGuid();40 - 10541            A.CallTo(() => context.Depth).ReturnsLazily(() => ctx.Depth <= 0 ? 1 : ctx.Depth); - 10042            A.CallTo(() => context.IsExecutingOffline).ReturnsLazily(() => ctx.IsExecutingOffline); - 19543            A.CallTo(() => context.InputParameters).ReturnsLazily(() => ctx.InputParameters); - 12044            A.CallTo(() => context.OutputParameters).ReturnsLazily(() => ctx.OutputParameters); - 10045            A.CallTo(() => context.PreEntityImages).ReturnsLazily(() => ctx.PreEntityImages); - 10046            A.CallTo(() => context.PostEntityImages).ReturnsLazily(() => ctx.PostEntityImages); - 14547            A.CallTo(() => context.MessageName).ReturnsLazily(() => ctx.MessageName); - 10048            A.CallTo(() => context.Mode).ReturnsLazily(() => ctx.Mode); - 10549            A.CallTo(() => context.OrganizationName).ReturnsLazily(() => ctx.OrganizationName); - 10050            A.CallTo(() => context.OrganizationId).ReturnsLazily(() => ctx.OrganizationId); - 12051            A.CallTo(() => context.InitiatingUserId).ReturnsLazily(() => ctx.InitiatingUserId == Guid.Empty ? newUserId  - 15552            A.CallTo(() => context.UserId).ReturnsLazily(() => ctx.UserId == Guid.Empty ? newUserId : ctx.UserId); - 10053            A.CallTo(() => context.ParentContext).ReturnsLazily(() => ctx.ParentContext); - 12054            A.CallTo(() => context.Stage).ReturnsLazily(() => ctx.Stage); - 10555            A.CallTo(() => context.PrimaryEntityName).ReturnsLazily(() => ctx.PrimaryEntityName); - 10056            A.CallTo(() => context.SecondaryEntityName).ReturnsLazily(() => ctx.SecondaryEntityName); - 10557            A.CallTo(() => context.SharedVariables).ReturnsLazily(() => ctx.SharedVariables);5859            //Create message will pass an Entity as the target but this is not always true60            //For instance, a Delete request will receive an EntityReference - 10061             if (ctx.InputParameters != null && - 10062                ctx.InputParameters.ContainsKey("Target") && - 10063                ctx.InputParameters["Target"] is Entity) - 8564            { - 8565                var target = ctx.InputParameters["Target"] as Entity; - 8566                A.CallTo(() => context.PrimaryEntityId).ReturnsLazily(() => target.Id); - 11067                A.CallTo(() => context.PrimaryEntityName).ReturnsLazily(() => target.LogicalName); - 8568            }69 - 10070            return context; - 10071        }7273        public IPlugin ExecutePluginWith<T>(XrmFakedPluginExecutionContext ctx, T instance) where T : IPlugin, new() - 7074        { - 7075            var fakedServiceProvider = GetFakedServiceProvider(ctx);76 - 7077            var fakedPlugin = A.Fake<IPlugin>(); - 7078            A.CallTo(() => fakedPlugin.Execute(A<IServiceProvider>._)) - 7079                .Invokes((IServiceProvider provider) => - 14080                { - 14081                    var plugin = instance; - 14082                    plugin.Execute(fakedServiceProvider); - 13583                });3536        protected IPluginExecutionContext GetFakedPluginContext(XrmFakedPluginExecutionContext ctx) + 10037        { + 10038            var context = A.Fake<IPluginExecutionContext>();39 + 10040            PopulateExecutionContextPropertiesFromFakedContext(context, ctx);41 + 10042            A.CallTo(() => context.ParentContext).ReturnsLazily(() => ctx.ParentContext); + 12043            A.CallTo(() => context.Stage).ReturnsLazily(() => ctx.Stage);44 + 10045            return context; + 10046        }4748        protected void PopulateExecutionContextPropertiesFromFakedContext(IExecutionContext context, XrmFakedPluginExecu + 10049        { + 10050            var newUserId = Guid.NewGuid();51 + 10552            A.CallTo(() => context.Depth).ReturnsLazily(() => ctx.Depth <= 0 ? 1 : ctx.Depth); + 10053            A.CallTo(() => context.IsExecutingOffline).ReturnsLazily(() => ctx.IsExecutingOffline); + 19554            A.CallTo(() => context.InputParameters).ReturnsLazily(() => ctx.InputParameters); + 12055            A.CallTo(() => context.OutputParameters).ReturnsLazily(() => ctx.OutputParameters); + 10056            A.CallTo(() => context.PreEntityImages).ReturnsLazily(() => ctx.PreEntityImages); + 10057            A.CallTo(() => context.PostEntityImages).ReturnsLazily(() => ctx.PostEntityImages); + 14558            A.CallTo(() => context.MessageName).ReturnsLazily(() => ctx.MessageName); + 10059            A.CallTo(() => context.Mode).ReturnsLazily(() => ctx.Mode); + 10560            A.CallTo(() => context.OrganizationName).ReturnsLazily(() => ctx.OrganizationName); + 10061            A.CallTo(() => context.OrganizationId).ReturnsLazily(() => ctx.OrganizationId); + 12062            A.CallTo(() => context.InitiatingUserId).ReturnsLazily(() => ctx.InitiatingUserId == Guid.Empty ? newUserId  + 15563            A.CallTo(() => context.UserId).ReturnsLazily(() => ctx.UserId == Guid.Empty ? newUserId : ctx.UserId); + 10564            A.CallTo(() => context.PrimaryEntityName).ReturnsLazily(() => ctx.PrimaryEntityName); + 10065            A.CallTo(() => context.SecondaryEntityName).ReturnsLazily(() => ctx.SecondaryEntityName); + 10566            A.CallTo(() => context.SharedVariables).ReturnsLazily(() => ctx.SharedVariables);6768            //Create message will pass an Entity as the target but this is not always true69            //For instance, a Delete request will receive an EntityReference + 10070             if (ctx.InputParameters != null && + 10071                ctx.InputParameters.ContainsKey("Target") && + 10072                ctx.InputParameters["Target"] is Entity) + 8573            { + 8574                var target = ctx.InputParameters["Target"] as Entity; + 8575                A.CallTo(() => context.PrimaryEntityId).ReturnsLazily(() => target.Id); + 11076                A.CallTo(() => context.PrimaryEntityName).ReturnsLazily(() => target.LogicalName); + 8577            } + 10078        }79        protected IExecutionContext GetFakedExecutionContext(XrmFakedPluginExecutionContext ctx) + 080        { + 081            var context = A.Fake<IExecutionContext>();82 + 083            PopulateExecutionContextPropertiesFromFakedContext(context, ctx);  84 - 7085            fakedPlugin.Execute(fakedServiceProvider); //Execute the plugin - 6586            return fakedPlugin; - 6587        }88        public IPlugin ExecutePluginWith<T>(XrmFakedPluginExecutionContext ctx) where T : IPlugin, new() - 6589        { - 6590            return this.ExecutePluginWith<T>(ctx, new T()); - 6091        }9293        public IPlugin ExecutePluginWith<T>(ParameterCollection inputParameters,94                                     ParameterCollection outputParameters,95                                     EntityImageCollection preEntityImages,96                                     EntityImageCollection postEntityImages) where T : IPlugin, new() - 2097        { - 2098            var ctx = new XrmFakedPluginExecutionContext(); - 2099            ctx.InputParameters = inputParameters; - 20100            ctx.PreEntityImages = preEntityImages; - 20101            ctx.OutputParameters = outputParameters; - 20102            ctx.PostEntityImages = postEntityImages;103 - 20104            var fakedServiceProvider = GetFakedServiceProvider(ctx);105 - 20106            var fakedPlugin = A.Fake<IPlugin>(); - 20107            A.CallTo(() => fakedPlugin.Execute(A<IServiceProvider>._)) - 20108                .Invokes((IServiceProvider provider) => - 40109                { - 40110                    var plugin = new T(); - 40111                    plugin.Execute(fakedServiceProvider); - 40112                });113 - 20114            fakedPlugin.Execute(fakedServiceProvider); //Execute the plugin - 20115            return fakedPlugin; - 20116        }117118        public IPlugin ExecutePluginWithConfigurations<T>(XrmFakedPluginExecutionContext plugCtx,119                                     string unsecureConfiguration,120                                     string secureConfiguration) where T : class, IPlugin - 20121        { - 20122            var pluginType = typeof(T); - 20123            var constructors = pluginType.GetConstructors().ToList();124 - 20125             if (!constructors.Any( - 45126                            constructor => constructor.GetParameters().ToList().Count == 2 - 65127                                && constructor.GetParameters().All(param => param.ParameterType == typeof(string)))) - 10128            { - 10129                throw new ArgumentException("The plugin you are trying to execute does not specify a constructor for pas130            }131 - 10132            var pluginInstance = (T)Activator.CreateInstance(typeof(T), unsecureConfiguration, secureConfiguration); - 10133            return this.ExecutePluginWithConfigurations<T>(plugCtx, pluginInstance, unsecureConfiguration, secureConfigu134 - 10135        }136137        public IPlugin ExecutePluginWithConfigurations<T>(XrmFakedPluginExecutionContext plugCtx,138                                     T instance,139                                     string unsecureConfiguration,140                                     string secureConfiguration) where T : class, IPlugin - 10141        { - 10142            var fakedServiceProvider = GetFakedServiceProvider(plugCtx);143 - 10144            var fakedPlugin = A.Fake<IPlugin>();145 - 10146            A.CallTo(() => fakedPlugin.Execute(A<IServiceProvider>._)) - 10147                .Invokes((IServiceProvider provider) => - 20148                { - 20149                    var pluginType = typeof(T); - 20150                    var constructors = pluginType.GetConstructors().ToList(); - 10151 - 20152                     if (!constructors.Any( - 35153                            constructor => constructor.GetParameters().ToList().Count == 2 - 55154                                && constructor.GetParameters().All(param => param.ParameterType == typeof(string)))) - 10155                    { - 10156                        throw new ArgumentException("The plugin you are trying to execute does not specify a constructor - 10157                    } - 10158 - 20159                    var plugin = instance; - 20160                    plugin.Execute(fakedServiceProvider); - 20161                });162 - 10163            fakedPlugin.Execute(fakedServiceProvider); //Execute the plugin - 10164            return fakedPlugin; - 10165        }166167        /// <summary>168        /// Executes the plugin of type T against the faked context for an entity target169        /// and returns the faked plugin170        /// </summary>171        /// <typeparam name="T"></typeparam>172        /// <param name="target"></param>173        /// <returns></returns>174        public IPlugin ExecutePluginWithTarget<T>(Entity target) where T: IPlugin, new() - 30175        {176            //Add the target entity to the InputParameters - 30177            ParameterCollection inputParameters = new ParameterCollection(); - 30178            inputParameters.Add("Target", target);179 - 30180            XrmFakedPluginExecutionContext ctx = GetDefaultPluginContext(); - 30181            ctx.InputParameters = inputParameters;182 - 30183            return this.ExecutePluginWith<T>(ctx); - 25184        }185186        public IPlugin ExecutePluginWithTargetAndPreEntityImages<T>(object target, EntityImageCollection preEntityImages - 0187        {188            //Add the target entity to the InputParameters - 0189            ParameterCollection inputParameters = new ParameterCollection(); - 0190            inputParameters.Add("Target", target);191 - 0192            XrmFakedPluginExecutionContext ctx = GetDefaultPluginContext(); - 0193            ctx.InputParameters = inputParameters; - 0194            ctx.PreEntityImages = preEntityImages;195 - 0196            return this.ExecutePluginWith<T>(ctx); - 0197        }198199        protected IServiceProvider GetFakedServiceProvider(XrmFakedPluginExecutionContext plugCtx) - 100200        { - 100201            var fakedServiceProvider = A.Fake<IServiceProvider>();202 - 100203            A.CallTo(() => fakedServiceProvider.GetService(A<Type>._)) - 100204               .ReturnsLazily((Type t) => - 300205               { - 300206                    if (t.Equals(typeof(IOrganizationService))) - 105207                   { - 100208                       //Return faked or real organization service - 105209                       return GetOrganizationService(); - 100210                   } - 295211                    else if (t.Equals(typeof(ITracingService))) - 160212                   { - 160213                       _tracingService = new XrmFakedTracingService(); - 160214                       return _tracingService; - 100215                   } - 235216                    else if (t.Equals(typeof(IPluginExecutionContext))) - 200217                   { - 200218                       return GetFakedPluginContext(plugCtx); - 100219                   } - 135220                    else if (t.Equals(typeof(IOrganizationServiceFactory))) - 135221                   { - 135222                       var fakedServiceFactory = A.Fake<IOrganizationServiceFactory>(); - 135223                       A.CallTo(() => fakedServiceFactory.CreateOrganizationService(A<Guid?>._)) - 135224                            .ReturnsLazily((Guid? g) => - 170225                            { - 170226                                return GetOrganizationService(); - 170227                            }); - 135228                       return fakedServiceFactory; - 100229                   } - 100230                    else if (t.Equals(typeof(IServiceEndpointNotificationService))) - 100231                   { - 100232                       var fakedNotificationService = A.Fake<IServiceEndpointNotificationService>(); - 100233                       return fakedNotificationService; + 085            return context; + 086        }8788        public IPlugin ExecutePluginWith<T>(XrmFakedPluginExecutionContext ctx, T instance) where T : IPlugin, new() + 7089        { + 7090            var fakedServiceProvider = GetFakedServiceProvider(ctx);91 + 7092            var fakedPlugin = A.Fake<IPlugin>(); + 7093            A.CallTo(() => fakedPlugin.Execute(A<IServiceProvider>._)) + 7094                .Invokes((IServiceProvider provider) => + 14095                { + 14096                    var plugin = instance; + 14097                    plugin.Execute(fakedServiceProvider); + 13598                });99 + 70100            fakedPlugin.Execute(fakedServiceProvider); //Execute the plugin + 65101            return fakedPlugin; + 65102        }103        public IPlugin ExecutePluginWith<T>(XrmFakedPluginExecutionContext ctx) where T : IPlugin, new() + 65104        { + 65105            return this.ExecutePluginWith<T>(ctx, new T()); + 60106        }107108        public IPlugin ExecutePluginWith<T>(ParameterCollection inputParameters,109                                     ParameterCollection outputParameters,110                                     EntityImageCollection preEntityImages,111                                     EntityImageCollection postEntityImages) where T : IPlugin, new() + 20112        { + 20113            var ctx = new XrmFakedPluginExecutionContext(); + 20114            ctx.InputParameters = inputParameters; + 20115            ctx.PreEntityImages = preEntityImages; + 20116            ctx.OutputParameters = outputParameters; + 20117            ctx.PostEntityImages = postEntityImages;118 + 20119            var fakedServiceProvider = GetFakedServiceProvider(ctx);120 + 20121            var fakedPlugin = A.Fake<IPlugin>(); + 20122            A.CallTo(() => fakedPlugin.Execute(A<IServiceProvider>._)) + 20123                .Invokes((IServiceProvider provider) => + 40124                { + 40125                    var plugin = new T(); + 40126                    plugin.Execute(fakedServiceProvider); + 40127                });128 + 20129            fakedPlugin.Execute(fakedServiceProvider); //Execute the plugin + 20130            return fakedPlugin; + 20131        }132133        public IPlugin ExecutePluginWithConfigurations<T>(XrmFakedPluginExecutionContext plugCtx,134                                     string unsecureConfiguration,135                                     string secureConfiguration) where T : class, IPlugin + 20136        { + 20137            var pluginType = typeof(T); + 20138            var constructors = pluginType.GetConstructors().ToList();139 + 20140             if (!constructors.Any( + 45141                            constructor => constructor.GetParameters().ToList().Count == 2 + 65142                                && constructor.GetParameters().All(param => param.ParameterType == typeof(string)))) + 10143            { + 10144                throw new ArgumentException("The plugin you are trying to execute does not specify a constructor for pas145            }146 + 10147            var pluginInstance = (T)Activator.CreateInstance(typeof(T), unsecureConfiguration, secureConfiguration); + 10148            return this.ExecutePluginWithConfigurations<T>(plugCtx, pluginInstance, unsecureConfiguration, secureConfigu149 + 10150        }151152        public IPlugin ExecutePluginWithConfigurations<T>(XrmFakedPluginExecutionContext plugCtx,153                                     T instance,154                                     string unsecureConfiguration,155                                     string secureConfiguration) where T : class, IPlugin + 10156        { + 10157            var fakedServiceProvider = GetFakedServiceProvider(plugCtx);158 + 10159            var fakedPlugin = A.Fake<IPlugin>();160 + 10161            A.CallTo(() => fakedPlugin.Execute(A<IServiceProvider>._)) + 10162                .Invokes((IServiceProvider provider) => + 20163                { + 20164                    var pluginType = typeof(T); + 20165                    var constructors = pluginType.GetConstructors().ToList(); + 10166 + 20167                     if (!constructors.Any( + 35168                            constructor => constructor.GetParameters().ToList().Count == 2 + 55169                                && constructor.GetParameters().All(param => param.ParameterType == typeof(string)))) + 10170                    { + 10171                        throw new ArgumentException("The plugin you are trying to execute does not specify a constructor + 10172                    } + 10173 + 20174                    var plugin = instance; + 20175                    plugin.Execute(fakedServiceProvider); + 20176                });177 + 10178            fakedPlugin.Execute(fakedServiceProvider); //Execute the plugin + 10179            return fakedPlugin; + 10180        }181182        /// <summary>183        /// Executes the plugin of type T against the faked context for an entity target184        /// and returns the faked plugin185        /// </summary>186        /// <typeparam name="T"></typeparam>187        /// <param name="target"></param>188        /// <returns></returns>189        public IPlugin ExecutePluginWithTarget<T>(Entity target) where T: IPlugin, new() + 30190        {191            //Add the target entity to the InputParameters + 30192            ParameterCollection inputParameters = new ParameterCollection(); + 30193            inputParameters.Add("Target", target);194 + 30195            XrmFakedPluginExecutionContext ctx = GetDefaultPluginContext(); + 30196            ctx.InputParameters = inputParameters;197 + 30198            return this.ExecutePluginWith<T>(ctx); + 25199        }200201        public IPlugin ExecutePluginWithTargetAndPreEntityImages<T>(object target, EntityImageCollection preEntityImages + 0202        {203            //Add the target entity to the InputParameters + 0204            ParameterCollection inputParameters = new ParameterCollection(); + 0205            inputParameters.Add("Target", target);206 + 0207            XrmFakedPluginExecutionContext ctx = GetDefaultPluginContext(); + 0208            ctx.InputParameters = inputParameters; + 0209            ctx.PreEntityImages = preEntityImages;210 + 0211            return this.ExecutePluginWith<T>(ctx); + 0212        }213214        protected IServiceProvider GetFakedServiceProvider(XrmFakedPluginExecutionContext plugCtx) + 100215        { + 100216            var fakedServiceProvider = A.Fake<IServiceProvider>();217 + 100218            A.CallTo(() => fakedServiceProvider.GetService(A<Type>._)) + 100219               .ReturnsLazily((Type t) => + 300220               { + 300221                    if (t.Equals(typeof(IOrganizationService))) + 105222                   { + 100223                       //Return faked or real organization service + 105224                       return GetOrganizationService(); + 100225                   } + 295226                    else if (t.Equals(typeof(ITracingService))) + 160227                   { + 160228                       _tracingService = new XrmFakedTracingService(); + 160229                       return _tracingService; + 100230                   } + 235231                    else if (t.Equals(typeof(IPluginExecutionContext))) + 200232                   { + 200233                       return GetFakedPluginContext(plugCtx);  100234                   } - 100235                   throw new PullRequestException("The specified service type is not supported"); - 300236               });237 - 100238            return fakedServiceProvider; - 100239        }240241        public XrmFakedTracingService GetFakeTracingService() - 10242        { - 10243            return _tracingService; - 10244        }245246    }247} + 135235                    else if (t.Equals(typeof(IExecutionContext))) + 100236                   { + 100237                       return GetFakedExecutionContext(plugCtx); + 100238                   } + 135239                    else if (t.Equals(typeof(IOrganizationServiceFactory))) + 135240                   { + 135241                       var fakedServiceFactory = A.Fake<IOrganizationServiceFactory>(); + 135242                       A.CallTo(() => fakedServiceFactory.CreateOrganizationService(A<Guid?>._)) + 135243                            .ReturnsLazily((Guid? g) => + 170244                            { + 170245                                return GetOrganizationService(); + 170246                            }); + 135247                       return fakedServiceFactory; + 100248                   } + 100249                    else if (t.Equals(typeof(IServiceEndpointNotificationService))) + 100250                   { + 100251                       var fakedNotificationService = A.Fake<IServiceEndpointNotificationService>(); + 100252                       return fakedNotificationService; + 100253                   } + 100254                   throw new PullRequestException("The specified service type is not supported"); + 300255               });256 + 100257            return fakedServiceProvider; + 100258        }259260        public XrmFakedTracingService GetFakeTracingService() + 10261        { + 10262            return _tracingService; + 10263        }264265    }266}

C:\Code\fake-xrm-easy\FakeXrmEasy.Shared\XrmFakedContext.Queries.cs

@@ -1797,21 +1818,21 @@

C:\Code\fake-  25    public partial class XrmFakedContext : IXrmContext  26    {  27        protected internal Type FindReflectedType(string sLogicalName) - 1296028        { - 1296029            Assembly assembly = this.ProxyTypesAssembly; + 1297028        { + 1297029            Assembly assembly = this.ProxyTypesAssembly;  30            try - 1296031            { - 1296032                 if (assembly == null) - 53933                { - 53934                    assembly = Assembly.GetExecutingAssembly(); - 53935                } - 1296036                var subClassType = assembly.GetTypes() - 134254437                        .Where(t => typeof(Entity).IsAssignableFrom(t)) - 72707038                        .Where(t => t.GetCustomAttributes(typeof(EntityLogicalNameAttribute), true).Length > 0) - 72707039                        .Where(t => ((EntityLogicalNameAttribute)t.GetCustomAttributes(typeof(EntityLogicalNameAttribute - 1296040                        .FirstOrDefault(); + 1297031            { + 1297032                 if (assembly == null) + 54933                { + 54934                    assembly = Assembly.GetExecutingAssembly(); + 54935                } + 1297036                var subClassType = assembly.GetTypes() + 134444737                        .Where(t => typeof(Entity).IsAssignableFrom(t)) + 72708038                        .Where(t => t.GetCustomAttributes(typeof(EntityLogicalNameAttribute), true).Length > 0) + 72708039                        .Where(t => ((EntityLogicalNameAttribute)t.GetCustomAttributes(typeof(EntityLogicalNameAttribute + 1297040                        .FirstOrDefault();  41 - 1296042                return subClassType; + 1297042                return subClassType;  43            }  044            catch (System.Reflection.ReflectionTypeLoadException ex)  045            { @@ -1826,15 +1847,15 @@

C:\Code\fake-  054                throw new Exception("XrmFakedContext.FindReflectedType: " + s);  55            }  56 - 1296057        } + 1297057        }  58  59        protected internal Type FindReflectedAttributeType(Type earlyBoundType, string sAttributeName)  141060        {  61            //Get that type properties  141062            var attributeInfo = earlyBoundType  141063                .GetProperties() - 10000264                .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0) - 9894665                .Where(pi => (pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true)[0] as AttributeLogical + 9986864                .Where(pi => pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true).Length > 0) + 9893465                .Where(pi => (pi.GetCustomAttributes(typeof(AttributeLogicalNameAttribute), true)[0] as AttributeLogical  141066                .FirstOrDefault();  67  141068             if(attributeInfo == null) @@ -1858,12 +1879,12 @@

C:\Code\fake-  29086            }  87#if FAKE_XRM_EASY_2015 || FAKE_XRM_EASY_2016 || FAKE_XRM_EASY_365  67588             else if (attributeInfo.PropertyType.FullName.StartsWith("System.Nullable")) - 39989            { - 39990                return attributeInfo.PropertyType.GenericTypeArguments[0]; + 39689            { + 39690                return attributeInfo.PropertyType.GenericTypeArguments[0];  91            }  92#endif  93 - 101194            return attributeInfo.PropertyType; + 101494            return attributeInfo.PropertyType;  141095        }  96  97        public IQueryable<Entity> CreateQuery(string entityLogicalName) @@ -1895,76 +1916,76 @@

C:\Code\fake-  105123        }  124  125        protected IQueryable<T> CreateQuery<T>(string entityLogicalName) where T : Entity - 2752126        { - 2752127            List<T> lst = new List<T>(); - 2752128            var subClassType = FindReflectedType(entityLogicalName); - 2752129             if ((subClassType == null && !(typeof(T).Equals(typeof(Entity)))) - 2752130                || (typeof(T).Equals(typeof(Entity)) && string.IsNullOrWhiteSpace(entityLogicalName))) + 2762126        { + 2762127            List<T> lst = new List<T>(); + 2762128            var subClassType = FindReflectedType(entityLogicalName); + 2762129             if ((subClassType == null && !(typeof(T).Equals(typeof(Entity)))) + 2762130                || (typeof(T).Equals(typeof(Entity)) && string.IsNullOrWhiteSpace(entityLogicalName)))  5131            {  5132                throw new Exception(string.Format("The type {0} was not found", entityLogicalName));  133            }  134 - 2747135             if (!Data.ContainsKey(entityLogicalName)) + 2757135             if (!Data.ContainsKey(entityLogicalName))  114136            {  114137                return lst.AsQueryable<T>(); //Empty list  138            }  139 - 44639140            foreach (var e in Data[entityLogicalName].Values) - 18370141            { - 18370142                 if (subClassType != null) + 44689140            foreach (var e in Data[entityLogicalName].Values) + 18380141            { + 18380142                 if (subClassType != null)  17463143                {  17463144                    var cloned = e.Clone(subClassType);  17463145                    lst.Add((T)cloned);  17463146                }  147                else - 907148                    lst.Add((T)e.Clone()); - 18370149            } + 917148                    lst.Add((T)e.Clone()); + 18380149            }  150 - 2633151            return lst.AsQueryable<T>(); - 2747152        } + 2643151            return lst.AsQueryable<T>(); + 2757152        }  153  154        public IQueryable<Entity> CreateQueryFromEntityName(string s)  0155        {  0156            return Data[s].Values.AsQueryable();  0157        }  158 - 477159        public static IQueryable<Entity> TranslateLinkedEntityToLinq(XrmFakedContext context, LinkEntity le, IQueryable< + 482159        public static IQueryable<Entity> TranslateLinkedEntityToLinq(XrmFakedContext context, LinkEntity le, IQueryable<  160 - 477161            var leAlias = string.IsNullOrWhiteSpace(le.EntityAlias) ? le.LinkToEntityName : le.EntityAlias; - 477162            context.EnsureEntityNameExistsInMetadata(le.LinkFromEntityName); - 477163            context.EnsureEntityNameExistsInMetadata(le.LinkToEntityName); + 482161            var leAlias = string.IsNullOrWhiteSpace(le.EntityAlias) ? le.LinkToEntityName : le.EntityAlias; + 482162            context.EnsureEntityNameExistsInMetadata(le.LinkFromEntityName); + 482163            context.EnsureEntityNameExistsInMetadata(le.LinkToEntityName);  164 - 477165             if (!context.AttributeExistsInMetadata(le.LinkToEntityName, le.LinkToAttributeName)) + 482165             if (!context.AttributeExistsInMetadata(le.LinkToEntityName, le.LinkToAttributeName))  10166            {  10167                OrganizationServiceFaultQueryBuilderNoAttributeException.Throw(le.LinkToAttributeName);  0168            }  169 - 467170            var inner = context.CreateQuery<Entity>(le.LinkToEntityName); + 472170            var inner = context.CreateQuery<Entity>(le.LinkToEntityName);  171  172            //if (!le.Columns.AllColumns && le.Columns.Columns.Count == 0)  173            //{  174            //    le.Columns.AllColumns = true;   //Add all columns in the joined entity, otherwise we can't filter by r  175            //}  176 - 467177             if (string.IsNullOrWhiteSpace(linkFromAlias)) - 407178            { - 407179                linkFromAlias = le.LinkFromAttributeName; - 407180            } + 472177             if (string.IsNullOrWhiteSpace(linkFromAlias)) + 412178            { + 412179                linkFromAlias = le.LinkFromAttributeName; + 412180            }  181            else  60182            {  60183                linkFromAlias += "." + le.LinkFromAttributeName;  60184            }  185 - 467186             switch (le.JoinOperator) + 472186             switch (le.JoinOperator)  187            {  188                case JoinOperator.Inner:  189                case JoinOperator.Natural: - 424190                    query = query.Join(inner, - 424191                                    outerKey => outerKey.KeySelector(linkFromAlias, context), - 424192                                    innerKey => innerKey.KeySelector(le.LinkToAttributeName, context), - 424193                                    (outerEl, innerEl) => outerEl.JoinAttributes(innerEl, new ColumnSet(true), leAlias,  + 429190                    query = query.Join(inner, + 429191                                    outerKey => outerKey.KeySelector(linkFromAlias, context), + 429192                                    innerKey => innerKey.KeySelector(le.LinkToAttributeName, context), + 429193                                    (outerEl, innerEl) => outerEl.JoinAttributes(innerEl, new ColumnSet(true), leAlias,   194 - 424195                    break; + 429195                    break;  196                case JoinOperator.LeftOuter:  43197                    query = query.GroupJoin(inner,  43198                                    outerKey => outerKey.KeySelector(le.LinkFromAttributeName, context), @@ -1982,15 +2003,15 @@

C:\Code\fake-  210            }  211  212            //Process nested linked entities recursively - 1521213            foreach (LinkEntity nestedLinkedEntity in le.LinkEntities) + 1536213            foreach (LinkEntity nestedLinkedEntity in le.LinkEntities)  60214            {  60215                 if (string.IsNullOrWhiteSpace(le.EntityAlias))  15216                    le.EntityAlias = le.LinkToEntityName;  217  60218                query = TranslateLinkedEntityToLinq(context, nestedLinkedEntity, query, le.Columns, le.EntityAlias);  60219            } - 467220            return query; - 467221        } + 472220            return query; + 472221        }  222  223  224 @@ -2063,35 +2084,35 @@

C:\Code\fake-  573291        }  292  293        public static IQueryable<Entity> TranslateQueryExpressionToLinq(XrmFakedContext context, QueryExpression qe) - 1231294        { - 1236295             if (qe == null) return null; + 1236294        { + 1241295             if (qe == null) return null;  296  297            //Start form the root entity and build a LINQ query to execute the query against the In-Memory context: - 1226298            context.EnsureEntityNameExistsInMetadata(qe.EntityName); + 1231298            context.EnsureEntityNameExistsInMetadata(qe.EntityName);  299 - 1226300            IQueryable<Entity> query = null; + 1231300            IQueryable<Entity> query = null;  301 - 1226302            query = context.CreateQuery<Entity>(qe.EntityName); + 1231302            query = context.CreateQuery<Entity>(qe.EntityName);  303  304            //Add as many Joins as linked entities - 4502305            foreach (LinkEntity le in qe.LinkEntities) - 417306            { - 417307                query = TranslateLinkedEntityToLinq(context, le, query, qe.ColumnSet); - 407308            } + 4527305            foreach (LinkEntity le in qe.LinkEntities) + 422306            { + 422307                query = TranslateLinkedEntityToLinq(context, le, query, qe.ColumnSet); + 412308            }  309  310            // Compose the expression tree that represents the parameter to the predicate. - 1216311            ParameterExpression entity = Expression.Parameter(typeof(Entity)); - 1216312            var expTreeBody = TranslateQueryExpressionFiltersToExpression(context, qe, entity); - 1201313            Expression<Func<Entity, bool>> lambda = Expression.Lambda<Func<Entity, bool>>(expTreeBody, entity); - 1201314            query = query.Where(lambda); + 1221311            ParameterExpression entity = Expression.Parameter(typeof(Entity)); + 1221312            var expTreeBody = TranslateQueryExpressionFiltersToExpression(context, qe, entity); + 1206313            Expression<Func<Entity, bool>> lambda = Expression.Lambda<Func<Entity, bool>>(expTreeBody, entity); + 1206314            query = query.Where(lambda);  315  316            //Project the attributes in the root column set  (must be applied after the where clause, not before!!) - 1201317            query = query.Select(x => x.Clone(x.GetType()).ProjectAttributes(qe, context)); + 1206317            query = query.Select(x => x.Clone(x.GetType()).ProjectAttributes(qe, context));  318  319            //Sort results - 1201320             if (qe.Orders != null) - 1201321            { - 1201322                 if(qe.Orders.Count > 0) + 1206320             if (qe.Orders != null) + 1206321            { + 1206322                 if(qe.Orders.Count > 0)  105323                {  105324                    IOrderedQueryable<Entity> orderedQuery = null;  325 @@ -2113,23 +2134,23 @@

C:\Code\fake-  341  105342                    query = orderedQuery;  105343                } - 1201344            } + 1206344            }  345  346            //Apply TopCount  347 - 1201348             if (qe.PageInfo!=null && qe.PageInfo.Count >0 && qe.PageInfo.PageNumber>0) + 1206348             if (qe.PageInfo!=null && qe.PageInfo.Count >0 && qe.PageInfo.PageNumber>0)  135349            {  350                //selecting 1 extra to get calculate if there are more records to fetch  135351                query = query.Skip(qe.PageInfo.Count * (qe.PageInfo.PageNumber - 1));  135352            }  353 - 1201354             if (qe.TopCount != null) + 1206354             if (qe.TopCount != null)  140355            {  356                //selecting 1 extra to get calculate if there are more records to fetch  140357                query = query.Take(qe.TopCount.Value );  140358            } - 1201359            return query; - 1206360        } + 1206359            return query; + 1211360        }  361  362  363        protected static Expression TranslateConditionExpression(QueryExpression qe, XrmFakedContext context, TypedCondi @@ -2442,19 +2463,19 @@

C:\Code\fake-  670                            return GetAppropiateCastExpressionBasedGuid(input);  671                    #endif  1986672                     if (attributeType == typeof(Guid) || attributeType == typeof(EntityReference)) - 564673                        return GetAppropiateCastExpressionBasedGuid(input); - 1422674                     if (attributeType == typeof(int) || attributeType == typeof(Nullable<int>) || attributeType.IsOption + 570673                        return GetAppropiateCastExpressionBasedGuid(input); + 1416674                     if (attributeType == typeof(int) || attributeType == typeof(Nullable<int>) || attributeType.IsOption  256675                        return GetAppropiateCastExpressionBasedOnInt(input); - 1166676                     if (attributeType == typeof(decimal) || attributeType == typeof(Money)) + 1160676                     if (attributeType == typeof(decimal) || attributeType == typeof(Money))  26677                        return GetAppropiateCastExpressionBasedOnDecimal(input); - 1140678                     if (attributeType == typeof(bool) || attributeType == typeof(BooleanManagedProperty)) + 1134678                     if (attributeType == typeof(bool) || attributeType == typeof(BooleanManagedProperty))  40679                        return GetAppropiateCastExpressionBasedOnBoolean(input); - 1100680                     if (attributeType == typeof(string)) + 1094680                     if (attributeType == typeof(string))  588681                        return GetAppropiateCastExpressionBasedOnStringAndType(input, value, attributeType); - 512682                     if(attributeType.IsDateTime()) + 506682                     if(attributeType.IsDateTime())  204683                        return GetAppropiateCastExpressionBasedOnDateTime(input, value);  684 - 308685                    return GetAppropiateCastExpressionDefault(input, value); //any other type + 302685                    return GetAppropiateCastExpressionDefault(input, value); //any other type  686                }  687  250688            return GetAppropiateCastExpressionBasedOnValueInherentType(input, value); //Dynamic entities @@ -2510,24 +2531,24 @@

C:\Code\fake-  204738        }  739  740        protected static Expression GetAppropiateCastExpressionDefault(Expression input, object value) - 1046741        { - 1046742            return Expression.Convert(input, value.GetType());  //Default type conversion - 1046743        } + 1040741        { + 1040742            return Expression.Convert(input, value.GetType());  //Default type conversion + 1040743        }  744        protected static Expression GetAppropiateCastExpressionBasedGuid(Expression input) - 644745        { - 644746            var getIdFromEntityReferenceExpr = Expression.Call(Expression.TypeAs(input, typeof(EntityReference)), - 644747                                            typeof(EntityReference).GetMethod("get_Id")); + 650745        { + 650746            var getIdFromEntityReferenceExpr = Expression.Call(Expression.TypeAs(input, typeof(EntityReference)), + 650747                                            typeof(EntityReference).GetMethod("get_Id"));  748 - 644749            return Expression.Condition( - 644750                        Expression.TypeIs(input, typeof(EntityReference)),  //If input is an entity reference, compare t - 644751                                Expression.Convert( - 644752                                            getIdFromEntityReferenceExpr, - 644753                                            typeof(Guid)), - 644754                                Expression.Condition(Expression.TypeIs(input, typeof(Guid)),  //If any other case, then  - 644755                                            Expression.Convert(input, typeof(Guid)), - 644756                                            Expression.Constant(Guid.Empty, typeof(Guid)))); + 650749            return Expression.Condition( + 650750                        Expression.TypeIs(input, typeof(EntityReference)),  //If input is an entity reference, compare t + 650751                                Expression.Convert( + 650752                                            getIdFromEntityReferenceExpr, + 650753                                            typeof(Guid)), + 650754                                Expression.Condition(Expression.TypeIs(input, typeof(Guid)),  //If any other case, then  + 650755                                            Expression.Convert(input, typeof(Guid)), + 650756                                            Expression.Constant(Guid.Empty, typeof(Guid))));  757 - 644758        } + 650758        }  759  760        protected static Expression GetAppropiateCastExpressionBasedOnDecimal(Expression input)  26761        { @@ -2909,24 +2930,24 @@

C:\Code\fake-  1561137        }  1138  1139        protected static List<Expression> TranslateLinkedEntityFilterExpressionToExpression(QueryExpression qe, XrmFaked - 4671140        { + 4721140        {  1141            //In CRM 2011, condition expressions are at the LinkEntity level without an entity name  1142            //From CRM 2013, condition expressions were moved to outside the LinkEntity object at the QueryExpression le  1143            //with an EntityName alias attribute  1144  1145            //If we reach this point, it means we are translating filters at the Link Entity level (2011),  1146            //Therefore we need to prepend the alias attribute because the code to generate attributes for Joins (JoinAt - 4671147            var linkedEntitiesQueryExpressions = new List<Expression>(); + 4721147            var linkedEntitiesQueryExpressions = new List<Expression>();  1148 - 4671149             if (le.LinkCriteria != null) - 4231150            { - 15251151                foreach (var ce in le.LinkCriteria.Conditions) + 4721149             if (le.LinkCriteria != null) + 4281150            { + 15401151                foreach (var ce in le.LinkCriteria.Conditions)  1281152                {  1281153                     var entityAlias = !string.IsNullOrEmpty(le.EntityAlias) ? le.EntityAlias : le.LinkToEntityName;  1281154                    ce.AttributeName = entityAlias + "." + ce.AttributeName;  1281155                }  1156 - 12851157                foreach(var fe in le.LinkCriteria.Filters) + 13001157                foreach(var fe in le.LinkCriteria.Filters)  81158                {  401159                    foreach (var ce in fe.Conditions)  81160                    { @@ -2934,41 +2955,41 @@

C:\Code\fake-  81162                        ce.AttributeName = entityAlias + "." + ce.AttributeName;  81163                    }  81164                } - 4231165            } + 4281165            }  1166  1167            //Translate this specific Link Criteria - 4671168            linkedEntitiesQueryExpressions.Add(TranslateFilterExpressionToExpression(qe, context, le.LinkToEntityName, l + 4721168            linkedEntitiesQueryExpressions.Add(TranslateFilterExpressionToExpression(qe, context, le.LinkToEntityName, l  1169  1170            //Processed nested linked entities - 15211171            foreach (var nestedLinkedEntity in le.LinkEntities) + 15361171            foreach (var nestedLinkedEntity in le.LinkEntities)  601172            {  601173                var listOfExpressions = TranslateLinkedEntityFilterExpressionToExpression(qe, context, nestedLinkedEntit  601174                linkedEntitiesQueryExpressions.AddRange(listOfExpressions);  601175            }  1176 - 4671177            return linkedEntitiesQueryExpressions; - 4671178        } + 4721177            return linkedEntitiesQueryExpressions; + 4721178        }  1179  1180        protected static Expression TranslateQueryExpressionFiltersToExpression(XrmFakedContext context, QueryExpression - 12161181        { - 12161182            var linkedEntitiesQueryExpressions = new List<Expression>(); - 44621183            foreach(var le in qe.LinkEntities) - 4071184            { - 4071185                var listOfExpressions = TranslateLinkedEntityFilterExpressionToExpression(qe, context, le, entity); - 4071186                linkedEntitiesQueryExpressions.AddRange(listOfExpressions); - 4071187            } + 12211181        { + 12211182            var linkedEntitiesQueryExpressions = new List<Expression>(); + 44871183            foreach(var le in qe.LinkEntities) + 4121184            { + 4121185                var listOfExpressions = TranslateLinkedEntityFilterExpressionToExpression(qe, context, le, entity); + 4121186                linkedEntitiesQueryExpressions.AddRange(listOfExpressions); + 4121187            }  1188 - 12161189             if(linkedEntitiesQueryExpressions.Count > 0 && qe.Criteria != null) - 3371190            { + 12211189             if(linkedEntitiesQueryExpressions.Count > 0 && qe.Criteria != null) + 3421190            {  1191                //Return the and of the two - 3371192                Expression andExpression = Expression.Constant(true); - 19151193                foreach(var e in linkedEntitiesQueryExpressions) - 4521194                { - 4521195                    andExpression = Expression.And(e, andExpression); + 3421192                Expression andExpression = Expression.Constant(true); + 19401193                foreach(var e in linkedEntitiesQueryExpressions) + 4571194                { + 4571195                    andExpression = Expression.And(e, andExpression);  1196 - 4521197                } - 3371198                var feExpression = TranslateFilterExpressionToExpression(qe, context, qe.EntityName, qe.Criteria, entity - 3371199                return Expression.And(andExpression, feExpression); + 4571197                } + 3421198                var feExpression = TranslateFilterExpressionToExpression(qe, context, qe.EntityName, qe.Criteria, entity + 3421199                return Expression.And(andExpression, feExpression);  1200            }  8791201             else if (linkedEntitiesQueryExpressions.Count > 0)  101202            { @@ -2986,25 +3007,25 @@

C:\Code\fake-  1214                //Criteria only  8691215                return TranslateFilterExpressionToExpression(qe, context, qe.EntityName, qe.Criteria, entity, false);  1216            } - 12011217        } + 12061217        }  1218        protected static Expression TranslateFilterExpressionToExpression(QueryExpression qe, XrmFakedContext context, s - 18441219        { - 19831220             if (fe == null) return Expression.Constant(true); + 18541219        { + 19931220             if (fe == null) return Expression.Constant(true);  1221 - 17051222            BinaryExpression conditionsLambda = null; - 17051223            BinaryExpression filtersLambda = null; - 17051224             if (fe.Conditions != null && fe.Conditions.Count > 0) + 17151222            BinaryExpression conditionsLambda = null; + 17151223            BinaryExpression filtersLambda = null; + 17151224             if (fe.Conditions != null && fe.Conditions.Count > 0)  9201225            {  9201226                conditionsLambda = TranslateMultipleConditionExpressions(qe, context, sEntityName, fe.Conditions.ToList(  9051227            }  1228  1229            //Process nested filters recursively - 16901230             if (fe.Filters != null && fe.Filters.Count > 0) + 17001230             if (fe.Filters != null && fe.Filters.Count > 0)  1561231            {  1561232                filtersLambda = TranslateMultipleFilterExpressions(qe, context, sEntityName, fe.Filters.ToList(), fe.Fil  1561233            }  1234 - 16901235             if (conditionsLambda != null && filtersLambda != null) + 17001235             if (conditionsLambda != null && filtersLambda != null)  351236            {  1237                //Satisfy both  351238                 if (fe.FilterOperator == LogicalOperator.And) @@ -3016,17 +3037,17 @@

C:\Code\fake-  51244                    return Expression.Or(conditionsLambda, filtersLambda);  1245                }  1246            } - 16551247             else if (conditionsLambda != null) + 16651247             else if (conditionsLambda != null)  8701248                return conditionsLambda; - 7851249             else if (filtersLambda != null) + 7951249             else if (filtersLambda != null)  1211250                return filtersLambda;  1251 - 6641252            return Expression.Constant(true); //Satisfy filter if there are no conditions nor filters - 18291253        } + 6741252            return Expression.Constant(true); //Satisfy filter if there are no conditions nor filters + 18391253        }  1254    }  1255} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm b/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm index a93fd867..28b2ef4c 100644 --- a/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm +++ b/test/reports/FakeXrmEasy_XrmFakedPluginExecutionContext.htm @@ -145,6 +145,6 @@

C:\Co  109} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedRelationship.htm b/test/reports/FakeXrmEasy_XrmFakedRelationship.htm index fc17ca5a..b27402cb 100644 --- a/test/reports/FakeXrmEasy_XrmFakedRelationship.htm +++ b/test/reports/FakeXrmEasy_XrmFakedRelationship.htm @@ -107,6 +107,6 @@

C:\Code\fake-xr  69} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedTracingService.htm b/test/reports/FakeXrmEasy_XrmFakedTracingService.htm index f5dd28f5..1eb4ce95 100644 --- a/test/reports/FakeXrmEasy_XrmFakedTracingService.htm +++ b/test/reports/FakeXrmEasy_XrmFakedTracingService.htm @@ -69,6 +69,6 @@

C:\Code\fake-  31} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm b/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm index d1ad2e0e..7e638d6f 100644 --- a/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm +++ b/test/reports/FakeXrmEasy_XrmFakedWorkflowContext.htm @@ -101,6 +101,6 @@

C:\Code\fake  72} - + \ No newline at end of file diff --git a/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm b/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm index 4954ba32..4a7927d4 100644 --- a/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm +++ b/test/reports/FakeXrmEasy_XrmOrderByAttributeComparer.htm @@ -129,6 +129,6 @@

C:\Code\  92} - + \ No newline at end of file diff --git a/test/reports/badge_branchcoverage.svg b/test/reports/badge_branchcoverage.svg index 9cb3aeca..e0430632 100644 --- a/test/reports/badge_branchcoverage.svg +++ b/test/reports/badge_branchcoverage.svg @@ -78,7 +78,7 @@ Coverage Coverage - 73.2%73.2% + 73%73% diff --git a/test/reports/badge_combined.svg b/test/reports/badge_combined.svg index 6ac74e5f..a9cbebfd 100644 --- a/test/reports/badge_combined.svg +++ b/test/reports/badge_combined.svg @@ -77,8 +77,8 @@ Coverage Coverage - 88.9%88.9% - 73.2%73.2% + 88.8%88.8% + 73%73% diff --git a/test/reports/badge_linecoverage.svg b/test/reports/badge_linecoverage.svg index 44740217..7d4dedae 100644 --- a/test/reports/badge_linecoverage.svg +++ b/test/reports/badge_linecoverage.svg @@ -77,7 +77,7 @@ Coverage Coverage - 88.9%88.9% + 88.8%88.8% diff --git a/test/reports/combined.js b/test/reports/combined.js index 45a5f5fa..f467db95 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" : 133, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 3, "totalBranches" : 4, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.ArrayTraverse", "reportPath" : "FakeXrmEasy_ArrayTraverse.htm", "coveredLines" : 20, "uncoveredLines" : 3, "coverableLines" : 23, "totalLines" : 133, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 7, "totalBranches" : 8, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "FakeXrmEasy.Extensions.EntityExtensions", "reportPath" : "FakeXrmEasy_EntityExtensions.htm", "coveredLines" : 202, "uncoveredLines" : 60, "coverableLines" : 262, "totalLines" : 405, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 75, "totalBranches" : 94, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "FakeXrmEasy.Extensions.EntityExtensions", "reportPath" : "FakeXrmEasy_EntityExtensions.htm", "coveredLines" : 205, "uncoveredLines" : 60, "coverableLines" : 265, "totalLines" : 408, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 74, "totalBranches" : 94, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.FetchXml.XmlExtensionsForFetchXml", "reportPath" : "FakeXrmEasy_XmlExtensionsForFetchXml.htm", "coveredLines" : 389, "uncoveredLines" : 27, "coverableLines" : 416, "totalLines" : 679, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 147, "totalBranches" : 217, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.ObjectExtensions", "reportPath" : "FakeXrmEasy_ObjectExtensions.htm", "coveredLines" : 49, "uncoveredLines" : 0, "coverableLines" : 49, "totalLines" : 133, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 17, "totalBranches" : 20, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Extensions.QueryExpressionExtensions", "reportPath" : "FakeXrmEasy_QueryExpressionExtensions.htm", "coveredLines" : 13, "uncoveredLines" : 1, "coverableLines" : 14, "totalLines" : 41, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 3, "totalBranches" : 4, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, @@ -339,7 +339,7 @@ var assemblies = [ { "name" : "FakeXrmEasy.FakeMessageExecutors.PublishXmlRequestExecutor", "reportPath" : "FakeXrmEasy_PublishXmlRequestExecutor.htm", "coveredLines" : 13, "uncoveredLines" : 3, "coverableLines" : 16, "totalLines" : 35, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 2, "totalBranches" : 2, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.FakeMessageExecutors.RetrieveAttributeRequestExecutor", "reportPath" : "FakeXrmEasy_RetrieveAttributeRequestExecutor.htm", "coveredLines" : 5, "uncoveredLines" : 3, "coverableLines" : 8, "totalLines" : 28, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.FakeMessageExecutors.RetrieveEntityRequestExecutor", "reportPath" : "FakeXrmEasy_RetrieveEntityRequestExecutor.htm", "coveredLines" : 79, "uncoveredLines" : 11, "coverableLines" : 90, "totalLines" : 155, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 18, "totalBranches" : 24, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "FakeXrmEasy.FakeMessageExecutors.RetrieveMultipleRequestExecutor", "reportPath" : "FakeXrmEasy_RetrieveMultipleRequestExecutor.htm", "coveredLines" : 113, "uncoveredLines" : 10, "coverableLines" : 123, "totalLines" : 188, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 32, "totalBranches" : 38, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "FakeXrmEasy.FakeMessageExecutors.RetrieveMultipleRequestExecutor", "reportPath" : "FakeXrmEasy_RetrieveMultipleRequestExecutor.htm", "coveredLines" : 113, "uncoveredLines" : 10, "coverableLines" : 123, "totalLines" : 188, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 31, "totalBranches" : 38, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.FakeMessageExecutors.RetrieveOptionSetRequestExecutor", "reportPath" : "FakeXrmEasy_RetrieveOptionSetRequestExecutor.htm", "coveredLines" : 25, "uncoveredLines" : 0, "coverableLines" : 25, "totalLines" : 51, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 4, "totalBranches" : 4, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.FakeMessageExecutors.RetrievePrincipalAccessRequestExecutor", "reportPath" : "FakeXrmEasy_RetrievePrincipalAccessRequestExecutor.htm", "coveredLines" : 7, "uncoveredLines" : 3, "coverableLines" : 10, "totalLines" : 31, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.FakeMessageExecutors.RetrieveRequestExecutor", "reportPath" : "FakeXrmEasy_RetrieveRequestExecutor.htm", "coveredLines" : 87, "uncoveredLines" : 7, "coverableLines" : 94, "totalLines" : 137, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 18, "totalBranches" : 22, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, @@ -354,7 +354,7 @@ var assemblies = [ { "name" : "FakeXrmEasy.Permissions.AccessRightsRepository", "reportPath" : "FakeXrmEasy_AccessRightsRepository.htm", "coveredLines" : 42, "uncoveredLines" : 2, "coverableLines" : 44, "totalLines" : 106, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 10, "totalBranches" : 10, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.PullRequestException", "reportPath" : "FakeXrmEasy_PullRequestException.htm", "coveredLines" : 6, "uncoveredLines" : 6, "coverableLines" : 12, "totalLines" : 28, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.Services.DefaultEntityInitializerService", "reportPath" : "FakeXrmEasy_DefaultEntityInitializerService.htm", "coveredLines" : 15, "uncoveredLines" : 3, "coverableLines" : 18, "totalLines" : 38, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 2, "totalBranches" : 2, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "FakeXrmEasy.XrmFakedContext", "reportPath" : "FakeXrmEasy_XrmFakedContext.htm", "coveredLines" : 1573, "uncoveredLines" : 177, "coverableLines" : 1750, "totalLines" : 2848, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 406, "totalBranches" : 587, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "FakeXrmEasy.XrmFakedContext", "reportPath" : "FakeXrmEasy_XrmFakedContext.htm", "coveredLines" : 1580, "uncoveredLines" : 182, "coverableLines" : 1762, "totalLines" : 2867, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 407, "totalBranches" : 589, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.XrmFakedPluginExecutionContext", "reportPath" : "FakeXrmEasy_XrmFakedPluginExecutionContext.htm", "coveredLines" : 33, "uncoveredLines" : 0, "coverableLines" : 33, "totalLines" : 109, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.XrmFakedRelationship", "reportPath" : "FakeXrmEasy_XrmFakedRelationship.htm", "coveredLines" : 26, "uncoveredLines" : 0, "coverableLines" : 26, "totalLines" : 69, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "FakeXrmEasy.XrmFakedTracingService", "reportPath" : "FakeXrmEasy_XrmFakedTracingService.htm", "coveredLines" : 12, "uncoveredLines" : 0, "coverableLines" : 12, "totalLines" : 31, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, diff --git a/test/reports/index.htm b/test/reports/index.htm index 7d3b4fbb..d802c127 100644 --- a/test/reports/index.htm +++ b/test/reports/index.htm @@ -12,17 +12,17 @@

Summary

-Generated on:19/05/2017 - 17:44:12 +Generated on:23/05/2017 - 21:00:20 Parser:MultiReportParser (5x OpenCoverParser) Assemblies:1 Classes:47 Files:50 -Covered lines:3513 -Uncovered lines:438 -Coverable lines:3951 -Total lines:7254 -Line coverage:88.9% -Branch coverage:73.2% +Covered lines:3523 +Uncovered lines:443 +Coverable lines:3966 +Total lines:7276 +Line coverage:88.8% +Branch coverage:73%

Assemblies

@@ -44,10 +44,10 @@

Assemblies

NameCoveredUncoveredCoverableTotalLine coverageBranch coverage -FakeXrmEasy35134383951725488.9%
  
73.2%
  
+FakeXrmEasy35234433966727688.8%
  
73%
  
FakeXrmEasy.Extensions.ArrayExtensions606133100%
 
75%
  
FakeXrmEasy.Extensions.ArrayTraverse2032313386.9%
  
87.5%
  
-FakeXrmEasy.Extensions.EntityExtensions2026026240577%
  
79.7%
  
+FakeXrmEasy.Extensions.EntityExtensions2056026540877.3%
  
78.7%
  
FakeXrmEasy.Extensions.FetchXml.XmlExtensionsForFetchXml3892741667993.5%
  
67.7%
  
FakeXrmEasy.Extensions.ObjectExtensions49049133100%
 
85%
  
FakeXrmEasy.Extensions.QueryExpressionExtensions131144192.8%
  
75%
  
@@ -70,7 +70,7 @@

Assemblies

FakeXrmEasy.FakeMessageExecutors.PublishXmlRequestExecutor133163581.2%
  
100%
 
FakeXrmEasy.FakeMessageExecutors.RetrieveAttributeRequestExecutor5382862.5%
  
 
FakeXrmEasy.FakeMessageExecutors.RetrieveEntityRequestExecutor79119015587.7%
  
75%
  
-FakeXrmEasy.FakeMessageExecutors.RetrieveMultipleRequestExecutor1131012318891.8%
  
84.2%
  
+FakeXrmEasy.FakeMessageExecutors.RetrieveMultipleRequestExecutor1131012318891.8%
  
81.5%
  
FakeXrmEasy.FakeMessageExecutors.RetrieveOptionSetRequestExecutor2502551100%
 
100%
 
FakeXrmEasy.FakeMessageExecutors.RetrievePrincipalAccessRequestExecutor73103170%
  
 
FakeXrmEasy.FakeMessageExecutors.RetrieveRequestExecutor8779413792.5%
  
81.8%
  
@@ -85,7 +85,7 @@

Assemblies

FakeXrmEasy.Permissions.AccessRightsRepository4224410695.4%
  
100%
 
FakeXrmEasy.PullRequestException66122850%
  
 
FakeXrmEasy.Services.DefaultEntityInitializerService153183883.3%
  
100%
 
-FakeXrmEasy.XrmFakedContext15731771750284889.8%
  
69.1%
  
+FakeXrmEasy.XrmFakedContext15801821762286789.6%
  
69.1%
  
FakeXrmEasy.XrmFakedPluginExecutionContext33033109100%
 
 
FakeXrmEasy.XrmFakedRelationship2602669100%
 
 
FakeXrmEasy.XrmFakedTracingService1201231100%
 
 
@@ -94,6 +94,6 @@

Assemblies

FakeXrmEasy.XrmRealContext5936213495.1%
  
70%
  
- + \ No newline at end of file