本文整理汇总了C#中FakeXrmEasy.XrmFakedContext.ExecuteCodeActivity方法的典型用法代码示例。如果您正苦于以下问题:C# XrmFakedContext.ExecuteCodeActivity方法的具体用法?C# XrmFakedContext.ExecuteCodeActivity怎么用?C# XrmFakedContext.ExecuteCodeActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FakeXrmEasy.XrmFakedContext
的用法示例。
在下文中一共展示了XrmFakedContext.ExecuteCodeActivity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: When_the_create_task_activity_is_executed_a_task_is_created_in_the_context
public void When_the_create_task_activity_is_executed_a_task_is_created_in_the_context()
{
var fakedContext = new XrmFakedContext();
fakedContext.ProxyTypesAssembly = Assembly.GetExecutingAssembly();
var guid1 = Guid.NewGuid();
var account = new Account() { Id = guid1 };
fakedContext.Initialize(new List<Entity>() {
account
});
//Inputs
var inputs = new Dictionary<string, object>() {
{ "inputEntity", account.ToEntityReference() }
};
var result = fakedContext.ExecuteCodeActivity<CreateTaskActivity>(inputs);
//The wf creates an activity, so make sure it is created
var tasks = (from t in fakedContext.CreateQuery<Task>()
select t).ToList();
//The activity creates a taks
Assert.True(tasks.Count == 1);
var output = result["taskCreated"] as EntityReference;
//Task created contains the account passed as the regarding Id
Assert.True(tasks[0].RegardingObjectId != null && tasks[0].RegardingObjectId.Id.Equals(guid1));
//Same task created is returned
Assert.Equal(output.Id, tasks[0].Id);
}
示例2: XrmFakedContext
public void When_the_add_activity_with_constant_is_executed_without_a_specific_instance_result_is_the_two_summands()
{
var fakedContext = new XrmFakedContext();
//Inputs
var inputs = new Dictionary<string, object>() {
{ "firstSummand", 2 },
{ "secondSummand", 3 }
};
var result = fakedContext.ExecuteCodeActivity<AddActivityWithConstant>(inputs);
Assert.True(((int)result["result"]).Equals(5));
}
示例3: When_the_add_activity_is_executed_the_right_sum_is_returned
public void When_the_add_activity_is_executed_the_right_sum_is_returned()
{
var fakedContext = new XrmFakedContext();
//Inputs
var inputs = new Dictionary<string, object>() {
{ "firstSummand", 2 },
{ "secondSummand", 3 }
};
var result = fakedContext.ExecuteCodeActivity<AddActivity>(inputs);
Assert.True(((int)result["result"]).Equals(5));
}
示例4: When_passing_a_custom_workflow_activity_context_injected_property_is_returned
public void When_passing_a_custom_workflow_activity_context_injected_property_is_returned()
{
var fakedContext = new XrmFakedContext();
var wfContext = fakedContext.GetDefaultWorkflowContext();
wfContext.MessageName = "Update";
//Inputs
var inputs = new Dictionary<string, object>();
CheckContextPropertyActivity codeActivity = new CheckContextPropertyActivity();
var result = fakedContext.ExecuteCodeActivity<CheckContextPropertyActivity>(wfContext, inputs, codeActivity);
Assert.True(((string)result["MessageName"]).Equals("Update"));
}