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 AddStageThrowsForUnsupportedStageExecutionMethod() { var pipelinePolicy = new PipelinePolicy { Stages = { new StagePolicy { StageIdGuid = StageCategory.Any.Id.ToString(), ExecutionMethod = ExecMethod.None } } }; var stage = new Stage(StageCategory.Any.Id, pipelinePolicy) { StagePolicy = { ExecutionMethod = ExecMethod.None } }; var sut = new CodeConstructor(); Action(() => sut.AddStage(stage)) .Should().Throw <ArgumentOutOfRangeException>() .WithMessage("Stage 'Any' Execution Method is not supported; only All and FirstMatch are supported.*"); }
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."); }
internal Stage(Guid categoryId, PipelinePolicy pipelinePolicy) { Category = StageCategory.FromKnownCategoryId(categoryId); StagePolicy = pipelinePolicy.Stages.Cast <StagePolicy>().Single(s => new Guid(s.StageIdGuid) == Category.Id); Components = new ComponentList(this); }