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()); }
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); } }
public void ThrowsErrorForNullType() { var attributes = new PluginAttributesCollection(null); }