public void Pipeline_Process_SequenceOfTwo() { // Arrange var element1 = GetMockFlowElement(); var element2 = GetMockFlowElement(); // Configure the elements element1.Setup(e => e.Process(It.IsAny <IFlowData>())).Callback((IFlowData d) => { var tempdata = d.GetOrAdd("element1", (p) => new TestElementData(p)); tempdata["key"] = "done"; }); element2.Setup(e => e.Process(It.IsAny <IFlowData>())).Callback((IFlowData d) => { var tempdata = d.GetOrAdd("element2", (p) => new TestElementData(p)); tempdata["key"] = "done"; }); // Create the pipeline var pipeline = CreatePipeline( false, false, element1.Object, element2.Object); // Don't create the flow data via the pipeline as we just want // to test Process. IFlowData data = StaticFactories.CreateFlowData(pipeline); data.Process(); // Act pipeline.Process(data); // Assert Assert.IsTrue(data.Errors == null || data.Errors.Count == 0, "Expected no errors"); // Check that the resulting data has the expected values Assert.IsTrue(data.GetDataKeys().Contains("element1"), "data from element 1 is missing in the result"); Assert.IsTrue(data.GetDataKeys().Contains("element2"), "data from element 2 is missing in the result"); Assert.AreEqual("done", data.Get("element1")["key"].ToString()); Assert.AreEqual("done", data.Get("element2")["key"].ToString()); // Check that element 1 was called before element 2. element2.Verify(e => e.Process(It.Is <IFlowData>(d => data.GetDataKeys().Contains("element1"))), "element 1 should have been called before element 2."); }