public void Dispose()
        {
            _wrappedDisposable?.Dispose();

            var results = _sink.GetLogs().Where(w => w.Write.LogLevel >= LogLevel.Error).ToList();

            if (_expectedErrorsFilter != null)
            {
                results = results.Where(w => !_expectedErrorsFilter(w.Write)).ToList();
            }

            if (results.Count > 0)
            {
                string errorMessage = $"{results.Count} error(s) logged.";
                errorMessage += Environment.NewLine;
                errorMessage += string.Join(Environment.NewLine, results.Select(record =>
                {
                    var r = record.Write;

                    string lineMessage = r.LoggerName + " - " + r.EventId.ToString() + " - " + r.Formatter(r.State, r.Exception);
                    if (r.Exception != null)
                    {
                        lineMessage += Environment.NewLine;
                        lineMessage += "===================";
                        lineMessage += Environment.NewLine;
                        lineMessage += r.Exception;
                        lineMessage += Environment.NewLine;
                        lineMessage += "===================";
                    }
                    return(lineMessage);
                }));

                throw new Exception(errorMessage);
            }
        }