< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.ServiceModelWebServiceBuilderExtensions
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Configuration/ServiceModelWebServiceBuilderExtensions.cs
Line coverage
50%
Covered lines: 64
Uncovered lines: 64
Coverable lines: 128
Total lines: 250
Line coverage: 50%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Configuration/ServiceModelWebServiceBuilderExtensions.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 CoreWCF.Collections.Generic;
 6using CoreWCF.Description;
 7using CoreWCF.OpenApi;
 8using Microsoft.Extensions.DependencyInjection;
 9using Swashbuckle.AspNetCore.Swagger;
 10
 11namespace CoreWCF.Configuration
 12{
 13    public static class ServiceModelWebServiceBuilderExtensions
 14    {
 15        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 16            this IServiceBuilder builder,
 17            string address,
 3018            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 3019                builder,
 3020                typeof(TContract),
 3021                address,
 3022                configureWebBehavior);
 23
 24        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 25            this IServiceBuilder builder,
 26            WebHttpBinding binding,
 27            string address,
 728            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 729                builder,
 730                typeof(TContract),
 731                binding,
 732                address,
 733                configureWebBehavior);
 34
 35        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 36            this IServiceBuilder builder,
 37            Uri address,
 038            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 039                builder,
 040                typeof(TContract),
 041                address,
 042                configureWebBehavior);
 43
 44        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 45            this IServiceBuilder builder,
 46            WebHttpBinding binding,
 47            Uri address,
 048            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 049                builder,
 050                typeof(TContract),
 051                binding,
 052                address,
 053                configureWebBehavior);
 54
 55        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 56            this IServiceBuilder builder,
 57            string address,
 58            Uri listenUri,
 059            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 060                builder,
 061                typeof(TContract),
 062                address,
 063                listenUri,
 064                configureWebBehavior);
 65
 66        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 67            this IServiceBuilder builder,
 68            WebHttpBinding binding,
 69            string address,
 70            Uri listenUri,
 071            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 072                builder,
 073                typeof(TContract),
 074                binding,
 075                address,
 076                listenUri,
 077                configureWebBehavior);
 78
 79        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 80            this IServiceBuilder builder,
 81            Uri address,
 82            Uri listenUri,
 083            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 084                builder,
 085                typeof(TContract),
 086                address,
 087                listenUri,
 088                configureWebBehavior);
 89
 90        public static IServiceBuilder AddServiceWebEndpoint<TService, TContract>(
 91            this IServiceBuilder builder,
 92            WebHttpBinding binding,
 93            Uri address,
 94            Uri listenUri,
 095            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 096                builder,
 097                typeof(TContract),
 098                binding,
 099                address,
 0100                listenUri,
 0101                configureWebBehavior);
 102
 103        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 104            this IServiceBuilder builder,
 105            Type implementedContract,
 106            string address,
 30107            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 30108                builder,
 30109                implementedContract,
 30110                address,
 30111                (Uri)null,
 30112                configureWebBehavior);
 113
 114        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 115            this IServiceBuilder builder,
 116            Type implementedContract,
 117            WebHttpBinding binding,
 118            string address,
 7119            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 7120                builder,
 7121                implementedContract,
 7122                binding,
 7123                address,
 7124                (Uri)null,
 7125                configureWebBehavior);
 126
 127        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 128            this IServiceBuilder builder,
 129            Type implementedContract,
 130            Uri address,
 0131            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 0132                builder,
 0133                implementedContract,
 0134                address,
 0135                (Uri)null,
 0136                configureWebBehavior);
 137
 138        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 139            this IServiceBuilder builder,
 140            Type implementedContract,
 141            WebHttpBinding binding,
 142            Uri address,
 0143            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 0144                builder,
 0145                implementedContract,
 0146                binding,
 0147                address,
 0148                (Uri)null,
 0149                configureWebBehavior);
 150
 151        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 152            this IServiceBuilder builder,
 153            Type implementedContract,
 154            string address,
 155            Uri listenUri,
 30156            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 30157                builder,
 30158                implementedContract,
 30159                new Uri(address, UriKind.RelativeOrAbsolute),
 30160                listenUri,
 30161                configureWebBehavior);
 162
 163        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 164            this IServiceBuilder builder,
 165            Type implementedContract,
 166            WebHttpBinding binding,
 167            string address,
 168            Uri listenUri,
 7169            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint<TService>(
 7170                builder,
 7171                implementedContract,
 7172                binding,
 7173                new Uri(address, UriKind.RelativeOrAbsolute),
 7174                listenUri,
 7175                configureWebBehavior);
 176
 177        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 178            this IServiceBuilder builder,
 179            Type implementedContract,
 180            Uri address,
 181            Uri listenUri,
 30182            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint(
 30183                builder,
 30184                typeof(TService),
 30185                implementedContract,
 30186                new WebHttpBinding(),
 30187                address,
 30188                listenUri,
 30189                configureWebBehavior);
 190
 191        public static IServiceBuilder AddServiceWebEndpoint<TService>(
 192            this IServiceBuilder builder,
 193            Type implementedContract,
 194            WebHttpBinding binding,
 195            Uri address,
 196            Uri listenUri,
 7197            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint(
 7198                builder,
 7199                typeof(TService),
 7200                implementedContract,
 7201                binding,
 7202                address,
 7203                listenUri,
 7204                configureWebBehavior);
 205
 206        public static IServiceBuilder AddServiceWebEndpoint(
 207            this IServiceBuilder builder,
 208            Type service,
 209            Type implementedContract,
 210            Uri address,
 211            Uri listenUri,
 0212            Action<WebHttpBehavior> configureWebBehavior = null) => AddServiceWebEndpoint(
 0213        builder,
 0214        service,
 0215        implementedContract,
 0216        new WebHttpBinding(),
 0217        address,
 0218        listenUri,
 0219        configureWebBehavior);
 220
 221        public static IServiceBuilder AddServiceWebEndpoint(
 222            this IServiceBuilder builder,
 223            Type service,
 224            Type implementedContract,
 225            WebHttpBinding binding,
 226            Uri address,
 227            Uri listenUri,
 228            Action<WebHttpBehavior> configureWebBehavior = null)
 229        {
 37230            builder.AddServiceEndpoint(service, implementedContract, binding, address, listenUri, serviceEndpoint =>
 37231            {
 37232                KeyedByTypeCollection<IEndpointBehavior> behaviors = (KeyedByTypeCollection<IEndpointBehavior>)serviceEn
 37233                WebHttpBehavior webHttpBehavior = behaviors.Find<WebHttpBehavior>() ?? throw DiagnosticUtility.Exception
 37234                configureWebBehavior?.Invoke(webHttpBehavior);
 37235
 37236                if (webHttpBehavior.HelpEnabled)
 37237                {
 0238                    OpenApiDocumentProvider documentProvider = webHttpBehavior.ServiceProvider.GetRequiredService<OpenAp
 0239                    documentProvider.Contracts.Add(new OpenApiContractInfo
 0240                    {
 0241                        Contract = implementedContract,
 0242                        ResponseFormat = webHttpBehavior.DefaultOutgoingResponseFormat
 0243                    });
 37244                }
 74245            });
 246
 37247            return builder;
 248        }
 249    }
 250}

Methods/Properties

AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.String,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,CoreWCF.WebHttpBinding,System.String,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,CoreWCF.WebHttpBinding,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.String,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,CoreWCF.WebHttpBinding,System.String,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Uri,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,CoreWCF.WebHttpBinding,System.Uri,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,System.String,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,CoreWCF.WebHttpBinding,System.String,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,CoreWCF.WebHttpBinding,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,System.String,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,CoreWCF.WebHttpBinding,System.String,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,System.Uri,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,CoreWCF.WebHttpBinding,System.Uri,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,System.Type,System.Uri,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)
AddServiceWebEndpoint(CoreWCF.Configuration.IServiceBuilder,System.Type,System.Type,CoreWCF.WebHttpBinding,System.Uri,System.Uri,System.Action`1<CoreWCF.Description.WebHttpBehavior>)