From 4731e2cc2c731db57806aa640e7926eb12a08de6 Mon Sep 17 00:00:00 2001 From: Jordi Date: Mon, 16 Sep 2024 10:30:22 +0200 Subject: [PATCH] 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()); - } - } -}