示例#1
0
        public void TrackActivityWhenBatchTrackingContextIsNull()
        {
            var sut = BatchReleaseProcessActivityTracker.Create(PipelineContextMock.Object, MessageMock.Object);

            sut.TrackActivity(null);

            ActivityFactory.Verify(af => af.CreateProcess(It.IsAny <IBaseMessage>(), It.IsAny <string>()), Times.Never);
            ActivityFactory.Verify(af => af.FindProcess(It.IsAny <string>()), Times.Never);

            ProcessMock.Verify(p => p.TrackActivity(), Times.Never);
            ProcessMock.Verify(p => p.AddSteps(It.IsAny <IEnumerable <string> >()), Times.Never);
        }
示例#2
0
        public void TrackActivityWithoutAmbientProcessActivity()
        {
            var batchTrackingContext = new BatchTrackingContext {
                MessagingStepActivityIdList = new[] { ActivityId.NewActivityId(), ActivityId.NewActivityId(), ActivityId.NewActivityId() }
            };

            var sut = BatchReleaseProcessActivityTracker.Create(PipelineContextMock.Object, MessageMock.Object);

            sut.TrackActivity(batchTrackingContext);

            ActivityFactory.Verify(af => af.CreateProcess(MessageMock.Object, It.IsAny <string>()), Times.Once);
            ActivityFactory.Verify(af => af.FindProcess(It.IsAny <string>()), Times.Never);

            ProcessMock.Verify(p => p.TrackActivity(), Times.Once);
            ProcessMock.Verify(
                p => p.AddSteps(
                    It.Is <IEnumerable <string> >(
                        list => list.SequenceEqual(
                            batchTrackingContext.MessagingStepActivityIdList.Append(MessageMock.Object.GetProperty(TrackingProperties.MessagingStepActivityId))))),
                Times.Once);
        }