コード例 #1
0
            public void InitializesCollectionWithValidType()
            {
                var type       = typeof(SampleAccountPlugin);
                var attributes = new PluginAttributesCollection(type);

                Assert.IsNotNull(attributes);
                Assert.AreEqual(4, attributes.Count());
                Assert.AreEqual(Schema.AccountEntity.TypeName, attributes.PrimaryEntityLogicalName);
                CollectionAssert.AreEqual(new[] { Messages.Create }, attributes.PipelineMessages.ToArray());
                CollectionAssert.AreEqual(new[] { PipelineStage.PreOperation }, attributes.PipelineStages.ToArray());
                CollectionAssert.AreEqual(new[] { ExecutionMode.Synchronous }, attributes.ExecutionModes.ToArray());
            }
コード例 #2
0
        protected virtual void Validate(IPluginContext context, Type pluginType)
        {
            var attributes = new PluginAttributesCollection(pluginType);

            if (attributes.ExecutionModes.Any())
            {
                context.EnsureSupportedExecutionMode(attributes.ExecutionModes.ToArray());
            }

            if (attributes.PipelineStages.Any())
            {
                context.EnsureSupportedPipelineStage(attributes.PipelineStages.ToArray());
            }

            if (attributes.PipelineMessages.Any())
            {
                context.EnsureSupportedMessage(attributes.PipelineMessages.ToArray());
            }

            if (!String.IsNullOrWhiteSpace(attributes.PrimaryEntityLogicalName))
            {
                context.EnsureTargetLogicalName(attributes.PrimaryEntityLogicalName);
            }
        }
コード例 #3
0
 public void ThrowsErrorForNullType()
 {
     var attributes = new PluginAttributesCollection(null);
 }