From 45f9ae976ae77be59131e9891ac2b1b5850068b2 Mon Sep 17 00:00:00 2001 From: Jordi Date: Wed, 11 Sep 2024 16:34:18 +0200 Subject: [PATCH 01/11] Add missing comments, updated typed entities with alternate key, updated UpdateMultipleTests --- .../FileStorage/FileStorageSettings.cs | 7 + tests/DataverseEntities/Entities/dv_test.cs | 185 +++++++++++++----- .../UpdateMultipleRequestTests.cs | 33 ++++ 3 files changed, 176 insertions(+), 49 deletions(-) diff --git a/src/FakeXrmEasy.Core/FileStorage/FileStorageSettings.cs b/src/FakeXrmEasy.Core/FileStorage/FileStorageSettings.cs index 66a13425..3f0bde3e 100644 --- a/src/FakeXrmEasy.Core/FileStorage/FileStorageSettings.cs +++ b/src/FakeXrmEasy.Core/FileStorage/FileStorageSettings.cs @@ -1,5 +1,8 @@ namespace FakeXrmEasy.Core.FileStorage { + /// + /// Sets default file and image storage settings + /// public interface IFileStorageSettings { /// @@ -12,6 +15,10 @@ public interface IFileStorageSettings /// int ImageMaxSizeInKB { get; set; } } + + /// + /// Sets default file and image storage settings + /// public class FileStorageSettings: IFileStorageSettings { diff --git a/tests/DataverseEntities/Entities/dv_test.cs b/tests/DataverseEntities/Entities/dv_test.cs index cc1c6f2a..2e47163f 100644 --- a/tests/DataverseEntities/Entities/dv_test.cs +++ b/tests/DataverseEntities/Entities/dv_test.cs @@ -14,7 +14,7 @@ namespace DataverseEntities [System.Runtime.Serialization.DataContractAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("Dataverse Model Builder", "2.0.0.6")] - public enum dv_test_dv_choice_multiple + public enum dv_test_dv_choice { [System.Runtime.Serialization.EnumMemberAttribute()] @@ -29,7 +29,7 @@ public enum dv_test_dv_choice_multiple [System.Runtime.Serialization.DataContractAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("Dataverse Model Builder", "2.0.0.6")] - public enum dv_test_dv_choice_single + public enum dv_test_dv_choice_multiple { [System.Runtime.Serialization.EnumMemberAttribute()] @@ -43,7 +43,7 @@ public enum dv_test_dv_choice_single } /// - /// Status of the Test Table + /// Status of the DV Test Table /// [System.Runtime.Serialization.DataContractAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("Dataverse Model Builder", "2.0.0.6")] @@ -58,7 +58,7 @@ public enum dv_test_statecode } /// - /// Reason for the status of the Test Table + /// Reason for the status of the DV Test Table /// [System.Runtime.Serialization.DataContractAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("Dataverse Model Builder", "2.0.0.6")] @@ -95,10 +95,11 @@ public partial class Fields public const string dv_accountidYomiName = "dv_accountidyominame"; public const string dv_bool = "dv_bool"; public const string dv_boolName = "dv_boolname"; + public const string dv_choice = "dv_choice"; public const string dv_choice_multiple = "dv_choice_multiple"; public const string dv_choice_multipleName = "dv_choice_multiplename"; - public const string dv_choice_single = "dv_choice_single"; - public const string dv_choice_singleName = "dv_choice_singlename"; + public const string dv_choiceName = "dv_choicename"; + public const string dv_code = "dv_code"; public const string dv_currency = "dv_currency"; public const string dv_currency_Base = "dv_currency_base"; public const string dv_customerid = "dv_customerid"; @@ -112,6 +113,10 @@ public partial class Fields public const string dv_file = "dv_file"; public const string dv_file_Name = "dv_file_name"; public const string dv_float = "dv_float"; + public const string dv_fullimage = "dv_fullimage"; + public const string dv_fullimage_Timestamp = "dv_fullimage_timestamp"; + public const string dv_fullimage_URL = "dv_fullimage_url"; + public const string dv_fullimageId = "dv_fullimageid"; public const string dv_image = "dv_image"; public const string dv_image_Timestamp = "dv_image_timestamp"; public const string dv_image_URL = "dv_image_url"; @@ -122,7 +127,7 @@ public partial class Fields public const string dv_string = "dv_string"; public const string dv_testId = "dv_testid"; public const string Id = "dv_testid"; - public const string dv_textarea = "dv_textarea"; + public const string dv_text_area = "dv_text_area"; public const string dv_ticker_symbol = "dv_ticker_symbol"; public const string dv_time_zone = "dv_time_zone"; public const string dv_url = "dv_url"; @@ -152,9 +157,12 @@ public partial class Fields public const string TransactionCurrencyIdName = "transactioncurrencyidname"; public const string UTCConversionTimeZoneCode = "utcconversiontimezonecode"; public const string VersionNumber = "versionnumber"; - public const string dv_account_dv_test_393 = "dv_account_dv_test_393"; - public const string dv_contact_dv_test_393 = "dv_contact_dv_test_393"; + public const string dv_test_FileAttachments = "dv_test_FileAttachments"; + public const string dv_test_Contact_Contact = "dv_test_Contact_Contact"; + public const string dv_account_dv_test_365 = "dv_account_dv_test_365"; + public const string dv_contact_dv_test_365 = "dv_contact_dv_test_365"; public const string dv_test_accountid_account = "dv_test_accountid_account"; + public const string FileAttachment_dv_test_dv_file = "FileAttachment_dv_test_dv_file"; } /// @@ -171,7 +179,7 @@ public dv_test() : public const string EntitySetName = "dv_tests"; - public const int EntityTypeCode = 10359; + public const int EntityTypeCode = 10319; /// /// Unique identifier of the user who created the record. @@ -347,7 +355,19 @@ public string dv_boolName } } - #if FAKE_XRM_EASY_9 + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_choice")] + public virtual dv_test_dv_choice? dv_choice + { + get + { + return ((dv_test_dv_choice?)(EntityOptionSetEnum.GetEnum(this, "dv_choice"))); + } + set + { + this.SetAttributeValue("dv_choice", value.HasValue ? new Microsoft.Xrm.Sdk.OptionSetValue((int)value) : null); + } + } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_choice_multiple")] public virtual System.Collections.Generic.IEnumerable dv_choice_multiple { @@ -360,7 +380,6 @@ public virtual System.Collections.Generic.IEnumerable("dv_code"); + } + set + { + this.SetAttributeValue("dv_code", value); + } + } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_currency")] public Microsoft.Xrm.Sdk.Money dv_currency { @@ -542,7 +561,6 @@ public string dv_email } } - #if FAKE_XRM_EASY_9 [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_file")] public object dv_file { @@ -551,7 +569,6 @@ public object dv_file return this.GetAttributeValue("dv_file"); } } - #endif [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_file_name")] public string dv_file_Name @@ -582,7 +599,49 @@ public System.Nullable dv_float } } - #if !FAKE_XRM_EASY + /// + /// An image column that can store full images + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_fullimage")] + public byte[] dv_fullimage + { + get + { + return this.GetAttributeValue("dv_fullimage"); + } + set + { + this.SetAttributeValue("dv_fullimage", value); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_fullimage_timestamp")] + public System.Nullable dv_fullimage_Timestamp + { + get + { + return this.GetAttributeValue>("dv_fullimage_timestamp"); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_fullimage_url")] + public string dv_fullimage_URL + { + get + { + return this.GetAttributeValue("dv_fullimage_url"); + } + } + + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_fullimageid")] + public System.Nullable dv_fullimageId + { + get + { + return this.GetAttributeValue>("dv_fullimageid"); + } + } + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_image")] public byte[] dv_image { @@ -595,7 +654,6 @@ public byte[] dv_image this.SetAttributeValue("dv_image", value); } } - #endif [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_image_timestamp")] public System.Nullable dv_image_Timestamp @@ -713,16 +771,16 @@ public override System.Guid Id } } - [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_textarea")] - public string dv_textarea + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_text_area")] + public string dv_text_area { get { - return this.GetAttributeValue("dv_textarea"); + return this.GetAttributeValue("dv_text_area"); } set { - this.SetAttributeValue("dv_textarea", value); + this.SetAttributeValue("dv_text_area", value); } } @@ -1016,7 +1074,7 @@ public Microsoft.Xrm.Sdk.EntityReference OwningUser } /// - /// Status of the Test Table + /// Status of the DV Test Table /// [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("statecode")] public virtual dv_test_statecode? statecode @@ -1048,7 +1106,7 @@ public string statecodeName } /// - /// Reason for the status of the Test Table + /// Reason for the status of the DV Test Table /// [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("statuscode")] public virtual dv_test_statuscode? statuscode @@ -1155,6 +1213,22 @@ public System.Nullable VersionNumber } } + /// + /// 1:N dv_test_FileAttachments + /// + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("dv_test_FileAttachments")] + public System.Collections.Generic.IEnumerable dv_test_FileAttachments + { + get + { + return this.GetRelatedEntities("dv_test_FileAttachments", null); + } + set + { + this.SetRelatedEntities("dv_test_FileAttachments", null, value); + } + } + /// /// N:N dv_test_Contact_Contact /// @@ -1172,36 +1246,36 @@ public System.Collections.Generic.IEnumerable dv_test } /// - /// N:1 dv_account_dv_test_393 + /// N:1 dv_account_dv_test_365 /// [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_customerid")] - [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("dv_account_dv_test_393")] - public DataverseEntities.Account dv_account_dv_test_393 + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("dv_account_dv_test_365")] + public DataverseEntities.Account dv_account_dv_test_365 { get { - return this.GetRelatedEntity("dv_account_dv_test_393", null); + return this.GetRelatedEntity("dv_account_dv_test_365", null); } set { - this.SetRelatedEntity("dv_account_dv_test_393", null, value); + this.SetRelatedEntity("dv_account_dv_test_365", null, value); } } /// - /// N:1 dv_contact_dv_test_393 + /// N:1 dv_contact_dv_test_365 /// [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_customerid")] - [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("dv_contact_dv_test_393")] - public DataverseEntities.Contact dv_contact_dv_test_393 + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("dv_contact_dv_test_365")] + public DataverseEntities.Contact dv_contact_dv_test_365 { get { - return this.GetRelatedEntity("dv_contact_dv_test_393", null); + return this.GetRelatedEntity("dv_contact_dv_test_365", null); } set { - this.SetRelatedEntity("dv_contact_dv_test_393", null, value); + this.SetRelatedEntity("dv_contact_dv_test_365", null, value); } } @@ -1221,6 +1295,19 @@ public DataverseEntities.Account dv_test_accountid_account this.SetRelatedEntity("dv_test_accountid_account", null, value); } } + + /// + /// N:1 FileAttachment_dv_test_dv_file + /// + [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_file")] + [Microsoft.Xrm.Sdk.RelationshipSchemaNameAttribute("FileAttachment_dv_test_dv_file")] + public DataverseEntities.FileAttachment FileAttachment_dv_test_dv_file + { + get + { + return this.GetRelatedEntity("FileAttachment_dv_test_dv_file", null); + } + } } } #pragma warning restore CS1591 diff --git a/tests/FakeXrmEasy.Core.Tests/Middleware/Crud/FakeMessageExecutors/BulkOperations/UpdateMultipleRequestTests.cs b/tests/FakeXrmEasy.Core.Tests/Middleware/Crud/FakeMessageExecutors/BulkOperations/UpdateMultipleRequestTests.cs index 749bed44..93594458 100644 --- a/tests/FakeXrmEasy.Core.Tests/Middleware/Crud/FakeMessageExecutors/BulkOperations/UpdateMultipleRequestTests.cs +++ b/tests/FakeXrmEasy.Core.Tests/Middleware/Crud/FakeMessageExecutors/BulkOperations/UpdateMultipleRequestTests.cs @@ -349,6 +349,39 @@ public void Should_update_two_records_in_update_multiple() Assert.Equal("Record 1", updatedRecord1["dv_string"]); Assert.Equal("Record 2", updatedRecord2["dv_string"]); } + + [Fact] + public void Should_throw_exception_in_update_multiple_when_using_an_alternate_key_without_a_primary_key() + { + var guid1 = _service.Create(new dv_test(){ dv_code = "C0001"}); + var guid2 = _service.Create(new dv_test() { dv_code = "C0002"}); + + List recordsToUpdate = new List() + { + new dv_test() + { + dv_code = "C0001", + dv_string = "Record 1" + }, + new dv_test() { + dv_code = "C0002", + dv_string = "Record 2" + } + }; + + var entities = new EntityCollection(recordsToUpdate) + { + EntityName = dv_test.EntityLogicalName + }; + + var request = new UpdateMultipleRequest() + { + Targets = entities + }; + + var ex = XAssert.ThrowsFaultCode(ErrorCodes.ObjectDoesNotExist, () => _service.Execute(request)); + Assert.Equal($"Entity Id must be specified for Operation", ex.Detail.Message); + } } } #endif \ No newline at end of file From d8be9b63d32e92412aeb54337e0639687c088a61 Mon Sep 17 00:00:00 2001 From: Jordi Date: Wed, 11 Sep 2024 17:09:05 +0200 Subject: [PATCH 02/11] Adding changes for DynamicsValue/fake-xrm-easy#160 --- CHANGELOG.md | 1 + FakeXrmEasy.Core.sln | 14 +- build.ps1 | 4 + pack-src-project.ps1 | 29 ++++ pack-src.ps1 | 24 ++- pack-tests-project.ps1 | 29 ++++ pack-tests.ps1 | 22 +-- src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj | 5 - .../FakeXrmEasy.Integration.csproj | 146 ++++++++++++++++ .../XrmRealContext.cs | 3 +- .../FakeXrmEasy.Integration.Tests.csproj | 159 ++++++++++++++++++ .../XrmRealContextTests.cs | 2 +- 12 files changed, 400 insertions(+), 38 deletions(-) create mode 100644 pack-src-project.ps1 create mode 100644 pack-tests-project.ps1 create mode 100644 src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj rename src/{FakeXrmEasy.Core => FakeXrmEasy.Integration}/XrmRealContext.cs (99%) create mode 100644 tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj rename tests/{FakeXrmEasy.Core.Tests => FakeXrmEasy.Integration.Tests}/XrmRealContextTests/XrmRealContextTests.cs (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cccb07fd..9801012b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Changed +- Moved XrmRealContext to a separate FakeXrmEasy.Integration package to remove dependency on XrmTooling - https://github.com/DynamicsValue/fake-xrm-easy/issues/160 - Resolves an issue in FetchXml queries when using arithmetic values and no early bound assemblies are used. It will now read from injected metadata in absence of proxy type assemblies - https://github.com/DynamicsValue/fake-xrm-easy/issues/158 - Resolves issue in MetadataGenerator where relationship properties were generated in the wrong order, also generates ManyToMany relationship properties - https://github.com/DynamicsValue/fake-xrm-easy/issues/135 - Adds implementation of RelatedEntities in Update message , before it was implemented only for Create - https://github.com/DynamicsValue/fake-xrm-easy/issues/154 diff --git a/FakeXrmEasy.Core.sln b/FakeXrmEasy.Core.sln index 4b92b33a..498e933f 100644 --- a/FakeXrmEasy.Core.sln +++ b/FakeXrmEasy.Core.sln @@ -19,11 +19,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataverseEntities", "tests\DataverseEntities\DataverseEntities.csproj", "{7638E014-9149-4125-860F-D478CFD36C06}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeXrmEasy.Integration", "src\FakeXrmEasy.Integration\FakeXrmEasy.Integration.csproj", "{0924D408-0AC0-4184-BF73-8DCBE14A7D69}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeXrmEasy.Integration.Tests", "tests\FakeXrmEasy.Integration.Tests\FakeXrmEasy.Integration.Tests.csproj", "{73CC2217-C43C-459B-8625-C130F141A645}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - FAKE_XRM_EASY_9|Any CPU = FAKE_XRM_EASY_9|Any CPU - FAKE_XRM_EASY_9|x64 = FAKE_XRM_EASY_9|x64 - FAKE_XRM_EASY_9|x86 = FAKE_XRM_EASY_9|x86 + FAKE_XRM_EASY_9|Any CPU = FAKE_XRM_EASY_9|Any CPU + FAKE_XRM_EASY_9|x64 = FAKE_XRM_EASY_9|x64 + FAKE_XRM_EASY_9|x86 = FAKE_XRM_EASY_9|x86 FAKE_XRM_EASY_2013|Any CPU = FAKE_XRM_EASY_2013|Any CPU FAKE_XRM_EASY_2013|x64 = FAKE_XRM_EASY_2013|x64 FAKE_XRM_EASY_2013|x86 = FAKE_XRM_EASY_2013|x86 @@ -46,7 +50,7 @@ Global {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_9|x64.ActiveCfg = FAKE_XRM_EASY_9|Any CPU {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_9|x64.Build.0 = FAKE_XRM_EASY_9|Any CPU {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_9|x86.ActiveCfg = FAKE_XRM_EASY_9|Any CPU - {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_9|x86.Build.0 = FAKE_XRM_EASY_9|Any CPU + {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_9|x86.Build.0 = FAKE_XRM_EASY_9|Any CPU {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_2013|Any CPU.ActiveCfg = FAKE_XRM_EASY_2013|Any CPU {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_2013|Any CPU.Build.0 = FAKE_XRM_EASY_2013|Any CPU {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE}.FAKE_XRM_EASY_2013|x64.ActiveCfg = FAKE_XRM_EASY_2013|Any CPU @@ -157,6 +161,8 @@ Global {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE} = {6D8BD300-7945-4BD8-AFA5-30EEF1466332} {E7FD9BE3-5CD1-4B50-A23E-53EA1AE2EBB8} = {AB19E6BB-17E9-4489-B6C8-A14622C147D9} {7638E014-9149-4125-860F-D478CFD36C06} = {AB19E6BB-17E9-4489-B6C8-A14622C147D9} + {0924D408-0AC0-4184-BF73-8DCBE14A7D69} = {6D8BD300-7945-4BD8-AFA5-30EEF1466332} + {73CC2217-C43C-459B-8625-C130F141A645} = {AB19E6BB-17E9-4489-B6C8-A14622C147D9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9E98B2F2-E752-4716-ABC6-BE9440866543} diff --git a/build.ps1 b/build.ps1 index f02a2bc1..c2f503de 100644 --- a/build.ps1 +++ b/build.ps1 @@ -32,8 +32,12 @@ else Write-Host " -> Cleaning..." -ForegroundColor Yellow ./clean.ps1 -folderPath "./src/FakeXrmEasy.Core/bin" ./clean.ps1 -folderPath "./src/FakeXrmEasy.Core/obj" +./clean.ps1 -folderPath "./src/FakeXrmEasy.Integration/bin" +./clean.ps1 -folderPath "./src/FakeXrmEasy.Integration/obj" ./clean.ps1 -folderPath "./tests/FakeXrmEasy.Core.Tests/bin" ./clean.ps1 -folderPath "./tests/FakeXrmEasy.Core.Tests/obj" +./clean.ps1 -folderPath "./tests/FakeXrmEasy.Integration.Tests/bin" +./clean.ps1 -folderPath "./tests/FakeXrmEasy.Integration.Tests/obj" Write-Host " -> Restoring dependencies: configuration='$($configuration)', targetFramework='$($targetFrameworks)' PackTests=$($packTests)" -ForegroundColor Yellow if($targetFrameworks -eq "all") diff --git a/pack-src-project.ps1 b/pack-src-project.ps1 new file mode 100644 index 00000000..e5fc964f --- /dev/null +++ b/pack-src-project.ps1 @@ -0,0 +1,29 @@ +param ( + [string]$versionSuffix = "", + [string]$targetFrameworks = "netcoreapp3.1", + [string]$packageIdPrefix = "", + [string]$projectName = "", + [string]$projectPath = "", + ) + +Write-Host "Running with versionSuffix '$($versionSuffix)'..." + +$tempNupkgFolder = './nupkgs' + +Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green + + if($targetFrameworks -eq "netcoreapp3.1") + { + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_365" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_9" + } + else { + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_2013" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_2015" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_2016" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_365" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_9" + } + +Write-Host "Pack Succeeded :)" -ForegroundColor Green \ No newline at end of file diff --git a/pack-src.ps1 b/pack-src.ps1 index 82767562..0a933d62 100644 --- a/pack-src.ps1 +++ b/pack-src.ps1 @@ -1,6 +1,6 @@ param ( [string]$versionSuffix = "", - [string]$targetFrameworks = "netcoreapp3.1" + [string]$targetFrameworks = "netcoreapp3.1", ) Write-Host "Running with versionSuffix '$($versionSuffix)'..." @@ -13,18 +13,14 @@ $projectPath = "src/FakeXrmEasy.Core" Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green - if($targetFrameworks -eq "netcoreapp3.1") - { - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_365" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_9" - } - else { - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_2013" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_2015" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_2016" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_365" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -configuration "FAKE_XRM_EASY_9" - } +./pack-src-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix + +$packageIdPrefix = "FakeXrmEasy.Integration" +$projectName = "FakeXrmEasy.Integration" +$projectPath = "src/FakeXrmEasy.Integration" + +Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green + +./pack-src-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix Write-Host "Pack Succeeded :)" -ForegroundColor Green \ No newline at end of file diff --git a/pack-tests-project.ps1 b/pack-tests-project.ps1 new file mode 100644 index 00000000..5f53738a --- /dev/null +++ b/pack-tests-project.ps1 @@ -0,0 +1,29 @@ +param ( + [string]$versionSuffix = "", + [string]$targetFrameworks = "netcoreapp3.1", + [string]$packageIdPrefix = "", + [string]$projectName = "", + [string]$projectPath = "", + ) + +Write-Host "Running with versionSuffix '$($versionSuffix)'..." + +$tempNupkgFolder = './nupkgs' + +Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green + + if($targetFrameworks -eq "netcoreapp3.1") + { + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_365" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_9" + } + else { + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_2013" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_2015" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_2016" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_365" + ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_9" + } + +Write-Host "Pack Succeeded :)" -ForegroundColor Green \ No newline at end of file diff --git a/pack-tests.ps1 b/pack-tests.ps1 index fdc9c768..fcd1d90e 100644 --- a/pack-tests.ps1 +++ b/pack-tests.ps1 @@ -13,18 +13,14 @@ $projectPath = "tests/FakeXrmEasy.Core.Tests" Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green - if($targetFrameworks -eq "netcoreapp3.1") - { - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_365" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_9" - } - else { - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_2013" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_2015" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_2016" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_365" - ./pack-configuration.ps1 -targetFramework $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -packTests "true" -configuration "FAKE_XRM_EASY_9" - } +./pack-tests-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix + +$packageIdPrefix = "FakeXrmEasy.IntegrationTests" +$projectName = "FakeXrmEasy.Integration.Tests" +$projectPath = "tests/FakeXrmEasy.Integration.Tests" + +Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green + +./pack-tests-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix Write-Host "Pack Succeeded :)" -ForegroundColor Green \ No newline at end of file diff --git a/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj b/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj index ec4daaa8..28ae8631 100644 --- a/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj +++ b/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj @@ -58,28 +58,23 @@ - - - - - diff --git a/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj b/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj new file mode 100644 index 00000000..1c1a86d7 --- /dev/null +++ b/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj @@ -0,0 +1,146 @@ + + + + net462 + net462;net452 + net452 + net452 + net452 + net452 + FakeXrmEasy.Integration + 2.6.0 + Jordi Montaña + Dynamics Value + FakeXrmEasy Core + (c) 2021 Dynamics Value + true + LICENSE.txt + Please write release notes in CHANGELOG.md + FakeXrmEasyLogo_128x128.png + dynamics;crm;365;unit testing;xrm;mock;mocking;fake;fakes;cds;common data service;power platform;fakexrmeasy + https://github.com/DynamicsValue/fake-xrm-easy-core + FAKE_XRM_EASY_9;FAKE_XRM_EASY_365;FAKE_XRM_EASY_2016;FAKE_XRM_EASY_2015;FAKE_XRM_EASY_2013;FAKE_XRM_EASY + true + ..\..\fakexrmeasy.snk + True + true + False + + + + + + + + + DEBUG;TRACE;FAKE_XRM_EASY;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_2013;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_2015;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_2016;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_365;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_9;FXE_V2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FakeXrmEasy is the open source test automation framework for .net core and the Power Platform. This package helps in integration testing scenarios. + + @(ReleaseNoteLines, '%0a') + + + diff --git a/src/FakeXrmEasy.Core/XrmRealContext.cs b/src/FakeXrmEasy.Integration/XrmRealContext.cs similarity index 99% rename from src/FakeXrmEasy.Core/XrmRealContext.cs rename to src/FakeXrmEasy.Integration/XrmRealContext.cs index 69f06ad5..c9ddbd06 100644 --- a/src/FakeXrmEasy.Core/XrmRealContext.cs +++ b/src/FakeXrmEasy.Integration/XrmRealContext.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Collections.Generic; using System.Text; using Microsoft.Xrm.Sdk; diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj new file mode 100644 index 00000000..dfc9c242 --- /dev/null +++ b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj @@ -0,0 +1,159 @@ + + + + net462 + net462;net452 + net452 + net452 + net452 + net452 + + true + + FakeXrmEasy.IntegrationTests + 2.6.0 + Jordi Montaña + Dynamics Value S.L. + Internal Unit test suite for FakeXrmEasy.Core package + FakeXrmEasy is the open source test automation framework for .net core and the Power Platform / Dataverse. This is an internal package for regression testing purposes. + (c) 2021 DynamicsValue S.L. + true + LICENSE.txt + FakeXrmEasyLogo_128x128.png + dynamics;crm;365;unit testing;xrm;mock;mocking;fake;fakes;cds;common data service;power platform + https://github.com/DynamicsValue/fake-xrm-easy-core + + FAKE_XRM_EASY_9;FAKE_XRM_EASY_365;FAKE_XRM_EASY_2016;FAKE_XRM_EASY_2015;FAKE_XRM_EASY_2013;FAKE_XRM_EASY + + ..\..\fakexrmeasy.snk + True + true + + + + + + + + + DEBUG;TRACE;FAKE_XRM_EASY;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_2013;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_2015;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_2016;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_365;FXE_V2 + + + + DEBUG;TRACE;FAKE_XRM_EASY_9;FXE_V2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/FakeXrmEasy.Core.Tests/XrmRealContextTests/XrmRealContextTests.cs b/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs similarity index 99% rename from tests/FakeXrmEasy.Core.Tests/XrmRealContextTests/XrmRealContextTests.cs rename to tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs index 4944d4e3..c6c93c47 100644 --- a/tests/FakeXrmEasy.Core.Tests/XrmRealContextTests/XrmRealContextTests.cs +++ b/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs @@ -84,4 +84,4 @@ public void Should_return_license_exception_if_not_set_when_getting_an_organizat Assert.Throws(() => ctx.GetOrganizationService()); } } -} \ No newline at end of file +} From ab647e2d0287d154166ea9fdb5239da782444129 Mon Sep 17 00:00:00 2001 From: Jordi Date: Thu, 12 Sep 2024 10:03:33 +0200 Subject: [PATCH 03/11] Comment out multi option sets for 365 package version. Update Changelog --- CHANGELOG.md | 2 +- tests/DataverseEntities/Entities/dv_test.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9801012b..9350c529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ ### Changed -- Moved XrmRealContext to a separate FakeXrmEasy.Integration package to remove dependency on XrmTooling - https://github.com/DynamicsValue/fake-xrm-easy/issues/160 +- **BREAKING CHANGE**: This will **only** affect you if you use XrmRealContext class. Moved XrmRealContext to a separate FakeXrmEasy.Integration package to remove dependency on XrmTooling - https://github.com/DynamicsValue/fake-xrm-easy/issues/160 - Resolves an issue in FetchXml queries when using arithmetic values and no early bound assemblies are used. It will now read from injected metadata in absence of proxy type assemblies - https://github.com/DynamicsValue/fake-xrm-easy/issues/158 - Resolves issue in MetadataGenerator where relationship properties were generated in the wrong order, also generates ManyToMany relationship properties - https://github.com/DynamicsValue/fake-xrm-easy/issues/135 - Adds implementation of RelatedEntities in Update message , before it was implemented only for Create - https://github.com/DynamicsValue/fake-xrm-easy/issues/154 diff --git a/tests/DataverseEntities/Entities/dv_test.cs b/tests/DataverseEntities/Entities/dv_test.cs index 2e47163f..bb7a61fa 100644 --- a/tests/DataverseEntities/Entities/dv_test.cs +++ b/tests/DataverseEntities/Entities/dv_test.cs @@ -368,6 +368,7 @@ public virtual dv_test_dv_choice? dv_choice } } + #if FAKE_XRM_EASY_9 [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_choice_multiple")] public virtual System.Collections.Generic.IEnumerable dv_choice_multiple { @@ -381,6 +382,8 @@ public virtual System.Collections.Generic.IEnumerable Date: Thu, 12 Sep 2024 10:26:26 +0200 Subject: [PATCH 04/11] Adding missing configurations and update build scripts to due with duplicate Core dependency --- FakeXrmEasy.Core.sln | 4 ++++ pack-configuration.ps1 | 8 ++++---- .../FakeXrmEasy.Integration.csproj | 14 +++++++------- .../FakeXrmEasy.Integration.Tests.csproj | 1 + .../FakeXrmEasyTestsBase.cs | 19 +++++++++++++++++++ 5 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs diff --git a/FakeXrmEasy.Core.sln b/FakeXrmEasy.Core.sln index 498e933f..955cd444 100644 --- a/FakeXrmEasy.Core.sln +++ b/FakeXrmEasy.Core.sln @@ -153,6 +153,10 @@ Global {7638E014-9149-4125-860F-D478CFD36C06}.FAKE_XRM_EASY_9|x64.Build.0 = FAKE_XRM_EASY_9|Any CPU {7638E014-9149-4125-860F-D478CFD36C06}.FAKE_XRM_EASY_9|x86.ActiveCfg = FAKE_XRM_EASY_9|Any CPU {7638E014-9149-4125-860F-D478CFD36C06}.FAKE_XRM_EASY_9|x86.Build.0 = FAKE_XRM_EASY_9|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_9|Any CPU.ActiveCfg = FAKE_XRM_EASY_9|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_9|Any CPU.Build.0 = FAKE_XRM_EASY_9|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_9|Any CPU.ActiveCfg = FAKE_XRM_EASY_9|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_9|Any CPU.Build.0 = FAKE_XRM_EASY_9|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/pack-configuration.ps1 b/pack-configuration.ps1 index b00c437d..564b8a81 100644 --- a/pack-configuration.ps1 +++ b/pack-configuration.ps1 @@ -48,20 +48,20 @@ if($targetFrameworks -eq "all") { if($versionSuffix -eq "") { - dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -o $tempNupkgFolder $projectPath/$projectName.csproj + dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:IsPacking="true" -o $tempNupkgFolder $projectPath/$projectName.csproj } else { - dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -o $tempNupkgFolder $projectPath/$projectName.csproj --version-suffix $versionSuffix + dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:IsPacking="true" -o $tempNupkgFolder $projectPath/$projectName.csproj --version-suffix $versionSuffix } } else { if($versionSuffix -eq "") { - dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder $projectPath/$projectName.csproj + dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:IsPacking="true" -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder $projectPath/$projectName.csproj } else { - dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder $projectPath/$projectName.csproj --version-suffix $versionSuffix + dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:IsPacking="true" -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder $projectPath/$projectName.csproj --version-suffix $versionSuffix } } diff --git a/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj b/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj index 1c1a86d7..1f4cdc75 100644 --- a/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj +++ b/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj @@ -97,7 +97,7 @@ - + @@ -107,27 +107,27 @@ - + - + - + - + - + - + diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj index dfc9c242..fa22c017 100644 --- a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj +++ b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj @@ -134,6 +134,7 @@ + diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs new file mode 100644 index 00000000..813e49f0 --- /dev/null +++ b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs @@ -0,0 +1,19 @@ +using FakeXrmEasy.Abstractions; +using FakeXrmEasy.Abstractions.Enums; +using FakeXrmEasy.Middleware; +using Microsoft.Xrm.Sdk; + +namespace FakeXrmEasy.Core.Tests +{ + public class FakeXrmEasyTestsBase + { + protected readonly IXrmFakedContext _context; + protected readonly IOrganizationService _service; + + protected FakeXrmEasyTestsBase() + { + _context = XrmFakedContextFactory.New(FakeXrmEasyLicense.RPL_1_5); + _service = _context.GetOrganizationService(); + } + } +} \ No newline at end of file From dab32e74edc49e501b2f6bf07ac8466733b1f582 Mon Sep 17 00:00:00 2001 From: Jordi Date: Thu, 12 Sep 2024 10:36:18 +0200 Subject: [PATCH 05/11] Fix project paths --- .../FakeXrmEasy.Integration.Tests.csproj | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj index fa22c017..98bf3b06 100644 --- a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj +++ b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj @@ -14,7 +14,7 @@ 2.6.0 Jordi Montaña Dynamics Value S.L. - Internal Unit test suite for FakeXrmEasy.Core package + Internal Unit test suite for FakeXrmEasy.Integration package FakeXrmEasy is the open source test automation framework for .net core and the Power Platform / Dataverse. This is an internal package for regression testing purposes. (c) 2021 DynamicsValue S.L. true @@ -62,7 +62,7 @@ - + @@ -113,47 +113,58 @@ + + + + + + + + + + + + - - + - + - + - + - + - + - + From 3fec5d1a3871d12331c1d91e3f2a1ea3f95d2899 Mon Sep 17 00:00:00 2001 From: Jordi Date: Thu, 12 Sep 2024 14:37:44 +0200 Subject: [PATCH 06/11] Fix configurations in solution file --- FakeXrmEasy.Core.sln | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/FakeXrmEasy.Core.sln b/FakeXrmEasy.Core.sln index 955cd444..22dc527a 100644 --- a/FakeXrmEasy.Core.sln +++ b/FakeXrmEasy.Core.sln @@ -155,8 +155,28 @@ Global {7638E014-9149-4125-860F-D478CFD36C06}.FAKE_XRM_EASY_9|x86.Build.0 = FAKE_XRM_EASY_9|Any CPU {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_9|Any CPU.ActiveCfg = FAKE_XRM_EASY_9|Any CPU {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_9|Any CPU.Build.0 = FAKE_XRM_EASY_9|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_365|Any CPU.ActiveCfg = FAKE_XRM_EASY_365|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2016|Any CPU.ActiveCfg = FAKE_XRM_EASY_2016|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2016|Any CPU.Build.0 = FAKE_XRM_EASY_2016|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_365|Any CPU.Build.0 = FAKE_XRM_EASY_365|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2015|Any CPU.ActiveCfg = FAKE_XRM_EASY_2015|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2015|Any CPU.Build.0 = FAKE_XRM_EASY_2015|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2013|Any CPU.ActiveCfg = FAKE_XRM_EASY_2013|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2013|Any CPU.Build.0 = FAKE_XRM_EASY_2013|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY|Any CPU.ActiveCfg = FAKE_XRM_EASY|Any CPU + {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY|Any CPU.Build.0 = FAKE_XRM_EASY|Any CPU {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_9|Any CPU.ActiveCfg = FAKE_XRM_EASY_9|Any CPU {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_9|Any CPU.Build.0 = FAKE_XRM_EASY_9|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_365|Any CPU.ActiveCfg = FAKE_XRM_EASY_365|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2016|Any CPU.ActiveCfg = FAKE_XRM_EASY_2016|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2016|Any CPU.Build.0 = FAKE_XRM_EASY_2016|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_365|Any CPU.Build.0 = FAKE_XRM_EASY_365|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2015|Any CPU.ActiveCfg = FAKE_XRM_EASY_2015|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2015|Any CPU.Build.0 = FAKE_XRM_EASY_2015|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2013|Any CPU.ActiveCfg = FAKE_XRM_EASY_2013|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2013|Any CPU.Build.0 = FAKE_XRM_EASY_2013|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY|Any CPU.ActiveCfg = FAKE_XRM_EASY|Any CPU + {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY|Any CPU.Build.0 = FAKE_XRM_EASY|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 3ac4a645d8d5320359b35d64322869aa9c4c9e39 Mon Sep 17 00:00:00 2001 From: Jordi Date: Thu, 12 Sep 2024 14:41:58 +0200 Subject: [PATCH 07/11] Add conditional precomipaltion symbols to generated entities to exclude file attributes for non v9 projects. --- tests/DataverseEntities/Entities/dv_test.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/DataverseEntities/Entities/dv_test.cs b/tests/DataverseEntities/Entities/dv_test.cs index bb7a61fa..80ddc4d5 100644 --- a/tests/DataverseEntities/Entities/dv_test.cs +++ b/tests/DataverseEntities/Entities/dv_test.cs @@ -564,6 +564,7 @@ public string dv_email } } + #if FAKE_XRM_EASY_9 [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_file")] public object dv_file { @@ -588,6 +589,7 @@ public string dv_file_Name } } } + #endif [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_float")] public System.Nullable dv_float From c850a4efd408b9724194e6bba77781f199785f4b Mon Sep 17 00:00:00 2001 From: Jordi Date: Thu, 12 Sep 2024 15:01:28 +0200 Subject: [PATCH 08/11] Update namespace --- .../FakeXrmEasy.Integration.Tests.csproj | 31 ++++++++++++++----- .../FakeXrmEasyTestsBase.cs | 2 +- .../XrmRealContextTests.cs | 2 +- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj index 98bf3b06..e027ea82 100644 --- a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj +++ b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj @@ -62,6 +62,10 @@ + + + + @@ -106,18 +110,12 @@ - + - - - - - - @@ -144,6 +142,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs index 813e49f0..e347af87 100644 --- a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs +++ b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs @@ -3,7 +3,7 @@ using FakeXrmEasy.Middleware; using Microsoft.Xrm.Sdk; -namespace FakeXrmEasy.Core.Tests +namespace FakeXrmEasy.Integration.Tests { public class FakeXrmEasyTestsBase { diff --git a/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs b/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs index c6c93c47..743136e9 100644 --- a/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs +++ b/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs @@ -3,7 +3,7 @@ using System; using Xunit; -namespace FakeXrmEasy.Core.Tests.XrmRealContextTests +namespace FakeXrmEasy.Integration.Tests.XrmRealContextTests { public class XrmRealContextTests: FakeXrmEasyTestsBase { From 8642a644bfd7ed70a99601f5be25d44a9f5fdb21 Mon Sep 17 00:00:00 2001 From: Jordi Date: Thu, 12 Sep 2024 15:04:16 +0200 Subject: [PATCH 09/11] Fix typo in pull request action --- .github/workflows/CI-PullRequest-2x.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-PullRequest-2x.yml b/.github/workflows/CI-PullRequest-2x.yml index f16d36fe..ec282152 100644 --- a/.github/workflows/CI-PullRequest-2x.yml +++ b/.github/workflows/CI-PullRequest-2x.yml @@ -36,7 +36,7 @@ jobs: run: dotnet nuget enable source github - name: Build - run: pwsh ./build.ps1 -configuration ${{matrix.configuration}} -targetFramework 'all' + run: pwsh ./build.ps1 -configuration ${{matrix.configuration}} -targetFrameworks 'all' env: NUGET_USERNAME: ${{github.repository_owner}} NUGET_TOKEN: ${{ secrets.PACKAGES_TOKEN }} From 4731e2cc2c731db57806aa640e7926eb12a08de6 Mon Sep 17 00:00:00 2001 From: Jordi Date: Mon, 16 Sep 2024 10:30:22 +0200 Subject: [PATCH 10/11] Remove FakeXrmEasy.Integration to move it to a different repo. Comment out byte[] and object attribute types for older versions DynamicsValue/fake-xrm-easy#160 --- FakeXrmEasy.Core.sln | 30 --- build.ps1 | 4 - pack-src-project.ps1 | 2 +- pack-src.ps1 | 2 +- pack-tests-project.ps1 | 2 +- pack-tests.ps1 | 8 - push.ps1 | 2 +- .../FakeXrmEasy.Integration.csproj | 146 ------------ src/FakeXrmEasy.Integration/XrmRealContext.cs | 207 ------------------ tests/DataverseEntities/Entities/dv_test.cs | 4 + .../FakeXrmEasy.Integration.Tests.csproj | 188 ---------------- .../FakeXrmEasyTestsBase.cs | 19 -- .../XrmRealContextTests.cs | 87 -------- 13 files changed, 8 insertions(+), 693 deletions(-) delete mode 100644 src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj delete mode 100644 src/FakeXrmEasy.Integration/XrmRealContext.cs delete mode 100644 tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj delete mode 100644 tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs delete mode 100644 tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs diff --git a/FakeXrmEasy.Core.sln b/FakeXrmEasy.Core.sln index 22dc527a..3e132287 100644 --- a/FakeXrmEasy.Core.sln +++ b/FakeXrmEasy.Core.sln @@ -19,10 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataverseEntities", "tests\DataverseEntities\DataverseEntities.csproj", "{7638E014-9149-4125-860F-D478CFD36C06}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeXrmEasy.Integration", "src\FakeXrmEasy.Integration\FakeXrmEasy.Integration.csproj", "{0924D408-0AC0-4184-BF73-8DCBE14A7D69}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeXrmEasy.Integration.Tests", "tests\FakeXrmEasy.Integration.Tests\FakeXrmEasy.Integration.Tests.csproj", "{73CC2217-C43C-459B-8625-C130F141A645}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution FAKE_XRM_EASY_9|Any CPU = FAKE_XRM_EASY_9|Any CPU @@ -153,30 +149,6 @@ Global {7638E014-9149-4125-860F-D478CFD36C06}.FAKE_XRM_EASY_9|x64.Build.0 = FAKE_XRM_EASY_9|Any CPU {7638E014-9149-4125-860F-D478CFD36C06}.FAKE_XRM_EASY_9|x86.ActiveCfg = FAKE_XRM_EASY_9|Any CPU {7638E014-9149-4125-860F-D478CFD36C06}.FAKE_XRM_EASY_9|x86.Build.0 = FAKE_XRM_EASY_9|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_9|Any CPU.ActiveCfg = FAKE_XRM_EASY_9|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_9|Any CPU.Build.0 = FAKE_XRM_EASY_9|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_365|Any CPU.ActiveCfg = FAKE_XRM_EASY_365|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2016|Any CPU.ActiveCfg = FAKE_XRM_EASY_2016|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2016|Any CPU.Build.0 = FAKE_XRM_EASY_2016|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_365|Any CPU.Build.0 = FAKE_XRM_EASY_365|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2015|Any CPU.ActiveCfg = FAKE_XRM_EASY_2015|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2015|Any CPU.Build.0 = FAKE_XRM_EASY_2015|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2013|Any CPU.ActiveCfg = FAKE_XRM_EASY_2013|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY_2013|Any CPU.Build.0 = FAKE_XRM_EASY_2013|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY|Any CPU.ActiveCfg = FAKE_XRM_EASY|Any CPU - {0924D408-0AC0-4184-BF73-8DCBE14A7D69}.FAKE_XRM_EASY|Any CPU.Build.0 = FAKE_XRM_EASY|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_9|Any CPU.ActiveCfg = FAKE_XRM_EASY_9|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_9|Any CPU.Build.0 = FAKE_XRM_EASY_9|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_365|Any CPU.ActiveCfg = FAKE_XRM_EASY_365|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2016|Any CPU.ActiveCfg = FAKE_XRM_EASY_2016|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2016|Any CPU.Build.0 = FAKE_XRM_EASY_2016|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_365|Any CPU.Build.0 = FAKE_XRM_EASY_365|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2015|Any CPU.ActiveCfg = FAKE_XRM_EASY_2015|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2015|Any CPU.Build.0 = FAKE_XRM_EASY_2015|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2013|Any CPU.ActiveCfg = FAKE_XRM_EASY_2013|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY_2013|Any CPU.Build.0 = FAKE_XRM_EASY_2013|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY|Any CPU.ActiveCfg = FAKE_XRM_EASY|Any CPU - {73CC2217-C43C-459B-8625-C130F141A645}.FAKE_XRM_EASY|Any CPU.Build.0 = FAKE_XRM_EASY|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -185,8 +157,6 @@ Global {CE7EE93C-E98A-4AE7-AE84-B4FA7CEB49FE} = {6D8BD300-7945-4BD8-AFA5-30EEF1466332} {E7FD9BE3-5CD1-4B50-A23E-53EA1AE2EBB8} = {AB19E6BB-17E9-4489-B6C8-A14622C147D9} {7638E014-9149-4125-860F-D478CFD36C06} = {AB19E6BB-17E9-4489-B6C8-A14622C147D9} - {0924D408-0AC0-4184-BF73-8DCBE14A7D69} = {6D8BD300-7945-4BD8-AFA5-30EEF1466332} - {73CC2217-C43C-459B-8625-C130F141A645} = {AB19E6BB-17E9-4489-B6C8-A14622C147D9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9E98B2F2-E752-4716-ABC6-BE9440866543} diff --git a/build.ps1 b/build.ps1 index c2f503de..f02a2bc1 100644 --- a/build.ps1 +++ b/build.ps1 @@ -32,12 +32,8 @@ else Write-Host " -> Cleaning..." -ForegroundColor Yellow ./clean.ps1 -folderPath "./src/FakeXrmEasy.Core/bin" ./clean.ps1 -folderPath "./src/FakeXrmEasy.Core/obj" -./clean.ps1 -folderPath "./src/FakeXrmEasy.Integration/bin" -./clean.ps1 -folderPath "./src/FakeXrmEasy.Integration/obj" ./clean.ps1 -folderPath "./tests/FakeXrmEasy.Core.Tests/bin" ./clean.ps1 -folderPath "./tests/FakeXrmEasy.Core.Tests/obj" -./clean.ps1 -folderPath "./tests/FakeXrmEasy.Integration.Tests/bin" -./clean.ps1 -folderPath "./tests/FakeXrmEasy.Integration.Tests/obj" Write-Host " -> Restoring dependencies: configuration='$($configuration)', targetFramework='$($targetFrameworks)' PackTests=$($packTests)" -ForegroundColor Yellow if($targetFrameworks -eq "all") diff --git a/pack-src-project.ps1 b/pack-src-project.ps1 index e5fc964f..7b2fdc51 100644 --- a/pack-src-project.ps1 +++ b/pack-src-project.ps1 @@ -3,7 +3,7 @@ param ( [string]$targetFrameworks = "netcoreapp3.1", [string]$packageIdPrefix = "", [string]$projectName = "", - [string]$projectPath = "", + [string]$projectPath = "" ) Write-Host "Running with versionSuffix '$($versionSuffix)'..." diff --git a/pack-src.ps1 b/pack-src.ps1 index 0a933d62..d71d8adb 100644 --- a/pack-src.ps1 +++ b/pack-src.ps1 @@ -1,6 +1,6 @@ param ( [string]$versionSuffix = "", - [string]$targetFrameworks = "netcoreapp3.1", + [string]$targetFrameworks = "netcoreapp3.1" ) Write-Host "Running with versionSuffix '$($versionSuffix)'..." diff --git a/pack-tests-project.ps1 b/pack-tests-project.ps1 index 5f53738a..adc08494 100644 --- a/pack-tests-project.ps1 +++ b/pack-tests-project.ps1 @@ -3,7 +3,7 @@ param ( [string]$targetFrameworks = "netcoreapp3.1", [string]$packageIdPrefix = "", [string]$projectName = "", - [string]$projectPath = "", + [string]$projectPath = "" ) Write-Host "Running with versionSuffix '$($versionSuffix)'..." diff --git a/pack-tests.ps1 b/pack-tests.ps1 index fcd1d90e..e310569d 100644 --- a/pack-tests.ps1 +++ b/pack-tests.ps1 @@ -15,12 +15,4 @@ Write-Host "Packing All Configurations for project $($projectName)" -ForegroundC ./pack-tests-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -$packageIdPrefix = "FakeXrmEasy.IntegrationTests" -$projectName = "FakeXrmEasy.Integration.Tests" -$projectPath = "tests/FakeXrmEasy.Integration.Tests" - -Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green - -./pack-tests-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix - Write-Host "Pack Succeeded :)" -ForegroundColor Green \ No newline at end of file diff --git a/push.ps1 b/push.ps1 index de65ee64..37778829 100644 --- a/push.ps1 +++ b/push.ps1 @@ -1,6 +1,6 @@ param ( [string]$packageSource = "local-packages", - [string]$packagePrefix = "FakeXrmEasy.Abstractions" + [string]$packagePrefix = "FakeXrmEasy.Core" ) Write-Host "Running with packageSource '$($packageSource)'..." diff --git a/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj b/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj deleted file mode 100644 index 1f4cdc75..00000000 --- a/src/FakeXrmEasy.Integration/FakeXrmEasy.Integration.csproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - net462 - net462;net452 - net452 - net452 - net452 - net452 - FakeXrmEasy.Integration - 2.6.0 - Jordi Montaña - Dynamics Value - FakeXrmEasy Core - (c) 2021 Dynamics Value - true - LICENSE.txt - Please write release notes in CHANGELOG.md - FakeXrmEasyLogo_128x128.png - dynamics;crm;365;unit testing;xrm;mock;mocking;fake;fakes;cds;common data service;power platform;fakexrmeasy - https://github.com/DynamicsValue/fake-xrm-easy-core - FAKE_XRM_EASY_9;FAKE_XRM_EASY_365;FAKE_XRM_EASY_2016;FAKE_XRM_EASY_2015;FAKE_XRM_EASY_2013;FAKE_XRM_EASY - true - ..\..\fakexrmeasy.snk - True - true - False - - - - - - - - - DEBUG;TRACE;FAKE_XRM_EASY;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_2013;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_2015;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_2016;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_365;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_9;FXE_V2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FakeXrmEasy is the open source test automation framework for .net core and the Power Platform. This package helps in integration testing scenarios. - - @(ReleaseNoteLines, '%0a') - - - diff --git a/src/FakeXrmEasy.Integration/XrmRealContext.cs b/src/FakeXrmEasy.Integration/XrmRealContext.cs deleted file mode 100644 index c9ddbd06..00000000 --- a/src/FakeXrmEasy.Integration/XrmRealContext.cs +++ /dev/null @@ -1,207 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.Xrm.Sdk; -using System.Configuration; -using System.IO; - -using System.Xml.Linq; -using System.Linq; - -using System.IO.Compression; -using System.Runtime.Serialization; - -using FakeXrmEasy.Abstractions; -using FakeXrmEasy.Abstractions.Plugins; -using FakeXrmEasy.Abstractions.Enums; -using FakeXrmEasy.Abstractions.Exceptions; - -#if FAKE_XRM_EASY_NETCORE -using Microsoft.Powerplatform.Cds.Client; -#elif FAKE_XRM_EASY_2016 || FAKE_XRM_EASY_365 || FAKE_XRM_EASY_9 -using Microsoft.Xrm.Tooling.Connector; -#else -using Microsoft.Xrm.Client; -using Microsoft.Xrm.Client.Services; -#endif - -namespace FakeXrmEasy -{ - /// - /// Reuse unit test syntax to test against a real CRM organisation - /// It uses a real CRM organisation service instance - /// - public class XrmRealContext : IXrmRealContext - { - /// - /// - /// - public FakeXrmEasyLicense? LicenseContext { get; set; } - - /// - /// - /// - public string ConnectionStringName { get; set; } = "fakexrmeasy-connection"; - - /// - /// Use these user to impersonate calls - /// - public ICallerProperties CallerProperties { get; set; } - - /// - /// Plugin Context Properties - /// - public IXrmFakedPluginContextProperties PluginContextProperties { get; set; } - - /// - /// Internal reference to an IOrganizationService. - /// - protected IOrganizationService _service; - - /// - /// A fake tracing service if one is needed - /// - private IXrmFakedTracingService _fakeTracingService; - - private Dictionary _properties; - - /// - /// A default constructor that will use a connection string with name fakexrmeasy-connection to establish a real connection to an environment for integration testing purposes - /// - public XrmRealContext() - { - Init(); - } - - /// - /// A constructor that will use a different connection string name - /// - /// - public XrmRealContext(string connectionStringName) - { - ConnectionStringName = connectionStringName; - Init(); - } - - /// - /// Creates an XrmRealContext that uses the specified IOrganizationService interface - /// - /// - public XrmRealContext(IOrganizationService organizationService) - { - _service = organizationService; - Init(); - } - - /// - /// Initializes common properties across different constructors - /// - private void Init() - { - _properties = new Dictionary(); - _fakeTracingService = new XrmFakedTracingService(); - CallerProperties = new CallerProperties(); - } - - /// - /// - /// - /// - /// - public bool HasProperty() - { - return _properties.ContainsKey(typeof(T).FullName); - } - - /// - /// - /// - /// - /// - /// - public T GetProperty() - { - if(!_properties.ContainsKey(typeof(T).FullName)) - { - throw new TypeAccessException($"Property of type '{typeof(T).FullName}' doesn't exists"); - } - - return (T) _properties[typeof(T).FullName]; - } - - /// - /// - /// - /// - /// - public void SetProperty(T property) - { - if(!_properties.ContainsKey(typeof(T).FullName)) - { - _properties.Add(typeof(T).FullName, property); - } - else - { - _properties[typeof(T).FullName] = property; - } - } - - /// - /// Returns the internal organization service reference - /// - /// - public IOrganizationService GetOrganizationService() - { - if (LicenseContext == null) - { - throw new LicenseException("Please, you need to choose a FakeXrmEasy license. More info at https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/licensing-exception/"); - } - - if (_service != null) - return _service; - - _service = GetOrgService(); - return _service; - } - - /// - /// - /// - /// - /// - protected IOrganizationService GetOrgService() - { - var connection = ConfigurationManager.ConnectionStrings[ConnectionStringName]; - - // In case of missing connection string in configuration, - // use ConnectionStringName as an explicit connection string - var connectionString = connection == null ? ConnectionStringName : connection.ConnectionString; - - if (string.IsNullOrWhiteSpace(connectionString)) - { - throw new Exception("The ConnectionStringName property must be either a connection string or a connection string name"); - } - - // Connect to the CRM web service using a connection string. -#if FAKE_XRM_EASY_NETCORE - var client = new CdsServiceClient(connectionString); -#elif FAKE_XRM_EASY_2016 || FAKE_XRM_EASY_365 || FAKE_XRM_EASY_9 - var client = new CrmServiceClient(connectionString); -#else - CrmConnection crmConnection = CrmConnection.Parse(connectionString); - var client = new OrganizationService(crmConnection); -#endif - return client; - } - - /// - /// Returns a default ITracingService that will store all traces In-Memory - /// - /// - public IXrmFakedTracingService GetTracingService() - { - return _fakeTracingService; - } - } -} diff --git a/tests/DataverseEntities/Entities/dv_test.cs b/tests/DataverseEntities/Entities/dv_test.cs index 80ddc4d5..410a2de2 100644 --- a/tests/DataverseEntities/Entities/dv_test.cs +++ b/tests/DataverseEntities/Entities/dv_test.cs @@ -604,6 +604,7 @@ public System.Nullable dv_float } } + #if !FAKE_XRM_EASY /// /// An image column that can store full images /// @@ -619,6 +620,7 @@ public byte[] dv_fullimage this.SetAttributeValue("dv_fullimage", value); } } + #endif [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_fullimage_timestamp")] public System.Nullable dv_fullimage_Timestamp @@ -647,6 +649,7 @@ public System.Nullable dv_fullimageId } } + #if !FAKE_XRM_EASY [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_image")] public byte[] dv_image { @@ -659,6 +662,7 @@ public byte[] dv_image this.SetAttributeValue("dv_image", value); } } + #endif [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("dv_image_timestamp")] public System.Nullable dv_image_Timestamp diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj deleted file mode 100644 index e027ea82..00000000 --- a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasy.Integration.Tests.csproj +++ /dev/null @@ -1,188 +0,0 @@ - - - - net462 - net462;net452 - net452 - net452 - net452 - net452 - - true - - FakeXrmEasy.IntegrationTests - 2.6.0 - Jordi Montaña - Dynamics Value S.L. - Internal Unit test suite for FakeXrmEasy.Integration package - FakeXrmEasy is the open source test automation framework for .net core and the Power Platform / Dataverse. This is an internal package for regression testing purposes. - (c) 2021 DynamicsValue S.L. - true - LICENSE.txt - FakeXrmEasyLogo_128x128.png - dynamics;crm;365;unit testing;xrm;mock;mocking;fake;fakes;cds;common data service;power platform - https://github.com/DynamicsValue/fake-xrm-easy-core - - FAKE_XRM_EASY_9;FAKE_XRM_EASY_365;FAKE_XRM_EASY_2016;FAKE_XRM_EASY_2015;FAKE_XRM_EASY_2013;FAKE_XRM_EASY - - ..\..\fakexrmeasy.snk - True - true - - - - - - - - - DEBUG;TRACE;FAKE_XRM_EASY;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_2013;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_2015;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_2016;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_365;FXE_V2 - - - - DEBUG;TRACE;FAKE_XRM_EASY_9;FXE_V2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs b/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs deleted file mode 100644 index e347af87..00000000 --- a/tests/FakeXrmEasy.Integration.Tests/FakeXrmEasyTestsBase.cs +++ /dev/null @@ -1,19 +0,0 @@ -using FakeXrmEasy.Abstractions; -using FakeXrmEasy.Abstractions.Enums; -using FakeXrmEasy.Middleware; -using Microsoft.Xrm.Sdk; - -namespace FakeXrmEasy.Integration.Tests -{ - public class FakeXrmEasyTestsBase - { - protected readonly IXrmFakedContext _context; - protected readonly IOrganizationService _service; - - protected FakeXrmEasyTestsBase() - { - _context = XrmFakedContextFactory.New(FakeXrmEasyLicense.RPL_1_5); - _service = _context.GetOrganizationService(); - } - } -} \ No newline at end of file diff --git a/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs b/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs deleted file mode 100644 index 743136e9..00000000 --- a/tests/FakeXrmEasy.Integration.Tests/XrmRealContextTests/XrmRealContextTests.cs +++ /dev/null @@ -1,87 +0,0 @@ -using FakeXrmEasy.Abstractions.Enums; -using FakeXrmEasy.Abstractions.Exceptions; -using System; -using Xunit; - -namespace FakeXrmEasy.Integration.Tests.XrmRealContextTests -{ - public class XrmRealContextTests: FakeXrmEasyTestsBase - { - private readonly XrmRealContext _realContext; - - public XrmRealContextTests() : base() - { - _realContext = new XrmRealContext(_service); - _realContext.LicenseContext = FakeXrmEasyLicense.RPL_1_5; - } - - private class CustomProperty - { - - } - - [Fact] - public void Should_connect_to_CRM_with_given_ConnectionString() - { - var ctx = new XrmRealContext("myfirstconnectionstring"); - Assert.Equal("myfirstconnectionstring", ctx.ConnectionStringName); - } - - [Fact] - public void Should_return_service_that_was_injected_in_the_constructor() - { - Assert.Equal(_service, _realContext.GetOrganizationService()); - } - - [Fact] - public void Should_set_property() - { - var customProperty = new CustomProperty(); - _realContext.SetProperty(customProperty); - - Assert.True(_realContext.HasProperty()); - - var property = _realContext.GetProperty(); - Assert.Equal(customProperty, property); - } - - [Fact] - public void Should_throw_type_access_exception_if_property_was_not_found() - { - Assert.Throws(() => _realContext.GetProperty()); - } - - [Fact] - public void Should_update_property_if_it_was_set() - { - var customProperty = new CustomProperty(); - _realContext.SetProperty(customProperty); - - var newProperty = new CustomProperty(); - _realContext.SetProperty(newProperty); - - var property = _realContext.GetProperty(); - Assert.Equal(newProperty, property); - } - - [Fact] - public void Should_return_fake_tracing_service() - { - var tracingService = _realContext.GetTracingService(); - Assert.IsType(tracingService); - } - - [Fact] - public void Should_set_default_caller_properties() - { - Assert.NotNull(_realContext.CallerProperties); - } - - [Fact] - public void Should_return_license_exception_if_not_set_when_getting_an_organization_service() - { - var ctx = new XrmRealContext(_service); - Assert.Throws(() => ctx.GetOrganizationService()); - } - } -} From d4de59632ac0901eb665b049dccd1a301fbdb2c7 Mon Sep 17 00:00:00 2001 From: Jordi Date: Wed, 18 Sep 2024 09:34:43 +0200 Subject: [PATCH 11/11] Remove integration project from pack-src DynamicsValue/fake-xrm-easy#160 --- pack-src.ps1 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pack-src.ps1 b/pack-src.ps1 index d71d8adb..9a880293 100644 --- a/pack-src.ps1 +++ b/pack-src.ps1 @@ -15,12 +15,4 @@ Write-Host "Packing All Configurations for project $($projectName)" -ForegroundC ./pack-src-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix -$packageIdPrefix = "FakeXrmEasy.Integration" -$projectName = "FakeXrmEasy.Integration" -$projectPath = "src/FakeXrmEasy.Integration" - -Write-Host "Packing All Configurations for project $($projectName)" -ForegroundColor Green - -./pack-src-project.ps1 -targetFrameworks $targetFrameworks -projectName $projectName -projectPath $projectPath -packageIdPrefix $packageIdPrefix -versionSuffix $versionSuffix - Write-Host "Pack Succeeded :)" -ForegroundColor Green \ No newline at end of file