Esempio n. 1
0
        public void TrackActivityWithAmbientProcessActivity()
        {
            var batchTrackingContext = new BatchTrackingContext {
                MessagingStepActivityIdList = new[] { ActivityId.NewActivityId(), ActivityId.NewActivityId(), ActivityId.NewActivityId() },
                ProcessActivityId           = ActivityId.NewActivityId()
            };

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

            sut.TrackActivity(batchTrackingContext);

            ActivityFactory.Verify(af => af.CreateProcess(It.IsAny <IBaseMessage>(), It.IsAny <string>()), Times.Never());
            // ReSharper disable once ImplicitlyCapturedClosure
            ActivityFactory.Verify(af => af.FindProcess(batchTrackingContext.ProcessActivityId), Times.Once());

            ProcessMock.Verify(p => p.TrackActivity(), Times.Once());
            ProcessMock.Verify(
                p =>
                p.AddSteps(
                    It.Is <IEnumerable <string> >(
                        list =>
                        list.SequenceEqual(
                            batchTrackingContext.MessagingStepActivityIdList
                            .Concat(new[] { MessageMock.Object.GetProperty(TrackingProperties.MessagingStepActivityId) })))),
                Times.Once());
        }
Esempio n. 2
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());
        }