protected override void Execute(CodeActivityContext context) { IKernel services = _fakeServices; //Fake services were not provided so add actual implemnetations if (services == null) { services = new StandardKernel(); //Add mockable services here services.AddLogging(); } //No need to mock these since they are taken care by the mock framework services.AddCoreServices() .AddCodeActivityServices(context) .AddCodeActivityPipelineServices(); ICodeActivityExecutionContextAccessor executionContextAccessor = services.Get <ICodeActivityExecutionContextAccessor>(); try { CodeActivityExecutionContextAccessor.ValidateExecution(executionContextAccessor, GetType()); Execute(services); } catch (Exception ex) { OnError(ex, services); } }