Exemplo n.º 1
0
        public ManualTracker(IChronoscopeContext context, Guid id, Guid scopeId)
        {
            _context = context ?? throw new ArgumentNullException(nameof(context));
            _watch   = _context.StopwatchFactory.Create();

            Id      = id;
            ScopeId = scopeId;

            _context.Sink.Sink(_context.EventFactory.CreateTrackerCreatedEvent(ScopeId, Id, _context.Clock.Now, _watch.Elapsed));
        }
Exemplo n.º 2
0
        internal TrackingScope(IOptions <ChronoscopeOptions> options, IChronoscopeContext context, Guid id, string?name, Guid?parentId)
        {
            _context = context ?? throw new ArgumentNullException(nameof(context));

            Id       = id;
            Name     = name ?? string.Format(CultureInfo.InvariantCulture, options.Value.DefaultTaskScopeNameFormat, id);
            ParentId = parentId;

            _context.Sink.Sink(_context.EventFactory.CreateScopeCreatedEvent(Id, Name, ParentId, _context.Clock.Now));
        }
        public void ThrowsOnNullContext()
        {
            // arrange
            IChronoscopeContext context = null;

            // act
            var result = Assert.Throws <ArgumentNullException>(() => new Chronoscope(context));

            // assert
            Assert.Equal(nameof(context), result.ParamName);
        }
Exemplo n.º 4
0
        public void ThrowsOnNullContext()
        {
            // arrange
            var options = Options.Create(new ChronoscopeOptions());
            IChronoscopeContext context = null;
            var id       = Guid.NewGuid();
            var name     = Guid.NewGuid().ToString();
            var parentId = Guid.NewGuid();

            // act
            var result = Assert.Throws <ArgumentNullException>(() => new TrackingScope(options, context, id, name, parentId));

            // assert
            Assert.Equal(nameof(context), result.ParamName);
        }
Exemplo n.º 5
0
 public Chronoscope(IChronoscopeContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
Exemplo n.º 6
0
 public AutoTracker(IChronoscopeContext context, Guid id, ITrackingScope scope)
     : base(context, id, scope.Id)
 {
     _scope = scope;
 }