public void GetPluginEvent_ShouldReturnPostUpdatePluginEvent_WhenPluginStageIsPostOperationAndCrmMessageNameIsUpdate()
        {
            m_pluginExecutionContextMock.SetupGet(x => x.Stage).Returns(PostOperation);
            m_pluginExecutionContextMock.SetupGet(x => x.MessageName).Returns(UpdateMessage);

            pluginEvent = m_extractor.GetPluginEvent(m_pluginContextMock.Object);

            Assert.That(pluginEvent, Is.EqualTo(CrmPluginEvent.PostUpdate));
        }
 public BusinessConfigurator GetConfigurator(CrmPluginEvent pluginEvent)
 {
     BusinessConfigurator configurator;
     if (m_configurators.TryGetValue(pluginEvent, out configurator))
     {
         return configurator;
     }
     throw new InvalidOperationException(String.Format(Resources.BusinessConfiguratorFactoryError,
                                                                         GetFactoryName(), pluginEvent));
 }
        public void GetPluginEvent_ShouldCallGetStageOfPluginExecutionContext()
        {
            pluginEvent = m_extractor.GetPluginEvent(m_pluginContextMock.Object);

            m_pluginExecutionContextMock.VerifyGet(x => x.Stage, Times.AtLeastOnce);
        }
        public void GetPluginEvent_ShouldReturnPreValidateDeletePluginEvent_WhenPluginStageIsPreValidateAndCrmMessageNameIsDelete()
        {
            m_pluginExecutionContextMock.SetupGet(x => x.Stage).Returns(PreValidate);
            m_pluginExecutionContextMock.SetupGet(x => x.MessageName).Returns(DeleteMessage);

            pluginEvent = m_extractor.GetPluginEvent(m_pluginContextMock.Object);

            Assert.That(pluginEvent, Is.EqualTo(CrmPluginEvent.PreValidateDelete));
        }
        public void GetPluginEvent_ShouldReturnPreValidateCreatePluginEvent_WhenPluginStageIsPreValidateAndCrmMessageNameIsCreate()
        {
            pluginEvent = m_extractor.GetPluginEvent(m_pluginContextMock.Object);

            Assert.That(pluginEvent, Is.EqualTo(CrmPluginEvent.PreValidateCreate));
        }