本文整理汇总了C#中FakeXrmEasy.XrmFakedContext.ExecutePluginWithTarget方法的典型用法代码示例。如果您正苦于以下问题:C# XrmFakedContext.ExecutePluginWithTarget方法的具体用法?C# XrmFakedContext.ExecutePluginWithTarget怎么用?C# XrmFakedContext.ExecutePluginWithTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FakeXrmEasy.XrmFakedContext
的用法示例。
在下文中一共展示了XrmFakedContext.ExecutePluginWithTarget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XrmFakedContext
public void When_the_account_number_plugin_is_executed_for_an_account_that_already_has_a_number_exception_is_thrown()
{
var fakedContext = new XrmFakedContext();
var guid1 = Guid.NewGuid();
var target = new Entity("account") { Id = guid1 };
target["accountnumber"] = 69;
//Execute our plugin against a target thatcontains the accountnumber attribute will throw exception
Assert.Throws<InvalidPluginExecutionException>(() => fakedContext.ExecutePluginWithTarget<AccountNumberPlugin>(target));
}
示例2: When_the_account_number_plugin_is_executed_it_adds_a_random_number_to_an_account_entity
public void When_the_account_number_plugin_is_executed_it_adds_a_random_number_to_an_account_entity()
{
var fakedContext = new XrmFakedContext();
var guid1 = Guid.NewGuid();
var target = new Entity("account") { Id = guid1 };
//Execute our plugin against a target that doesn't contains the accountnumber attribute
var fakedPlugin = fakedContext.ExecutePluginWithTarget<AccountNumberPlugin>(target);
//Assert that the target contains a new attribute
Assert.True(target.Attributes.ContainsKey("accountnumber"));
}
示例3: When_a_plugin_with_target_is_executed_the_inherent_plugin_was_also_executed_without_exceptions
public void When_a_plugin_with_target_is_executed_the_inherent_plugin_was_also_executed_without_exceptions()
{
var fakedContext = new XrmFakedContext();
var guid1 = Guid.NewGuid();
var target = new Entity("contact") { Id = guid1 };
//Execute our plugin against the selected target
var fakedPlugin = fakedContext.ExecutePluginWithTarget<RetrieveServicesPlugin>(target);
//Assert that the plugin was executed
A.CallTo(() => fakedPlugin.Execute(A<IServiceProvider>._))
.MustHaveHappened();
}
示例4: When_the_followup_plugin_is_executed_for_an_account_it_should_create_a_new_task
public void When_the_followup_plugin_is_executed_for_an_account_it_should_create_a_new_task()
{
var fakedContext = new XrmFakedContext();
fakedContext.ProxyTypesAssembly = Assembly.GetExecutingAssembly(); //Needed to be able to return early bound entities
var guid1 = Guid.NewGuid();
var target = new Entity("account") { Id = guid1 };
fakedContext.ExecutePluginWithTarget<FollowupPlugin>(target);
//The plugin creates a followup activity, check that that one exists
var tasks = (from t in fakedContext.CreateQuery<Task>()
select t).ToList();
Assert.True(tasks.Count == 1);
Assert.True(tasks[0]["subject"].Equals("Send e-mail to the new customer."));
}
示例5: When_executing_a_plugin_which_inherits_from_iplugin_it_does_compile
public void When_executing_a_plugin_which_inherits_from_iplugin_it_does_compile()
{
var fakedContext = new XrmFakedContext();
var fakedPlugin = fakedContext.ExecutePluginWithTarget<MyPlugin>(new Entity());
}