< Summary

Information
Class: ArturRios.Data.Export.Configuration.ExportOptions
Assembly: ArturRios.Data.Export
File(s): D:\Repositories\dotnet-data\src\ArturRios.Data.Export\Configuration\ExportOptions.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 66
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 4
Fully covered methods: 4
Total methods: 4
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Csv()100%11100%
get_Json()100%11100%
get_Txt()100%11100%
get_MessagePack()100%11100%

File(s)

D:\Repositories\dotnet-data\src\ArturRios.Data.Export\Configuration\ExportOptions.cs

#LineLine coverage
 1using System.Text;
 2using System.Text.Json;
 3using MessagePack;
 4using MessagePack.Resolvers;
 5
 6namespace ArturRios.Data.Export.Configuration;
 7
 8/// <summary>Options for the CSV exporter.</summary>
 9public class CsvOptions
 10{
 11    /// <summary>Field delimiter. Default ','.</summary>
 12    public char Delimiter { get; set; } = ',';
 13
 14    /// <summary>Whether to write a header row from the column map. Default true.</summary>
 15    public bool IncludeHeader { get; set; } = true;
 16
 17    /// <summary>Text encoding. Default UTF-8 without BOM.</summary>
 18    public Encoding Encoding { get; set; } = new UTF8Encoding(false);
 19}
 20
 21/// <summary>Options for the JSON exporter.</summary>
 22public class JsonOptions
 23{
 24    /// <summary>Whether to indent the JSON. Ignored when <see cref="SerializerOptions" /> is set.</summary>
 25    public bool WriteIndented { get; set; }
 26
 27    /// <summary>Explicit serializer options; when set, used as-is.</summary>
 28    public JsonSerializerOptions? SerializerOptions { get; set; }
 29}
 30
 31/// <summary>Options for the TXT exporter.</summary>
 32public class TxtOptions
 33{
 34    /// <summary>Text encoding. Default UTF-8 without BOM.</summary>
 35    public Encoding Encoding { get; set; } = new UTF8Encoding(false);
 36
 37    /// <summary>Line terminator. Default <see cref="Environment.NewLine" />.</summary>
 38    public string NewLine { get; set; } = Environment.NewLine;
 39}
 40
 41/// <summary>Options for the MessagePack exporter.</summary>
 42public class MessagePackOptions
 43{
 44    /// <summary>Explicit serializer options; when set, used as-is.</summary>
 45    public MessagePackSerializerOptions? SerializerOptions { get; set; }
 46
 47    /// <summary>The options actually used: caller-supplied, else contractless standard (no attributes required).</summa
 48    public MessagePackSerializerOptions Effective =>
 49        SerializerOptions ?? MessagePackSerializerOptions.Standard.WithResolver(ContractlessStandardResolver.Instance);
 50}
 51
 52/// <summary>Aggregate options for the core exporters, configured via <c>AddExport</c>.</summary>
 53public class ExportOptions
 54{
 55    /// <summary>CSV options.</summary>
 2356    public CsvOptions Csv { get; set; } = new();
 57
 58    /// <summary>JSON options.</summary>
 2059    public JsonOptions Json { get; set; } = new();
 60
 61    /// <summary>TXT options.</summary>
 1962    public TxtOptions Txt { get; set; } = new();
 63
 64    /// <summary>MessagePack options.</summary>
 1965    public MessagePackOptions MessagePack { get; set; } = new();
 66}