/// <summary> /// Creates a new child scope with an automatic identifier and the specified name. /// </summary> /// <param name="name">The name of this scope. Does not have to be unique.</param> public static ITrackingScope CreateScope(this ICreateScope creator, string?name) { if (creator is null) { throw new ArgumentNullException(nameof(creator)); } return(creator.CreateScope(Guid.NewGuid(), name)); }
public void CreateScopeWithNameThrowsOnNullCreator() { // arrange var name = Guid.NewGuid().ToString(); ICreateScope creator = null; // act var ex = Assert.Throws <ArgumentNullException>(() => creator.CreateScope(name)); // assert Assert.Equal(nameof(creator), ex.ParamName); }
/// <summary> /// Creates a new nameless child scope with an automatic identifier. /// </summary> public static ITrackingScope CreateScope(this ICreateScope creator) { return(creator.CreateScope(null)); }