public void ExecuteWhenMicroComponentEnumerableIsEmpty() { var messageMock = new Unit.Message.Mock <IBaseMessage>(); var sut = new MicroPipeline(); sut.Execute(new Mock <IPipelineContext>().Object, messageMock.Object).Should().BeSameAs(messageMock.Object); }
public void ExecuteRunsThroughMicroComponentEnumerable() { var pipelineContextMock = new Mock <IPipelineContext>(); var messageMock1 = new Unit.Message.Mock <IBaseMessage>(); var messageMock2 = new Unit.Message.Mock <IBaseMessage>(); var messageMock3 = new Unit.Message.Mock <IBaseMessage>(); var microComponentMockOne = new Mock <IMicroComponent>(); microComponentMockOne .Setup(mc => mc.Execute(pipelineContextMock.Object, messageMock1.Object)).Returns(messageMock2.Object) .Verifiable(); var microComponentMockTwo = new Mock <IMicroComponent>(); microComponentMockTwo .Setup(mc => mc.Execute(pipelineContextMock.Object, messageMock2.Object)).Returns(messageMock3.Object) .Verifiable(); var sut = new MicroPipeline { Components = new[] { microComponentMockOne.Object, microComponentMockTwo.Object } }; sut.Execute(pipelineContextMock.Object, messageMock1.Object).Should().BeSameAs(messageMock3.Object); microComponentMockOne.Verify(); microComponentMockTwo.Verify(); }
public void SaveConfiguration() { var specimenContext = new SpecimenContext(CreateAutoFixture()); var microComponents = new[] { specimenContext.Create <IMicroComponent>(), specimenContext.Create <IMicroComponent>(), specimenContext.Create <IMicroComponent>() }; var sut = new MicroPipeline { Components = microComponents }; var configuration = sut.SaveConfiguration(); configuration.Should().Be(MicroComponentEnumerableConverter.Serialize(microComponents)); }
public void LoadConfiguration() { var specimenContext = new SpecimenContext(CreateAutoFixture()); var microComponents = new[] { specimenContext.Create <IMicroComponent>(), specimenContext.Create <IMicroComponent>(), specimenContext.Create <IMicroComponent>() }; var configuration = MicroComponentEnumerableConverter.Serialize(microComponents); var sut = new MicroPipeline(); sut.LoadConfiguration(configuration); sut.Components.Should().BeEquivalentTo(microComponents.Cast <object>(), o => o.IncludingProperties()); }