< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.OpenApi.OpenApiDocumentProvider
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/OpenApi/OpenApiDocumentProvider.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 36
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
GetSwagger(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/OpenApi/OpenApiDocumentProvider.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System;
 5using System.Collections.Generic;
 6using CoreWCF.Web;
 7using Microsoft.Extensions.Options;
 8using Microsoft.OpenApi.Models;
 9using Swashbuckle.AspNetCore.Swagger;
 10
 11namespace CoreWCF.OpenApi
 12{
 13    internal sealed class OpenApiDocumentProvider : ISwaggerProvider
 14    {
 15        private readonly IOptions<OpenApiOptions> _options;
 16        private OpenApiDocument _document;
 17
 018        public OpenApiDocumentProvider(
 019            IOptions<OpenApiOptions> options)
 20        {
 021            _options = options;
 022        }
 23
 024        public IList<OpenApiContractInfo> Contracts { get; } = new List<OpenApiContractInfo>();
 25
 26        public OpenApiDocument GetSwagger(string documentName, string host = null, string basePath = null)
 27        {
 028            if (_document == null)
 29            {
 030                _document = OpenApiSchemaBuilder.BuildOpenApiSpecificationDocument(_options.Value, Contracts);
 31            }
 32
 033            return _document;
 34        }
 35    }
 36}