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)); }
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); }
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); }
public Chronoscope(IChronoscopeContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public AutoTracker(IChronoscopeContext context, Guid id, ITrackingScope scope) : base(context, id, scope.Id) { _scope = scope; }