当前位置: 首页>>代码示例>>C#>>正文


C# XrmFakedContext.ExecuteCodeActivity方法代码示例

本文整理汇总了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);
        }
开发者ID:ccellar,项目名称:fake-xrm-easy,代码行数:33,代码来源:FakeContextTestCodeActivities.cs

示例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));
        }
开发者ID:ccellar,项目名称:fake-xrm-easy,代码行数:14,代码来源:FakeContextTestCodeActivities.cs

示例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));
        }
开发者ID:ccellar,项目名称:fake-xrm-easy,代码行数:14,代码来源:FakeContextTestCodeActivities.cs

示例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"));
        }
开发者ID:ccellar,项目名称:fake-xrm-easy,代码行数:15,代码来源:FakeContextTestCodeActivities.cs


注:本文中的FakeXrmEasy.XrmFakedContext.ExecuteCodeActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。