/// <summary> /// Writes the start of a TeamCity message block, then returns a disposable that write the end on Dispose. /// </summary> /// <param name="teamCityProvider">TeamCity provider.</param> /// <param name="blockName">The name of the report block.</param> /// <returns>A disposable wrapper the writes the report block end.</returns> public static IDisposable Block(this ITeamCityProvider teamCityProvider, string blockName) { if (teamCityProvider == null) { throw new ArgumentNullException("teamCityProvider"); } teamCityProvider.WriteStartBlock(blockName); return(new TeamCityActionDisposable(teamCityProvider, tc => tc.WriteEndBlock(blockName))); }
/// <summary> /// Writes the start of a TeamCity message block, then returns a disposable that writes the report block end on dispose. /// </summary> /// <param name="teamCityProvider">TeamCity provider.</param> /// <param name="blockName">The name of the report block.</param> /// <returns>A disposable that writes the report block end.</returns> public static IDisposable Block(this ITeamCityProvider teamCityProvider, string blockName) { if (teamCityProvider == null) { throw new ArgumentNullException(nameof(teamCityProvider)); } teamCityProvider.WriteStartBlock(blockName); return(Disposable.Create(() => teamCityProvider.WriteEndBlock(blockName))); }