Exemplo n.º 1
0
        /// <summary>
        /// Exports the recorded data.
        /// </summary>
        /// <param name="encoder">The encoder.</param>
        /// <returns>The recorded data represented as a string.</returns>
        public string Export(IAnsiConsoleEncoder encoder)
        {
            if (encoder is null)
            {
                throw new ArgumentNullException(nameof(encoder));
            }

            return(encoder.Encode(_recorded));
        }
        /// <summary>
        /// Exports all recorded console output using a custom encoder.
        /// </summary>
        /// <param name="encoder">The encoder to use.</param>
        /// <returns>The recorded output.</returns>
        public static string ExportCustom(IAnsiConsoleEncoder encoder)
        {
            if (_recorder == null)
            {
                throw new InvalidOperationException("Cannot export HTML since a recording hasn't been started.");
            }

            if (encoder is null)
            {
                throw new ArgumentNullException(nameof(encoder));
            }

            return(_recorder.Export(encoder));
        }