public void Build_creates_a_ChangeLogPipeline_using_the_container() { // ARRANGE var task = new TestTask(); using var container = BuildContainer(b => { b.RegisterType <ChangeLogPipeline>(); b.RegisterInstance(NullLogger <ChangeLogPipeline> .Instance).As <ILogger <ChangeLogPipeline> >(); b.RegisterInstance(task); }); var pipelineBuilder = new ChangeLogPipelineBuilder(container); _ = pipelineBuilder.AddTask <TestTask>(); // ACT var pipeline = pipelineBuilder.Build(); // ASSERT Assert.NotNull(pipeline); var registeredTask = Assert.Single(pipeline.Tasks); Assert.Same(task, registeredTask); }
public void Constructor_initializes_Container_property() { // ARRANGE var container = Mock.Of <IContainer>(MockBehavior.Strict); // ACT var pipelineBuilder = new ChangeLogPipelineBuilder(container); // ASSERT Assert.NotNull(pipelineBuilder.Container); Assert.Same(container, pipelineBuilder.Container); }
public void AddTask_resolves_task_from_the_container() { // ARRANGE var task = new TestTask(); using var container = BuildContainer(b => { b.RegisterInstance(task); }); var pipelineBuilder = new ChangeLogPipelineBuilder(container); // ACT _ = pipelineBuilder.AddTask <TestTask>(); // ASSERT var registeredTask = Assert.Single(pipelineBuilder.Tasks); Assert.Same(task, registeredTask); }