jordimontana82 / fake-xrm-easy

The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
https://dynamicsvalue.com/get-started/overview?source=git
Other
263 stars 182 forks source link

Add name of service in the exception message when a plugin uses a custom service implementation for which there is no default mock #550

Open jordimontana82 opened 3 years ago

jordimontana82 commented 3 years ago

I currently using FakeXrmEasy with standard Plugins. I works great for me Now, I would like to integrate with third Party Plugin of which I have the API and Dll to use

for example --> public class ContactUpdateAddress : PluginBase where PluginBase Extends (IPlugin) the execution method is --> protected override void OnExecute(PluginContext pluginContext) where PluginContext extends ContextBase and context base is defined in this way (below the the extration of the class from object metadata)

What Could I do to integrate FakeXrmEasy with External Third Party Plugin implementation?

using System; using Microsoft.Xrm.Sdk; using ThirdParty.CRM.Configuration; using ThirdParty.Logging;

namespace ThirdParty.CRM { public abstract class ContextBase { public ContextBase(ILogSource log); public ContextBase(SourceType sourceType, string sourceName); protected internal ContextBase();

    public virtual ParameterCollection SharedVariables { get; }
    public virtual ParameterCollection OutputParameters { get; }
    public virtual ParameterCollection InputParameters { get; }
    public abstract IExecutionContext ExecutionContext { get; }
    public abstract Guid UserId { get; }
    public ITracingService TracingService { get; protected set; }
    public IOrganizationServiceFactory OrganizationServiceFactory { get; protected set; }
    public IOrganizationService OrganizationService { get; protected set; }
    public Terna.Localization.Localization Localization { get; protected set; }
    public ILogSource Logger { get; protected set; }
    public Configuration.Configuration Configuration { get; protected set; }
    public IConfigurationProvider ConfigurationProvider { get; protected set; }
    public virtual Guid? TransactionId { get; protected set; }
    public virtual Guid? CorrelationId { get; protected set; }
    public virtual bool IsInTransaction { get; protected set; }
    public ExecutionMode ExecutionMode { get; protected set; }
    public IsolationMode IsolationMode { get; protected set; }

    protected static ExecutionMode GetExecutionModeFromExecutionContext(IExecutionContext executionContext);
    protected static IsolationMode GetIsolationModeFromExecutionContext(IExecutionContext executionContext);
    protected void OnApplyConfigurationToLogger(AdditionalTargetCollection additionalTargets);
    protected virtual void OnLoadConfiguration(IExecutionContext executionContext);
    protected virtual void OnLoadConfigurationProvider();
}

}

Originally posted by @Gmanunta81GFPS in https://github.com/jordimontana82/fake-xrm-easy/discussions/549