Exemplo n.º 1
0
        public void TestCreateBevaviorError()
        {
            Entity target = new Entity("kpd_entity")
            {
                Id = Guid.NewGuid()
            };
            ParameterCollection inputParameters = new ParameterCollection();

            inputParameters.Add("Target", target);

            target.Attributes.SetStringValue("kpd_attr", "test");
            _fakedpluginContext = new XrmFakedPluginExecutionContext
            {
                InputParameters  = inputParameters,
                MessageName      = "Update",
                UserId           = Guid.NewGuid(),
                PreEntityImages  = new EntityImageCollection(),
                PostEntityImages = new EntityImageCollection()
            };

            PluginActionTestAdapter <PluginActionOnUpdateBehavior> _pluginActionTestAdapter = new PluginActionTestAdapter <PluginActionOnUpdateBehavior>();

            _fakedContext.ExecutePluginWith(_fakedpluginContext, _pluginActionTestAdapter);

            Assert.IsFalse(string.IsNullOrEmpty(_pluginActionTestAdapter.ErrorMessage));
        }
Exemplo n.º 2
0
        public void TestCreateBehavior()
        {
            Entity target = new Entity("kpd_entity")
            {
                Id = Guid.NewGuid()
            };
            ParameterCollection inputParameters = new ParameterCollection();

            inputParameters.Add("Target", target);

            _fakedpluginContext = new XrmFakedPluginExecutionContext
            {
                InputParameters = inputParameters,
                MessageName     = "Create",
                UserId          = Guid.NewGuid()
            };

            PluginActionTestAdapter <PluginActionOnCreateBehavior> _pluginActionTestAdapter = new PluginActionTestAdapter <PluginActionOnCreateBehavior>();

            _fakedContext.ExecutePluginWith(_fakedpluginContext, _pluginActionTestAdapter);

            Assert.IsTrue(string.IsNullOrEmpty(_pluginActionTestAdapter.ErrorMessage));
        }