From 0e67ec38349be2c5c456647aaca028be0595b09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C4=99czek?= Date: Sat, 28 May 2022 22:48:38 +0200 Subject: [PATCH 1/4] Extracting abstractions to Lib.AspNetCore.ServerTiming.Abstractions (#19) --- .../Controllers/WeatherForecastsController.cs | 1 + Demo.AspNetCore.ServerTiming/Startup.cs | 4 +- .../Filters/IServerTimingMetricFilter.cs | 4 +- .../Http/Headers/ServerTimingMetric.cs | 2 +- .../IServerTiming.cs | 4 +- ...spNetCore.ServerTiming.Abstractions.csproj | 37 +++++++++++++++++++ .../ServerTimingDeliveryMode.cs | 2 +- Lib.AspNetCore.ServerTiming.sln | 8 +++- .../Filters/CustomServerTimingMetricFilter.cs | 3 +- ...tingEnvironmentServerTimingMetricFilter.cs | 3 +- .../Filters/IPRangeMetricFilter.cs | 3 +- ...ctDescriptionsToDevelopmentMetricFilter.cs | 4 +- .../RestrictToDevelopmentMetricFilter.cs | 2 +- .../HttpResponseHeadersExtensions.cs | 1 + .../Http/Headers/ServerTimingHeaderValue.cs | 1 + .../Lib.AspNetCore.ServerTiming.csproj | 3 ++ Lib.AspNetCore.ServerTiming/ServerTiming.cs | 3 +- .../ServerTimingMiddleware.cs | 3 +- .../ServerTimingOptions.cs | 2 +- .../ServerTimingOptionsExtensions.cs | 2 +- ...ServerTimingServiceCollectionExtensions.cs | 1 + .../ServerTimingUtility.cs | 3 +- .../Filters/IPRangeMetricFilterTests.cs | 2 +- ...criptionsToDevelopmentMetricFilterTests.cs | 2 +- .../RestrictToDevelopmentMetricFilterTests.cs | 2 +- .../ServerTimingServerStartup.cs | 5 ++- .../ServerTimingServerTests.cs | 4 +- 27 files changed, 84 insertions(+), 27 deletions(-) rename {Lib.AspNetCore.ServerTiming => Lib.AspNetCore.ServerTiming.Abstractions}/Filters/IServerTimingMetricFilter.cs (88%) rename {Lib.AspNetCore.ServerTiming => Lib.AspNetCore.ServerTiming.Abstractions}/Http/Headers/ServerTimingMetric.cs (98%) rename {Lib.AspNetCore.ServerTiming => Lib.AspNetCore.ServerTiming.Abstractions}/IServerTiming.cs (82%) create mode 100644 Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj rename {Lib.AspNetCore.ServerTiming => Lib.AspNetCore.ServerTiming.Abstractions}/ServerTimingDeliveryMode.cs (87%) diff --git a/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs b/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs index 4a8721e..7b2bccc 100644 --- a/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs +++ b/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Lib.AspNetCore.ServerTiming; +using Lib.AspNetCore.ServerTiming.Abstractions; namespace Demo.AspNetCore.ServerTiming.Controllers { diff --git a/Demo.AspNetCore.ServerTiming/Startup.cs b/Demo.AspNetCore.ServerTiming/Startup.cs index f9acb38..87c84bf 100644 --- a/Demo.AspNetCore.ServerTiming/Startup.cs +++ b/Demo.AspNetCore.ServerTiming/Startup.cs @@ -4,8 +4,8 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Lib.AspNetCore.ServerTiming; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Demo.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/Filters/IServerTimingMetricFilter.cs b/Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs similarity index 88% rename from Lib.AspNetCore.ServerTiming/Filters/IServerTimingMetricFilter.cs rename to Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs index a74e01a..b1ce263 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/IServerTimingMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; -namespace Lib.AspNetCore.ServerTiming.Filters +namespace Lib.AspNetCore.ServerTiming.Abstractions.Filters { /// /// A filter that can inspect and modify the metrics which are to be delivered in a response to current request. diff --git a/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingMetric.cs b/Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs similarity index 98% rename from Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingMetric.cs rename to Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs index 72a4812..27e7f46 100644 --- a/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingMetric.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Text.RegularExpressions; -namespace Lib.AspNetCore.ServerTiming.Http.Headers +namespace Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers { /// /// Server timing performance metric. diff --git a/Lib.AspNetCore.ServerTiming/IServerTiming.cs b/Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs similarity index 82% rename from Lib.AspNetCore.ServerTiming/IServerTiming.cs rename to Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs index cefe2dd..1208d10 100644 --- a/Lib.AspNetCore.ServerTiming/IServerTiming.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; -namespace Lib.AspNetCore.ServerTiming +namespace Lib.AspNetCore.ServerTiming.Abstractions { /// /// Provides support for Server Timing API. diff --git a/Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj b/Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj new file mode 100644 index 0000000..eee9849 --- /dev/null +++ b/Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj @@ -0,0 +1,37 @@ + + + Lib.AspNetCore.ServerTiming.Abstractions provides abstractions for Lib.AspNetCore.ServerTiming, a library which provides Server Timing API support for ASP.NET Core. + Copyright © 2022 Tomasz Pęczek + 1.0.0 + Tomasz Pęczek + netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net461 + Lib.AspNetCore.ServerTiming.Abstractions + Lib.AspNetCore.ServerTiming.Abstractions + Lib.AspNetCore.ServerTiming.Abstractions + aspnetcore;servertiming;performance + https://github.com/tpeczek/Lib.AspNetCore.ServerTiming + MIT + README.md + git + git://github.com/tpeczek/Lib.AspNetCore.ServerTiming + true + true + true + true + true + true + latest + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingDeliveryMode.cs b/Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs similarity index 87% rename from Lib.AspNetCore.ServerTiming/ServerTimingDeliveryMode.cs rename to Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs index d7fd016..180143b 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingDeliveryMode.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs @@ -1,4 +1,4 @@ -namespace Lib.AspNetCore.ServerTiming +namespace Lib.AspNetCore.ServerTiming.Abstractions { /// /// The metrics delivery mode. diff --git a/Lib.AspNetCore.ServerTiming.sln b/Lib.AspNetCore.ServerTiming.sln index 4ff2fa9..30da484 100644 --- a/Lib.AspNetCore.ServerTiming.sln +++ b/Lib.AspNetCore.ServerTiming.sln @@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.AspNetCore.ServerTimin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.AspNetCore.ServerTiming", "Demo.AspNetCore.ServerTiming\Demo.AspNetCore.ServerTiming.csproj", "{C7A47113-CBA9-486C-8F95-50B2E12D71B3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocFx.AspNetCore.ServerTiming", "DocFx.AspNetCore.ServerTiming\DocFx.AspNetCore.ServerTiming.csproj", "{E7DC599F-40C9-4651-97B9-6B47CD05BA0D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFx.AspNetCore.ServerTiming", "DocFx.AspNetCore.ServerTiming\DocFx.AspNetCore.ServerTiming.csproj", "{E7DC599F-40C9-4651-97B9-6B47CD05BA0D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0AE38B1E-B1A7-4CB7-8F17-54AED3982407}" ProjectSection(SolutionItems) = preProject @@ -18,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lib.AspNetCore.ServerTiming.Abstractions", "Lib.AspNetCore.ServerTiming.Abstractions\Lib.AspNetCore.ServerTiming.Abstractions.csproj", "{B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {E7DC599F-40C9-4651-97B9-6B47CD05BA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU {E7DC599F-40C9-4651-97B9-6B47CD05BA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU {E7DC599F-40C9-4651-97B9-6B47CD05BA0D}.Release|Any CPU.Build.0 = Release|Any CPU + {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs index 18fd2b4..8bc687a 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs index 1c712be..4059b46 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs index 6f2febd..d2f7eea 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs @@ -2,7 +2,8 @@ using System.Net.Sockets; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs index 26916e3..3441b59 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs @@ -1,7 +1,7 @@ using System.Linq; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { @@ -36,7 +36,7 @@ public override bool OnServerTimingHeaderPreparation(HttpContext context, IColle { if (!IsDevelopment) { - List newMetrics = metrics .Select(m => new ServerTimingMetric(m.Name,m.Value,null)).ToList(); + List newMetrics = metrics .Select(m => m.Value.HasValue ? new ServerTimingMetric(m.Name, m.Value.Value, null) : new ServerTimingMetric(m.Name, null)).ToList(); metrics.Clear(); newMetrics.ForEach(m => metrics.Add(m)); } diff --git a/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs index 6d7a920..1879346 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs b/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs index 57ac3f4..ea27a19 100644 --- a/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs +++ b/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs @@ -1,6 +1,7 @@ using System; using Microsoft.AspNetCore.Http; using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Http.Extensions { diff --git a/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs b/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs index d193ae7..6643ca9 100644 --- a/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs +++ b/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Http.Headers { diff --git a/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj b/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj index 65e8986..aa7ff4a 100644 --- a/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj +++ b/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj @@ -25,6 +25,9 @@ + + + diff --git a/Lib.AspNetCore.ServerTiming/ServerTiming.cs b/Lib.AspNetCore.ServerTiming/ServerTiming.cs index d76da95..9d2fbef 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTiming.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTiming.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs b/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs index c9cbcb0..dc54ffb 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs @@ -3,9 +3,10 @@ using System.Threading.Tasks; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions; using Lib.AspNetCore.ServerTiming.Http.Headers; using Lib.AspNetCore.ServerTiming.Http.Extensions; +using Lib.AspNetCore.ServerTiming.Abstractions.Filters; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs b/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs index dad129d..20a72ca 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Lib.AspNetCore.ServerTiming.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Filters; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs b/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs index bc2c8dd..e9932a2 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Lib.AspNetCore.ServerTiming.Filters; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs b/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs index 6c55272..efd5d60 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Lib.AspNetCore.ServerTiming; +using Lib.AspNetCore.ServerTiming.Abstractions; namespace Microsoft.AspNetCore.Builder { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs b/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs index 3ab08c2..6223b76 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs @@ -3,7 +3,8 @@ using System.Diagnostics; using System.Threading.Tasks; using System.Runtime.CompilerServices; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming { diff --git a/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs index 7f93a09..b251838 100644 --- a/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs +++ b/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs @@ -1,8 +1,8 @@ using System.Net; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; using Lib.AspNetCore.ServerTiming.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; using Xunit; diff --git a/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs index c6a6fb3..be59c54 100644 --- a/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs +++ b/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; using Lib.AspNetCore.ServerTiming.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; using Moq; using Xunit; diff --git a/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs index 3693dff..f6a48ef 100644 --- a/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs +++ b/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Http.Headers; using Lib.AspNetCore.ServerTiming.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; using Moq; using Xunit; diff --git a/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs b/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs index 3e5b79b..90ffc80 100644 --- a/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs +++ b/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs @@ -6,8 +6,9 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Lib.AspNetCore.ServerTiming; -using Lib.AspNetCore.ServerTiming.Filters; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions; +using Lib.AspNetCore.ServerTiming.Abstractions.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Test.AspNetCore.ServerTiming.Infrastructure { diff --git a/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs b/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs index c530d06..636fd27 100644 --- a/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs +++ b/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs @@ -5,8 +5,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; -using Lib.AspNetCore.ServerTiming.Filters; -using Lib.AspNetCore.ServerTiming.Http.Headers; +using Lib.AspNetCore.ServerTiming.Abstractions.Filters; +using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; using Moq; using Xunit; using Test.AspNetCore.ServerTiming.Infrastructure; From 01c129b56d094f694c0105369c3d523db702dcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C4=99czek?= Date: Sun, 29 May 2022 11:50:28 +0200 Subject: [PATCH 2/4] Extracting abstractions to Lib.AspNetCore.ServerTiming.Abstractions (#19) --- .../Controllers/WeatherForecastsController.cs | 1 - Demo.AspNetCore.ServerTiming/Startup.cs | 4 ++-- .../Filters/IServerTimingMetricFilter.cs | 4 ++-- .../Http/Headers/ServerTimingMetric.cs | 2 +- Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs | 4 ++-- .../ServerTimingDeliveryMode.cs | 2 +- .../Filters/CustomServerTimingMetricFilter.cs | 3 +-- .../Filters/HostingEnvironmentServerTimingMetricFilter.cs | 3 +-- Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs | 3 +-- .../RestrictDescriptionsToDevelopmentMetricFilter.cs | 2 +- .../Filters/RestrictToDevelopmentMetricFilter.cs | 2 +- .../Http/Extensions/HttpResponseHeadersExtensions.cs | 1 - .../Http/Headers/ServerTimingHeaderValue.cs | 1 - Lib.AspNetCore.ServerTiming/ServerTiming.cs | 3 +-- Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs | 3 +-- Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs | 2 +- .../ServerTimingOptionsExtensions.cs | 2 +- .../ServerTimingServiceCollectionExtensions.cs | 1 - Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs | 6 ++---- .../Filters/IPRangeMetricFilterTests.cs | 2 +- .../RestrictDescriptionsToDevelopmentMetricFilterTests.cs | 2 +- .../Filters/RestrictToDevelopmentMetricFilterTests.cs | 2 +- .../Infrastructure/ServerTimingServerStartup.cs | 5 ++--- Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs | 4 ++-- 24 files changed, 26 insertions(+), 38 deletions(-) diff --git a/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs b/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs index 7b2bccc..4a8721e 100644 --- a/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs +++ b/Demo.AspNetCore.ServerTiming/Controllers/WeatherForecastsController.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Lib.AspNetCore.ServerTiming; -using Lib.AspNetCore.ServerTiming.Abstractions; namespace Demo.AspNetCore.ServerTiming.Controllers { diff --git a/Demo.AspNetCore.ServerTiming/Startup.cs b/Demo.AspNetCore.ServerTiming/Startup.cs index 87c84bf..f9acb38 100644 --- a/Demo.AspNetCore.ServerTiming/Startup.cs +++ b/Demo.AspNetCore.ServerTiming/Startup.cs @@ -4,8 +4,8 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Lib.AspNetCore.ServerTiming.Abstractions; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Demo.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs b/Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs index b1ce263..a74e01a 100644 --- a/Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; -namespace Lib.AspNetCore.ServerTiming.Abstractions.Filters +namespace Lib.AspNetCore.ServerTiming.Filters { /// /// A filter that can inspect and modify the metrics which are to be delivered in a response to current request. diff --git a/Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs b/Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs index 27e7f46..72a4812 100644 --- a/Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Text.RegularExpressions; -namespace Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers +namespace Lib.AspNetCore.ServerTiming.Http.Headers { /// /// Server timing performance metric. diff --git a/Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs b/Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs index 1208d10..cefe2dd 100644 --- a/Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; -namespace Lib.AspNetCore.ServerTiming.Abstractions +namespace Lib.AspNetCore.ServerTiming { /// /// Provides support for Server Timing API. diff --git a/Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs b/Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs index 180143b..d7fd016 100644 --- a/Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs +++ b/Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs @@ -1,4 +1,4 @@ -namespace Lib.AspNetCore.ServerTiming.Abstractions +namespace Lib.AspNetCore.ServerTiming { /// /// The metrics delivery mode. diff --git a/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs index 8bc687a..18fd2b4 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/CustomServerTimingMetricFilter.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Abstractions.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs index 4059b46..1c712be 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/HostingEnvironmentServerTimingMetricFilter.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Abstractions.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs index d2f7eea..6f2febd 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/IPRangeMetricFilter.cs @@ -2,8 +2,7 @@ using System.Net.Sockets; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Abstractions.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs index 3441b59..53d4716 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs @@ -1,7 +1,7 @@ using System.Linq; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs index 1879346..6d7a920 100644 --- a/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs +++ b/Lib.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilter.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Filters { diff --git a/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs b/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs index ea27a19..57ac3f4 100644 --- a/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs +++ b/Lib.AspNetCore.ServerTiming/Http/Extensions/HttpResponseHeadersExtensions.cs @@ -1,7 +1,6 @@ using System; using Microsoft.AspNetCore.Http; using Lib.AspNetCore.ServerTiming.Http.Headers; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Http.Extensions { diff --git a/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs b/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs index 6643ca9..d193ae7 100644 --- a/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs +++ b/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingHeaderValue.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; namespace Lib.AspNetCore.ServerTiming.Http.Headers { diff --git a/Lib.AspNetCore.ServerTiming/ServerTiming.cs b/Lib.AspNetCore.ServerTiming/ServerTiming.cs index 9d2fbef..d76da95 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTiming.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTiming.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; -using Lib.AspNetCore.ServerTiming.Abstractions; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs b/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs index dc54ffb..c9cbcb0 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingMiddleware.cs @@ -3,10 +3,9 @@ using System.Threading.Tasks; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Lib.AspNetCore.ServerTiming.Abstractions; +using Lib.AspNetCore.ServerTiming.Filters; using Lib.AspNetCore.ServerTiming.Http.Headers; using Lib.AspNetCore.ServerTiming.Http.Extensions; -using Lib.AspNetCore.ServerTiming.Abstractions.Filters; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs b/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs index 20a72ca..dad129d 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingOptions.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Lib.AspNetCore.ServerTiming.Abstractions.Filters; +using Lib.AspNetCore.ServerTiming.Filters; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs b/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs index e9932a2..bc2c8dd 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingOptionsExtensions.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Lib.AspNetCore.ServerTiming.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs b/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs index efd5d60..6c55272 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.DependencyInjection; using Lib.AspNetCore.ServerTiming; -using Lib.AspNetCore.ServerTiming.Abstractions; namespace Microsoft.AspNetCore.Builder { diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs b/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs index 6223b76..df875f4 100644 --- a/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs +++ b/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs @@ -3,8 +3,7 @@ using System.Diagnostics; using System.Threading.Tasks; using System.Runtime.CompilerServices; -using Lib.AspNetCore.ServerTiming.Abstractions; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Lib.AspNetCore.ServerTiming { @@ -146,8 +145,7 @@ internal static void SetServerTimingDeliveryMode(this IServerTiming serverTiming } // Format a metric name from caller params --> "{fileName}.{function}+{lineNumber} - private static string FormatCallerName(string functionName, string filePath, int lineNumber) => - String.Concat(Path.GetFileNameWithoutExtension(filePath), ".", functionName, "+", lineNumber); + private static string FormatCallerName(string functionName, string filePath, int lineNumber) => String.Concat(Path.GetFileNameWithoutExtension(filePath), ".", functionName, "+", lineNumber); // On dispose, add server timing performance metric. private sealed class ServerTimingInstance : IDisposable diff --git a/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs index b251838..434eeb8 100644 --- a/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs +++ b/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Lib.AspNetCore.ServerTiming.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; using Xunit; diff --git a/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs index be59c54..6c87625 100644 --- a/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs +++ b/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Lib.AspNetCore.ServerTiming.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; using Moq; using Xunit; diff --git a/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs index f6a48ef..d2cc56d 100644 --- a/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs +++ b/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Lib.AspNetCore.ServerTiming.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Http.Headers; using Moq; using Xunit; diff --git a/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs b/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs index 90ffc80..3e5b79b 100644 --- a/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs +++ b/Test.AspNetCore.ServerTiming/Infrastructure/ServerTimingServerStartup.cs @@ -6,9 +6,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Lib.AspNetCore.ServerTiming; -using Lib.AspNetCore.ServerTiming.Abstractions; -using Lib.AspNetCore.ServerTiming.Abstractions.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Filters; +using Lib.AspNetCore.ServerTiming.Http.Headers; namespace Test.AspNetCore.ServerTiming.Infrastructure { diff --git a/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs b/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs index 636fd27..c530d06 100644 --- a/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs +++ b/Test.AspNetCore.ServerTiming/ServerTimingServerTests.cs @@ -5,8 +5,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; -using Lib.AspNetCore.ServerTiming.Abstractions.Filters; -using Lib.AspNetCore.ServerTiming.Abstractions.Http.Headers; +using Lib.AspNetCore.ServerTiming.Filters; +using Lib.AspNetCore.ServerTiming.Http.Headers; using Moq; using Xunit; using Test.AspNetCore.ServerTiming.Infrastructure; From 6a00dde5c15835b5e231c418665a48075265613e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C4=99czek?= Date: Sun, 29 May 2022 11:54:35 +0200 Subject: [PATCH 3/4] Adding Lib.AspNetCore.ServerTiming.Abstractions to documenation (#19) --- DocFx.AspNetCore.ServerTiming/docfx.json | 1 + 1 file changed, 1 insertion(+) diff --git a/DocFx.AspNetCore.ServerTiming/docfx.json b/DocFx.AspNetCore.ServerTiming/docfx.json index 792ce7a..e339301 100644 --- a/DocFx.AspNetCore.ServerTiming/docfx.json +++ b/DocFx.AspNetCore.ServerTiming/docfx.json @@ -4,6 +4,7 @@ "src": [ { "files": [ + "Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj", "Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj" ], "exclude": [ "**/bin/**", "**/obj/**" ], From 00e3a7272cee34c53d00ea1a363befdb10ae45ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C4=99czek?= Date: Sun, 29 May 2022 12:04:03 +0200 Subject: [PATCH 4/4] Adding Lib.AspNetCore.ServerTiming.Abstractions to CI/CD (#19) --- .../workflows/cd-aspnetcore-abstractions.yml | 43 +++++++++++++++++++ .../workflows/{cd.yml => cd-aspnetcore.yml} | 6 +-- 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/cd-aspnetcore-abstractions.yml rename .github/workflows/{cd.yml => cd-aspnetcore.yml} (88%) diff --git a/.github/workflows/cd-aspnetcore-abstractions.yml b/.github/workflows/cd-aspnetcore-abstractions.yml new file mode 100644 index 0000000..323c00d --- /dev/null +++ b/.github/workflows/cd-aspnetcore-abstractions.yml @@ -0,0 +1,43 @@ +name: Lib.AspNetCore.ServerTiming.Abstractions - CD +on: + push: + tags: + - "aspnetcore-abstractions-v[0-9]+.[0-9]+.[0-9]+" +jobs: + deployment: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Extract VERSION + run: echo "VERSION=${GITHUB_REF/refs\/tags\/aspnetcore-abstractions-v/}" >> $GITHUB_ENV + shell: bash + - name: Setup .NET Core 2.1 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '2.1.x' + - name: Setup .NET Core 3.1 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '3.1.x' + - name: Setup .NET 5.0 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.x' + - name: Setup .NET 6.0 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0.x' + - name: Restore + run: dotnet restore + - name: Build + run: dotnet build --configuration Release --no-restore + - name: Test + run: dotnet test --configuration Release --no-build + - name: Pack + run: dotnet pack --configuration Release --no-build + - name: NuGet Push Lib.AspNetCore.ServerTiming.Abstractions + run: dotnet nuget push Lib.AspNetCore.ServerTiming.Abstractions/bin/Release/Lib.AspNetCore.ServerTiming.Abstractions.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY} + shell: bash + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd-aspnetcore.yml similarity index 88% rename from .github/workflows/cd.yml rename to .github/workflows/cd-aspnetcore.yml index 841e6ed..8c71912 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd-aspnetcore.yml @@ -1,8 +1,8 @@ -name: CD +name: Lib.AspNetCore.ServerTiming - CD on: push: tags: - - "v[0-9]+.[0-9]+.[0-9]+" + - "aspnetcore-v[0-9]+.[0-9]+.[0-9]+" jobs: deployment: runs-on: windows-latest @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Extract VERSION - run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + run: echo "VERSION=${GITHUB_REF/refs\/tags\/aspnetcore-v/}" >> $GITHUB_ENV shell: bash - name: Setup .NET Core 2.1 SDK uses: actions/setup-dotnet@v1