< Summary

Information
Class: ArturRios.Data.Export.Exporters.JsonExporter<T>
Assembly: ArturRios.Data.Export
File(s): /home/runner/work/dotnet-data/dotnet-data/src/ArturRios.Data.Export/Exporters/JsonExporter.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 19
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 2
Fully covered methods: 2
Total methods: 2
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
WriteCoreAsync(...)100%11100%

File(s)

/home/runner/work/dotnet-data/dotnet-data/src/ArturRios.Data.Export/Exporters/JsonExporter.cs

#LineLine coverage
 1using System.Text.Json;
 2using ArturRios.Data.Export.Configuration;
 3using Microsoft.Extensions.Logging;
 4
 5namespace ArturRios.Data.Export.Exporters;
 6
 7/// <summary>Serializes the collection as a JSON array via System.Text.Json.</summary>
 8/// <typeparam name="T">The record type.</typeparam>
 9/// <param name="options">JSON options.</param>
 10/// <param name="logger">Optional logger; see <see cref="ExporterBase{T}" />.</param>
 11public class JsonExporter<T>(JsonOptions options, ILogger<JsonExporter<T>>? logger = null)
 1012    : ExporterBase<T>(logger) where T : class
 13{
 14    /// <inheritdoc />
 15    protected override Task WriteCoreAsync(IEnumerable<T> data, Stream destination, CancellationToken ct)
 16    {
 617        return JsonSerializer.SerializeAsync(destination, data, options.Effective, ct);
 18    }
 19}