예제 #1
0
        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.");
        }
예제 #2
0
        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.");
        }