public void GetTarget_ThrowsError()
        {
            #region arrange - given
            var context = new FakeLocalPluginContext();
            #endregion

            #region act & assert

            Assert.ThrowsException <System.NullReferenceException>(
                () =>
            {
                Entity target = PostUpdate.GetTargetEntity(null);
            });

            Assert.ThrowsException <System.NullReferenceException>(
                () =>
            {
                Entity target = PostUpdate.GetTargetEntity(context);
            });

            #endregion
        }
Esempio n. 2
0
        public void GetTargetEntityReference_ThrowsErrorWhenTargetIsNull()
        {
            #region arrange - given

            var entityName = "invalidentity";
            var target     = new Entity(entityName)
            {
                Id = Guid.NewGuid()
            };

            #endregion

            using (var pipeline = new PluginPipeline("fdbzap_ar_applytemplategroup", FakeStages.PostOperation, target))
            {
                pipeline.InputParameters["Target"] = null;
                var context = new FakeLocalPluginContext(pipeline);

                Assert.ThrowsException <InvalidPluginExecutionException>(() =>
                {
                    ApplyTemplateGroupAction.GetTargetEntityReference(context);
                }, "An exception was expected, but it did not occur.");
            }
        }
        public void GetTargetEntityReference_ThrowsErrorWhenTargetIsMissing()
        {
            #region arrange - given

            var entityName = "invalidentity";
            var target     = new Entity(entityName)
            {
                Id = Guid.NewGuid()
            };

            #endregion

            using (var pipeline = new PluginPipeline("fdbzap_ar_checkstatus", FakeStages.PostOperation, target))
            {
                pipeline.InputParameters.Remove("Target");
                var context = new FakeLocalPluginContext(pipeline);

                Assert.ThrowsException <InvalidPluginExecutionException>(() =>
                {
                    CheckStatusAction.GetTargetEntityReference(context);
                }, "An exception was expected, but it did not occur.");
            }
        }