public void EnsureAtLeastComponentThrows() { var pipelinePolicy = new PipelinePolicy { Stages = { new StagePolicy { StageIdGuid = StageCategory.Decoder.Id.ToString(), MinOccurs = 1 } } }; var stage = new Stage(StageCategory.Decoder.Id, pipelinePolicy); Action(() => stage.As <IVisitable <IPipelineVisitor> >().Accept(new Mock <IPipelineVisitor>().Object)) .Should().Throw <ArgumentException>() .WithMessage("Stage 'Decoder' should contain at least 1 components."); }
public void EnsureAtMostComponentThrows() { var pipelinePolicy = new PipelinePolicy { Stages = { new StagePolicy { StageIdGuid = StageCategory.AssemblingSerializer.Id.ToString(), ExecutionMethod = ExecMethod.FirstMatch, MaxOccurs = 1 } } }; var stage = new Stage(StageCategory.AssemblingSerializer.Id, pipelinePolicy); var component = new XmlAsmComp(); stage.AddComponent(component); stage.AddComponent(component); Action(() => stage.As <IVisitable <IPipelineVisitor> >().Accept(new Mock <IPipelineVisitor>().Object)) .Should().Throw <ArgumentException>() .WithMessage("Stage 'AssemblingSerializer' should contain at most 1 components."); }