public void CompositeActivityProcessor_ProcessorThrows() { using var p1 = new TestActivityProcessor( activity => { throw new Exception("Start exception"); }, activity => { throw new Exception("End exception"); }); var activity = new Activity("test"); using var processor = new CompositeProcessor <Activity>(new[] { p1 }); Assert.Throws <Exception>(() => { processor.OnStart(activity); }); Assert.Throws <Exception>(() => { processor.OnEnd(activity); }); }
public void CompositeActivityProcessor_CallsAllProcessorSequentially() { var result = string.Empty; using var p1 = new TestActivityProcessor( activity => { result += "1"; }, activity => { result += "3"; }); using var p2 = new TestActivityProcessor( activity => { result += "2"; }, activity => { result += "4"; }); var activity = new Activity("test"); using (var processor = new CompositeProcessor <Activity>(new[] { p1, p2 })) { processor.OnStart(activity); processor.OnEnd(activity); } Assert.Equal("1234", result); }