/// <summary> /// Writes the data of the provided <see cref="IDraw"/> to the <see cref="StringBuilder"/> /// </summary> /// <param name="draw">The <see cref="IDraw"/> whose data is to be written</param> /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided draw</returns> private StringBuilder WriteDrawData(IDraw draw) { Guard.Argument(draw, nameof(draw)).NotNull(); var builder = new StringBuilder(); AddEntityData(draw, builder); var lotteryId = _taskProcessor.GetTaskResult(draw.GetLotteryIdAsync()); var drawStatus = _taskProcessor.GetTaskResult(draw.GetStatusAsync()); var drawResults = _taskProcessor.GetTaskResult(draw.GetResultsAsync()); var drawResultsString = drawResults == null ? "null" : string.Join(",", drawResults.Select(s => s.Value)); builder.Append(" LotteryId=").Append(lotteryId) .Append(" DrawStatus=").Append(drawStatus) .Append(" DrawResults=[").Append(drawResultsString).Append("]"); return(builder); }
/// <summary> /// Writes the data of the provided <see cref="IDraw"/> to the <see cref="StringBuilder"/> /// </summary> /// <param name="draw">The <see cref="IDraw"/> whose data is to be written</param> /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided draw</returns> private StringBuilder WriteDrawData(IDraw draw) { Contract.Requires(draw != null); Contract.Ensures(Contract.Result <StringBuilder>() != null); var builder = new StringBuilder(); AddEntityData(draw, builder); var lotteryId = _taskProcessor.GetTaskResult(draw.GetLotteryIdAsync()); var drawStatus = _taskProcessor.GetTaskResult(draw.GetStatusAsync()); var drawResults = _taskProcessor.GetTaskResult(draw.GetResultsAsync()); var drawResultsString = drawResults == null ? "null" : string.Join(",", drawResults.Select(s => s.Value)); builder.Append(" LotteryId=").Append(lotteryId) .Append(" DrawStatus=").Append(drawStatus) .Append(" DrawResults=[").Append(drawResultsString).Append("]"); return(builder); }