public void ExecuteWorkFlowIntegrationTest(IUnityContainer container, Type testType, string getQueueMessageName, string checkMethodName) { var typeStr = string.Format("System.Type.GetType(\"{0}, {1}\")", testType.FullName, testType.Assembly.GetName().Name); var queueMessageVar = new Variable <IoQueueIn>("QueueMessage"); var queueMandantCode = new Variable <string>("MandantCode"); var outerActivity = new DynamicActivity { Name = "OUTER", Implementation = () => new TryCatch() { Try = new SessionScope() { Body = new Sequence { Variables = { queueMessageVar, queueMandantCode }, Activities = { new GetTestQueueInActivity() { TestType = new InArgument <Type>(new CSharpValue <Type>(typeStr)), GetMethodName = new InArgument <string>(getQueueMessageName), QueueIn = new OutArgument <IoQueueIn>(queueMessageVar), MandantCode = new OutArgument <string>(queueMandantCode) }, new ExecuteWorkflow { Inputs = new InArgument <IDictionary <string, object> >( new CSharpValue <IDictionary <string, object> >( "new Dictionary<string, object>() { {\"QueueMessage\", QueueMessage }, {\"MandantCode\", MandantCode } }" ) ), Identity = new InArgument <WorkflowIdentity>( new CSharpValue <WorkflowIdentity>( string.Format( "new WorkflowIdentity(\"{0}\", null, null)", InnerWfIdentity.Name)) ) }, new CheckActivity() { TestType = new InArgument <Type>(new CSharpValue <Type>(typeStr)), CheckerMethodName = new InArgument <string>(checkMethodName) } , { new Throw() { Exception = new InArgument <Exception>( new CSharpValue <Exception>( "new NotImplementedException(\"Откат транзакции\")")) } } } } }, Catches = { new Catch <NotImplementedException>() } } }; var knownTypes = new[] { typeof(Dictionary <string, object>), typeof(IoQueueIn), testType }; ActivityHelper.CompileExpressions(outerActivity, knownTypes); var inputs = new Dictionary <string, object>(); var service = GetWfService(container, outerActivity, InnerWfIdentity, InArgumentWorkflow); try { service.Run(OuterWfidentity, inputs); } catch (TechnicalIntegrationException e) { var errorMessage = e.ErrorMessage; if (errorMessage != null && errorMessage.ErrorInfoList != null && errorMessage.ErrorInfoList.Any()) { var allMessages = errorMessage.ErrorInfoList.Aggregate(string.Empty, (current, errorInfo) => current + (errorInfo.Message + Environment.NewLine)); var resException = new TechnicalIntegrationException(allMessages) { CallStack = errorMessage.ErrorInfoList.First().CallStack }; throw resException; } throw; } }