public void AccountPluginCreation_ShouldConfigureAccountPluginBusiness() { IPlugin plugin = new AccountPlugin(); var pluginExecutor = CrmServiceProvider.Current.GetService<IPluginExecutorFactory>().GetExecutor(typeof(Account)); Assert.That(pluginExecutor, Is.InstanceOf<AccountCrmBusiness>()); var businessConfiguratorFactory = CrmServiceProvider.Current.GetService<IBusinessConfiguratorAbsractFactory>().GetFactory<Account>(); Assert.That(businessConfiguratorFactory, Is.InstanceOf<AccountBusinessConfiguratorFactory>()); }
public void TestAccountPlugin() { using (var pipline = new PluginPipeline(FakeMessageNames.Create, FakeStages.PreOperation, new Entity("contact"))) { var plugin = new AccountPlugin(); try { pipline.Execute(plugin); Assert.Fail("Exception not thrown"); } catch (InvalidPluginExecutionException ex) { Assert.IsTrue(ex.Message.Contains("Working on it"), "Must throw exeception"); } } }
public void ThrowsException() { using (var pipeline = new PluginPipeline( FakeMessageNames.Create, FakeStages.PreOperation, new Entity("contact"))) { try { // Act var plugin = new AccountPlugin(); pipeline.Execute(plugin); Assert.Fail("No exception thrown"); } catch (Exception ex) { // Assert Assert.AreEqual("Working on it...", ex.Message); } pipeline.FakeService.AssertExpectedCalls(); } }