From d6d08993d667c69a2b2b00e30d1d26bd7f6e8556 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Thu, 11 Apr 2024 15:54:51 +0100 Subject: [PATCH 1/3] update packages and csharpier --- .config/dotnet-tools.json | 2 +- .github/workflows/dotnetcore.yml | 2 +- Directory.Packages.props | 8 +- src/Conduit/packages.lock.json | 74 ++++++++--------- .../packages.lock.json | 82 +++++++++---------- 5 files changed, 84 insertions(+), 84 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index a4713c52..a13daa35 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "csharpier": { - "version": "0.27.3", + "version": "0.28.0", "commands": [ "dotnet-csharpier" ] diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 56250d8e..94e09bcd 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -11,5 +11,5 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.201 + dotnet-version: 8.0.204 - run: dotnet run --project build/build.csproj diff --git a/Directory.Packages.props b/Directory.Packages.props index e8ab07ba..21d8a25b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,10 +3,10 @@ - - - - + + + + diff --git a/src/Conduit/packages.lock.json b/src/Conduit/packages.lock.json index 8e1c9d27..32cb448e 100644 --- a/src/Conduit/packages.lock.json +++ b/src/Conduit/packages.lock.json @@ -33,40 +33,40 @@ }, "Microsoft.AspNetCore.Authentication.JwtBearer": { "type": "Direct", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "7qJkk5k5jabATZZrMIQgpUB9yjDNAAApSqw+8d0FEyK1AJ4j+wv1qOMl2byUr837xbK+MjehtPnQ32yZ5Gtzlw==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "tHnHRBgQyiVNZJ8PksNinLdGOsE8+tFFv3E9QEtmwO+iyTHRvg4bJ4X0XZG1u9KxXMTJuAdeIWKWYr2rTLEHqQ==", "dependencies": { "Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.1.2" } }, "Microsoft.EntityFrameworkCore.InMemory": { "type": "Direct", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "vPpioRk+6BwQf/apqBQQ2gLL/6FMOj25L6d2lli08FmRh2W9QrnShyKhzsDAydWcH6Po69gQXgHbBQFAafmo3A==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "3fj0V/NKG66LLwUtoDofSyogku1ueF78uUIdGPEJJhS3MW7w3xLsizMaDYX+ooR74IM96YJI5N3tyOU5FZiiwg==", "dependencies": { - "Microsoft.EntityFrameworkCore": "8.0.2" + "Microsoft.EntityFrameworkCore": "8.0.4" } }, "Microsoft.EntityFrameworkCore.Sqlite": { "type": "Direct", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "tnpTylrGLYUKZ+Jw8Y5PmROYhIvqA51EqYRdHgUDCFsVbs3AKsw3SY1reaZk/tBfWHtC7nWR+IN2MwYrdtkgTQ==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "7y0Z7y1SwBNswxlNY9zduqk5I0+pWWzYIFhtJtvo55RcfomIQDmOODG/s5+iOxv0JoVHjFOgAc8AMI3DwAaoig==", "dependencies": { - "Microsoft.EntityFrameworkCore.Sqlite.Core": "8.0.2", + "Microsoft.EntityFrameworkCore.Sqlite.Core": "8.0.4", "SQLitePCLRaw.bundle_e_sqlite3": "2.1.6" } }, "Microsoft.EntityFrameworkCore.SqlServer": { "type": "Direct", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "tAS5mYr/mwCXZVC5dyJlzdKHK0MLU0TAxNcc30xi7XLju8DE3S0Y206Yfi/MyuzLjulQRq9n2vjieeCxOnQfkg==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "/IlHNxzZGqiuVi+FPtjFZgAOfY989fTPtxw8zhmlFwv5M2WJzBSMlAP4jNVQX/k7/qu+y1YvddPxg4O5QdeRXw==", "dependencies": { - "Microsoft.Data.SqlClient": "5.1.4", - "Microsoft.EntityFrameworkCore.Relational": "8.0.2" + "Microsoft.Data.SqlClient": "5.1.5", + "Microsoft.EntityFrameworkCore.Relational": "8.0.4" } }, "Serilog": { @@ -160,14 +160,14 @@ }, "Microsoft.Data.SqlClient": { "type": "Transitive", - "resolved": "5.1.4", - "contentHash": "RSGSodusrPSVPKBLETRTH51G0yUQS28rD1hi2svTKS1GOsvUWxUpE8hgnKnUFC9RNjzfQmfUp+T0lJHFtlT3HQ==", + "resolved": "5.1.5", + "contentHash": "6kvhQjY5uBCdBccezFD2smfnpQjQ33cZtUZVrNvxlwoBu6uopM5INH6uSgLI7JRLtlQ3bMPwnhMq4kchsXeZ5w==", "dependencies": { "Azure.Identity": "1.10.3", "Microsoft.Data.SqlClient.SNI.runtime": "5.1.1", "Microsoft.Identity.Client": "4.56.0", - "Microsoft.IdentityModel.JsonWebTokens": "6.24.0", - "Microsoft.IdentityModel.Protocols.OpenIdConnect": "6.24.0", + "Microsoft.IdentityModel.JsonWebTokens": "6.35.0", + "Microsoft.IdentityModel.Protocols.OpenIdConnect": "6.35.0", "Microsoft.SqlServer.Server": "1.0.0", "System.Configuration.ConfigurationManager": "6.0.1", "System.Diagnostics.DiagnosticSource": "6.0.1", @@ -185,49 +185,49 @@ }, "Microsoft.Data.Sqlite.Core": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "C7VelOBNUrVlatmOoJ9P+vc/gegduv7d2uB5oy7bFxfgZBfaGr+eREW+QuppXwi3MHp0WBxxWjqkK5gD7ymDQA==", + "resolved": "8.0.4", + "contentHash": "x5FE5m1h31UIDEk0j3r38HtYvsa0fxd5jXzvE/SARI7LecXt/jm4z2SUl6TEoJGQOo9Ow2wg3a0MU2E1TVVAdA==", "dependencies": { "SQLitePCLRaw.core": "2.1.6" } }, "Microsoft.EntityFrameworkCore": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "6QlvBx4rdawW3AkkCsGVV+8qRLk34aknV5JD40s1hbVR18vKmT2KDl2DW83nHcPX7f4oebQ3BD1UMNCI/gkE0g==", + "resolved": "8.0.4", + "contentHash": "/kyu9pXuxQvhg8RO/oN5Q5Og7cDIVvZtrt1z48rX7Yido+zEGkUkp3/Bjd9u45N2uuPPF8mn2pKDlAewCvv3/Q==", "dependencies": { - "Microsoft.EntityFrameworkCore.Abstractions": "8.0.2", - "Microsoft.EntityFrameworkCore.Analyzers": "8.0.2", + "Microsoft.EntityFrameworkCore.Abstractions": "8.0.4", + "Microsoft.EntityFrameworkCore.Analyzers": "8.0.4", "Microsoft.Extensions.Caching.Memory": "8.0.0", "Microsoft.Extensions.Logging": "8.0.0" } }, "Microsoft.EntityFrameworkCore.Abstractions": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "DjDKp++BTKFZmX+xLTow7grQTY+pImKfhGW68Zf8myiL3zyJ3b8RZbnLsWGNCqKQIF6hJIz/zA/zmERobFwV0A==" + "resolved": "8.0.4", + "contentHash": "S50pjtPNOvRktacaO6UAhvGCPMT56wxqEq8fQfcjaSUySPGba6mKWo6ackw6DdeAR1cA6U+U0uj27warA2KtJA==" }, "Microsoft.EntityFrameworkCore.Analyzers": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "LI7awhc0fiAKvcUemsqxXUWqzAH9ywTSyM1rpC1un4p5SE1bhr5nRLvyRVbKRzKakmnNNY3to8NPDnoySEkxVw==" + "resolved": "8.0.4", + "contentHash": "P8hfMZECdbgle4Us8HGRUKAjqVwgbtr5JqtCxqEoiVORrNQAmcpu3g1NKwTAoUsO9Z0QRgExtYoAmdggR/DkMQ==" }, "Microsoft.EntityFrameworkCore.Relational": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "NoGfcq2OPw0z8XAPf74YFwGlTKjedWdsIEJqq4SvKcPjcu+B+/XDDNrDRxTvILfz4Ug8POSF49s1jz1JvUqTAg==", + "resolved": "8.0.4", + "contentHash": "aWLT6e9a8oMzXgF0YQpYYa3mDeU+yb2UQSQ+RrIgyGgSpzPfSKgpA7v2kOVDuZr2AQ6NNAlWPaBG7wZuKQI96w==", "dependencies": { - "Microsoft.EntityFrameworkCore": "8.0.2", + "Microsoft.EntityFrameworkCore": "8.0.4", "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" } }, "Microsoft.EntityFrameworkCore.Sqlite.Core": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "cUOohC2oMaHG8rAvF1bvg5U5Hmeio8nTvCJghyPSnnKtWPu6U/Ozw4jcdJn1UjeYe7X0udP8ax/IB6wb9BOLWw==", + "resolved": "8.0.4", + "contentHash": "4XCrL6vdFQSXZY6b89cXvjYNvTKP5azMvgacI2XE+B0D7Lg3zYSjmfLZYWfR3j3izx5X8xCTkHZnaRHHfHcv+w==", "dependencies": { - "Microsoft.Data.Sqlite.Core": "8.0.2", - "Microsoft.EntityFrameworkCore.Relational": "8.0.2", + "Microsoft.Data.Sqlite.Core": "8.0.4", + "Microsoft.EntityFrameworkCore.Relational": "8.0.4", "Microsoft.Extensions.DependencyModel": "8.0.0" } }, diff --git a/tests/Conduit.IntegrationTests/packages.lock.json b/tests/Conduit.IntegrationTests/packages.lock.json index 6a34bce7..45f1ff50 100644 --- a/tests/Conduit.IntegrationTests/packages.lock.json +++ b/tests/Conduit.IntegrationTests/packages.lock.json @@ -88,14 +88,14 @@ }, "Microsoft.Data.SqlClient": { "type": "Transitive", - "resolved": "5.1.4", - "contentHash": "RSGSodusrPSVPKBLETRTH51G0yUQS28rD1hi2svTKS1GOsvUWxUpE8hgnKnUFC9RNjzfQmfUp+T0lJHFtlT3HQ==", + "resolved": "5.1.5", + "contentHash": "6kvhQjY5uBCdBccezFD2smfnpQjQ33cZtUZVrNvxlwoBu6uopM5INH6uSgLI7JRLtlQ3bMPwnhMq4kchsXeZ5w==", "dependencies": { "Azure.Identity": "1.10.3", "Microsoft.Data.SqlClient.SNI.runtime": "5.1.1", "Microsoft.Identity.Client": "4.56.0", - "Microsoft.IdentityModel.JsonWebTokens": "6.24.0", - "Microsoft.IdentityModel.Protocols.OpenIdConnect": "6.24.0", + "Microsoft.IdentityModel.JsonWebTokens": "6.35.0", + "Microsoft.IdentityModel.Protocols.OpenIdConnect": "6.35.0", "Microsoft.SqlServer.Server": "1.0.0", "System.Configuration.ConfigurationManager": "6.0.1", "System.Diagnostics.DiagnosticSource": "6.0.1", @@ -113,49 +113,49 @@ }, "Microsoft.Data.Sqlite.Core": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "C7VelOBNUrVlatmOoJ9P+vc/gegduv7d2uB5oy7bFxfgZBfaGr+eREW+QuppXwi3MHp0WBxxWjqkK5gD7ymDQA==", + "resolved": "8.0.4", + "contentHash": "x5FE5m1h31UIDEk0j3r38HtYvsa0fxd5jXzvE/SARI7LecXt/jm4z2SUl6TEoJGQOo9Ow2wg3a0MU2E1TVVAdA==", "dependencies": { "SQLitePCLRaw.core": "2.1.6" } }, "Microsoft.EntityFrameworkCore": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "6QlvBx4rdawW3AkkCsGVV+8qRLk34aknV5JD40s1hbVR18vKmT2KDl2DW83nHcPX7f4oebQ3BD1UMNCI/gkE0g==", + "resolved": "8.0.4", + "contentHash": "/kyu9pXuxQvhg8RO/oN5Q5Og7cDIVvZtrt1z48rX7Yido+zEGkUkp3/Bjd9u45N2uuPPF8mn2pKDlAewCvv3/Q==", "dependencies": { - "Microsoft.EntityFrameworkCore.Abstractions": "8.0.2", - "Microsoft.EntityFrameworkCore.Analyzers": "8.0.2", + "Microsoft.EntityFrameworkCore.Abstractions": "8.0.4", + "Microsoft.EntityFrameworkCore.Analyzers": "8.0.4", "Microsoft.Extensions.Caching.Memory": "8.0.0", "Microsoft.Extensions.Logging": "8.0.0" } }, "Microsoft.EntityFrameworkCore.Abstractions": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "DjDKp++BTKFZmX+xLTow7grQTY+pImKfhGW68Zf8myiL3zyJ3b8RZbnLsWGNCqKQIF6hJIz/zA/zmERobFwV0A==" + "resolved": "8.0.4", + "contentHash": "S50pjtPNOvRktacaO6UAhvGCPMT56wxqEq8fQfcjaSUySPGba6mKWo6ackw6DdeAR1cA6U+U0uj27warA2KtJA==" }, "Microsoft.EntityFrameworkCore.Analyzers": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "LI7awhc0fiAKvcUemsqxXUWqzAH9ywTSyM1rpC1un4p5SE1bhr5nRLvyRVbKRzKakmnNNY3to8NPDnoySEkxVw==" + "resolved": "8.0.4", + "contentHash": "P8hfMZECdbgle4Us8HGRUKAjqVwgbtr5JqtCxqEoiVORrNQAmcpu3g1NKwTAoUsO9Z0QRgExtYoAmdggR/DkMQ==" }, "Microsoft.EntityFrameworkCore.Relational": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "NoGfcq2OPw0z8XAPf74YFwGlTKjedWdsIEJqq4SvKcPjcu+B+/XDDNrDRxTvILfz4Ug8POSF49s1jz1JvUqTAg==", + "resolved": "8.0.4", + "contentHash": "aWLT6e9a8oMzXgF0YQpYYa3mDeU+yb2UQSQ+RrIgyGgSpzPfSKgpA7v2kOVDuZr2AQ6NNAlWPaBG7wZuKQI96w==", "dependencies": { - "Microsoft.EntityFrameworkCore": "8.0.2", + "Microsoft.EntityFrameworkCore": "8.0.4", "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" } }, "Microsoft.EntityFrameworkCore.Sqlite.Core": { "type": "Transitive", - "resolved": "8.0.2", - "contentHash": "cUOohC2oMaHG8rAvF1bvg5U5Hmeio8nTvCJghyPSnnKtWPu6U/Ozw4jcdJn1UjeYe7X0udP8ax/IB6wb9BOLWw==", + "resolved": "8.0.4", + "contentHash": "4XCrL6vdFQSXZY6b89cXvjYNvTKP5azMvgacI2XE+B0D7Lg3zYSjmfLZYWfR3j3izx5X8xCTkHZnaRHHfHcv+w==", "dependencies": { - "Microsoft.Data.Sqlite.Core": "8.0.2", - "Microsoft.EntityFrameworkCore.Relational": "8.0.2", + "Microsoft.Data.Sqlite.Core": "8.0.4", + "Microsoft.EntityFrameworkCore.Relational": "8.0.4", "Microsoft.Extensions.DependencyModel": "8.0.0" } }, @@ -596,10 +596,10 @@ "AutoMapper": "[13.0.1, )", "FluentValidation.AspNetCore": "[11.3.0, )", "MediatR": "[12.2.0, )", - "Microsoft.AspNetCore.Authentication.JwtBearer": "[8.0.2, )", - "Microsoft.EntityFrameworkCore.InMemory": "[8.0.2, )", - "Microsoft.EntityFrameworkCore.SqlServer": "[8.0.2, )", - "Microsoft.EntityFrameworkCore.Sqlite": "[8.0.2, )", + "Microsoft.AspNetCore.Authentication.JwtBearer": "[8.0.4, )", + "Microsoft.EntityFrameworkCore.InMemory": "[8.0.4, )", + "Microsoft.EntityFrameworkCore.SqlServer": "[8.0.4, )", + "Microsoft.EntityFrameworkCore.Sqlite": "[8.0.4, )", "Serilog": "[3.1.1, )", "Serilog.Extensions.Logging": "[8.0.0, )", "Serilog.Sinks.Console": "[5.0.1, )", @@ -637,40 +637,40 @@ }, "Microsoft.AspNetCore.Authentication.JwtBearer": { "type": "CentralTransitive", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "7qJkk5k5jabATZZrMIQgpUB9yjDNAAApSqw+8d0FEyK1AJ4j+wv1qOMl2byUr837xbK+MjehtPnQ32yZ5Gtzlw==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "tHnHRBgQyiVNZJ8PksNinLdGOsE8+tFFv3E9QEtmwO+iyTHRvg4bJ4X0XZG1u9KxXMTJuAdeIWKWYr2rTLEHqQ==", "dependencies": { "Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.1.2" } }, "Microsoft.EntityFrameworkCore.InMemory": { "type": "CentralTransitive", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "vPpioRk+6BwQf/apqBQQ2gLL/6FMOj25L6d2lli08FmRh2W9QrnShyKhzsDAydWcH6Po69gQXgHbBQFAafmo3A==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "3fj0V/NKG66LLwUtoDofSyogku1ueF78uUIdGPEJJhS3MW7w3xLsizMaDYX+ooR74IM96YJI5N3tyOU5FZiiwg==", "dependencies": { - "Microsoft.EntityFrameworkCore": "8.0.2" + "Microsoft.EntityFrameworkCore": "8.0.4" } }, "Microsoft.EntityFrameworkCore.Sqlite": { "type": "CentralTransitive", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "tnpTylrGLYUKZ+Jw8Y5PmROYhIvqA51EqYRdHgUDCFsVbs3AKsw3SY1reaZk/tBfWHtC7nWR+IN2MwYrdtkgTQ==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "7y0Z7y1SwBNswxlNY9zduqk5I0+pWWzYIFhtJtvo55RcfomIQDmOODG/s5+iOxv0JoVHjFOgAc8AMI3DwAaoig==", "dependencies": { - "Microsoft.EntityFrameworkCore.Sqlite.Core": "8.0.2", + "Microsoft.EntityFrameworkCore.Sqlite.Core": "8.0.4", "SQLitePCLRaw.bundle_e_sqlite3": "2.1.6" } }, "Microsoft.EntityFrameworkCore.SqlServer": { "type": "CentralTransitive", - "requested": "[8.0.2, )", - "resolved": "8.0.2", - "contentHash": "tAS5mYr/mwCXZVC5dyJlzdKHK0MLU0TAxNcc30xi7XLju8DE3S0Y206Yfi/MyuzLjulQRq9n2vjieeCxOnQfkg==", + "requested": "[8.0.4, )", + "resolved": "8.0.4", + "contentHash": "/IlHNxzZGqiuVi+FPtjFZgAOfY989fTPtxw8zhmlFwv5M2WJzBSMlAP4jNVQX/k7/qu+y1YvddPxg4O5QdeRXw==", "dependencies": { - "Microsoft.Data.SqlClient": "5.1.4", - "Microsoft.EntityFrameworkCore.Relational": "8.0.2" + "Microsoft.Data.SqlClient": "5.1.5", + "Microsoft.EntityFrameworkCore.Relational": "8.0.4" } }, "Serilog": { From f6618556575c37a8563516f92dfb4909912b0594 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Thu, 11 Apr 2024 16:09:18 +0100 Subject: [PATCH 2/3] clean up and get mediar tests working --- src/Conduit/Domain/Person.cs | 1 - src/Conduit/Features/Articles/Create.cs | 6 +- src/Conduit/Features/Articles/Edit.cs | 4 +- src/Conduit/Features/Articles/List.cs | 3 +- src/Conduit/Features/Comments/Create.cs | 2 +- src/Conduit/Features/Favorites/Add.cs | 2 +- src/Conduit/Features/Followers/Add.cs | 2 +- src/Conduit/Features/Tags/List.cs | 2 +- .../Security/JwtIssuerOptions.cs | 1 - src/Conduit/Program.cs | 37 +--- ...Errors.ErrorHandlingMiddleware.Designer.cs | 72 ------- ...ucture.Errors.ErrorHandlingMiddleware.resx | 123 ------------ ...tupExtensions.cs => ServicesExtensions.cs} | 36 +++- src/Conduit/Startup.cs | 178 ------------------ .../Features/Articles/CreateTests.cs | 2 +- .../Features/Articles/DeleteTests.cs | 6 +- .../Features/Articles/EditTests.cs | 2 +- .../Features/Comments/CommentHelpers.cs | 1 - .../Features/Users/LoginTests.cs | 2 +- .../Conduit.IntegrationTests/SliceFixture.cs | 10 +- 20 files changed, 55 insertions(+), 437 deletions(-) delete mode 100644 src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.Designer.cs delete mode 100644 src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.resx rename src/Conduit/{StartupExtensions.cs => ServicesExtensions.cs} (68%) delete mode 100644 src/Conduit/Startup.cs diff --git a/src/Conduit/Domain/Person.cs b/src/Conduit/Domain/Person.cs index 7e9a468b..0f6dc3bd 100644 --- a/src/Conduit/Domain/Person.cs +++ b/src/Conduit/Domain/Person.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Text.Json.Serialization; diff --git a/src/Conduit/Features/Articles/Create.cs b/src/Conduit/Features/Articles/Create.cs index 5d66d49b..2ef11bfe 100644 --- a/src/Conduit/Features/Articles/Create.cs +++ b/src/Conduit/Features/Articles/Create.cs @@ -60,7 +60,7 @@ CancellationToken cancellationToken var t = await context.Tags.FindAsync(tag); if (t == null) { - t = new Tag() { TagId = tag }; + t = new Tag { TagId = tag }; await context.Tags.AddAsync(t, cancellationToken); //save immediately for reuse await context.SaveChangesAsync(cancellationToken); @@ -68,7 +68,7 @@ CancellationToken cancellationToken tags.Add(t); } - var article = new Article() + var article = new Article { Author = author, Body = message.Article.Body, @@ -81,7 +81,7 @@ CancellationToken cancellationToken await context.Articles.AddAsync(article, cancellationToken); await context.ArticleTags.AddRangeAsync( - tags.Select(x => new ArticleTag() { Article = article, Tag = x }), + tags.Select(x => new ArticleTag { Article = article, Tag = x }), cancellationToken ); diff --git a/src/Conduit/Features/Articles/Edit.cs b/src/Conduit/Features/Articles/Edit.cs index 25b16786..81527e9b 100644 --- a/src/Conduit/Features/Articles/Edit.cs +++ b/src/Conduit/Features/Articles/Edit.cs @@ -109,11 +109,11 @@ IEnumerable articleTagList var at = article.ArticleTags?.FirstOrDefault(t => t.TagId == tag); if (at == null) { - at = new ArticleTag() + at = new ArticleTag { Article = article, ArticleId = article.ArticleId, - Tag = new Tag() { TagId = tag }, + Tag = new Tag { TagId = tag }, TagId = tag }; articleTagsToCreate.Add(at); diff --git a/src/Conduit/Features/Articles/List.cs b/src/Conduit/Features/Articles/List.cs index d0ed2e8b..d9ca5790 100644 --- a/src/Conduit/Features/Articles/List.cs +++ b/src/Conduit/Features/Articles/List.cs @@ -2,7 +2,6 @@ using System.Net; using System.Threading; using System.Threading.Tasks; -using Conduit.Domain; using Conduit.Infrastructure; using Conduit.Infrastructure.Errors; using MediatR; @@ -111,7 +110,7 @@ CancellationToken cancellationToken .AsNoTracking() .ToListAsync(cancellationToken); - return new ArticlesEnvelope() + return new ArticlesEnvelope { Articles = articles, ArticlesCount = queryable.Count() diff --git a/src/Conduit/Features/Comments/Create.cs b/src/Conduit/Features/Comments/Create.cs index b32d90bd..77463cf0 100644 --- a/src/Conduit/Features/Comments/Create.cs +++ b/src/Conduit/Features/Comments/Create.cs @@ -49,7 +49,7 @@ CancellationToken cancellationToken cancellationToken ); - var comment = new Comment() + var comment = new Comment { Author = author, Body = message.Model.Comment.Body ?? string.Empty, diff --git a/src/Conduit/Features/Favorites/Add.cs b/src/Conduit/Features/Favorites/Add.cs index e8ddae04..fa5d0fbf 100644 --- a/src/Conduit/Features/Favorites/Add.cs +++ b/src/Conduit/Features/Favorites/Add.cs @@ -61,7 +61,7 @@ CancellationToken cancellationToken if (favorite == null) { - favorite = new ArticleFavorite() + favorite = new ArticleFavorite { Article = article, ArticleId = article.ArticleId, diff --git a/src/Conduit/Features/Followers/Add.cs b/src/Conduit/Features/Followers/Add.cs index cb07dfa8..4efae6de 100644 --- a/src/Conduit/Features/Followers/Add.cs +++ b/src/Conduit/Features/Followers/Add.cs @@ -64,7 +64,7 @@ CancellationToken cancellationToken if (followedPeople == null) { - followedPeople = new FollowedPeople() + followedPeople = new FollowedPeople { Observer = observer, ObserverId = observer.PersonId, diff --git a/src/Conduit/Features/Tags/List.cs b/src/Conduit/Features/Tags/List.cs index cd4d6be3..19ad6237 100644 --- a/src/Conduit/Features/Tags/List.cs +++ b/src/Conduit/Features/Tags/List.cs @@ -20,7 +20,7 @@ public async Task Handle(Query message, CancellationToken cancella .Tags.OrderBy(x => x.TagId) .AsNoTracking() .ToListAsync(cancellationToken); - return new TagsEnvelope() + return new TagsEnvelope { Tags = tags?.Select(x => x.TagId ?? string.Empty).ToList() ?? new List() }; diff --git a/src/Conduit/Infrastructure/Security/JwtIssuerOptions.cs b/src/Conduit/Infrastructure/Security/JwtIssuerOptions.cs index 0010c724..9a99150f 100644 --- a/src/Conduit/Infrastructure/Security/JwtIssuerOptions.cs +++ b/src/Conduit/Infrastructure/Security/JwtIssuerOptions.cs @@ -1,5 +1,4 @@ using System; -using System.Threading.Tasks; using Microsoft.IdentityModel.Tokens; namespace Conduit.Infrastructure.Security; diff --git a/src/Conduit/Program.cs b/src/Conduit/Program.cs index 878242da..6992db18 100644 --- a/src/Conduit/Program.cs +++ b/src/Conduit/Program.cs @@ -1,18 +1,10 @@ using System; using System.Collections.Generic; -using System.Reflection; using Conduit; -using Conduit.Features.Profiles; using Conduit.Infrastructure; using Conduit.Infrastructure.Errors; -using Conduit.Infrastructure.Security; -using FluentValidation; -using FluentValidation.AspNetCore; -using MediatR; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; @@ -25,15 +17,6 @@ var builder = WebApplication.CreateBuilder(args); -builder.Services.AddMediatR(cfg => - cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()) -); -builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationPipelineBehavior<,>)); -builder.Services.AddScoped( - typeof(IPipelineBehavior<,>), - typeof(DBContextTransactionPipelineBehavior<,>) -); - // take the connection string from the environment variable or use hard-coded database name var connectionString = defaultDatabaseConnectionSrting; @@ -81,7 +64,7 @@ x.SupportNonNullableReferenceTypes(); x.AddSecurityRequirement( - new OpenApiSecurityRequirement() + new OpenApiSecurityRequirement { { new OpenApiSecurityScheme @@ -98,8 +81,8 @@ ); x.SwaggerDoc("v1", new OpenApiInfo { Title = "RealWorld API", Version = "v1" }); x.CustomSchemaIds(y => y.FullName); - x.DocInclusionPredicate((version, apiDescription) => true); - x.TagActionsBy(y => new List() + x.DocInclusionPredicate((_, _) => true); + x.TagActionsBy(y => new List { y.GroupName ?? throw new InvalidOperationException() }); @@ -123,17 +106,7 @@ .WhenWritingNull ); -builder.Services.AddFluentValidationAutoValidation(); -builder.Services.AddFluentValidationClientsideAdapters(); -builder.Services.AddValidatorsFromAssemblyContaining(); - -builder.Services.AddAutoMapper(typeof(Program)); - -builder.Services.AddScoped(); -builder.Services.AddScoped(); -builder.Services.AddScoped(); -builder.Services.AddScoped(); -builder.Services.AddSingleton(); +builder.Services.AddConduit(); builder.Services.AddJwt(); @@ -143,7 +116,7 @@ app.UseMiddleware(); -app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); +app.UseCors(x => x.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); app.UseAuthentication(); app.UseMvc(); diff --git a/src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.Designer.cs b/src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.Designer.cs deleted file mode 100644 index 6a3bfc46..00000000 --- a/src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Conduit.Resources { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Infrastructure_Errors_ErrorHandlingMiddleware { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Infrastructure_Errors_ErrorHandlingMiddleware() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Conduit.Resources.Infrastructure.Errors.ErrorHandlingMiddleware", typeof(Infrastructure_Errors_ErrorHandlingMiddleware).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to An internal error has occurred.. - /// - internal static string InternalServerError { - get { - return ResourceManager.GetString("InternalServerError", resourceCulture); - } - } - } -} diff --git a/src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.resx b/src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.resx deleted file mode 100644 index de15cca8..00000000 --- a/src/Conduit/Resources/Infrastructure.Errors.ErrorHandlingMiddleware.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - An internal error has occurred. - - \ No newline at end of file diff --git a/src/Conduit/StartupExtensions.cs b/src/Conduit/ServicesExtensions.cs similarity index 68% rename from src/Conduit/StartupExtensions.cs rename to src/Conduit/ServicesExtensions.cs index c74a391b..ae703441 100644 --- a/src/Conduit/StartupExtensions.cs +++ b/src/Conduit/ServicesExtensions.cs @@ -1,8 +1,14 @@ using System; -using System.Text; +using System.Reflection; using System.Threading.Tasks; +using Conduit.Features.Profiles; +using Conduit.Infrastructure; using Conduit.Infrastructure.Security; +using FluentValidation; +using FluentValidation.AspNetCore; +using MediatR; using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Tokens; @@ -11,14 +17,38 @@ namespace Conduit; -public static class StartupExtensions +public static class ServicesExtensions { + public static void AddConduit(this IServiceCollection services) + { + services.AddMediatR(cfg => + cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()) + ); + services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationPipelineBehavior<,>)); + services.AddScoped( + typeof(IPipelineBehavior<,>), + typeof(DBContextTransactionPipelineBehavior<,>) + ); + + services.AddFluentValidationAutoValidation(); + services.AddFluentValidationClientsideAdapters(); + services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly()); + + services.AddAutoMapper(typeof(Program)); + + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddSingleton(); + } + public static void AddJwt(this IServiceCollection services) { services.AddOptions(); var signingKey = new SymmetricSecurityKey( - Encoding.ASCII.GetBytes("somethinglongerforthisdumbalgorithmisrequired") + "somethinglongerforthisdumbalgorithmisrequired"u8.ToArray() ); var signingCredentials = new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256); var issuer = "issuer"; diff --git a/src/Conduit/Startup.cs b/src/Conduit/Startup.cs deleted file mode 100644 index 24ce0f4f..00000000 --- a/src/Conduit/Startup.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using AutoMapper; -using Conduit.Features.Profiles; -using Conduit.Infrastructure; -using Conduit.Infrastructure.Errors; -using Conduit.Infrastructure.Security; -using FluentValidation; -using FluentValidation.AspNetCore; -using MediatR; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Microsoft.OpenApi.Models; - -namespace Conduit; - -public class Startup -{ - public const string DEFAULT_DATABASE_CONNECTIONSTRING = "Filename=realworld.db"; - public const string DEFAULT_DATABASE_PROVIDER = "sqlite"; - - //private readonly IConfiguration _config; - - //public Startup(IConfiguration config) => _config = config; - - // This method gets called by the runtime. Use this method to add services to the container. - // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 - public void ConfigureServices(IServiceCollection services) - { - services.AddMediatR(cfg => - cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()) - ); - services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationPipelineBehavior<,>)); - services.AddScoped( - typeof(IPipelineBehavior<,>), - typeof(DBContextTransactionPipelineBehavior<,>) - ); - - // take the connection string from the environment variable or use hard-coded database name - var connectionString = DEFAULT_DATABASE_CONNECTIONSTRING; - // take the database provider from the environment variable or use hard-coded database provider - var databaseProvider = DEFAULT_DATABASE_PROVIDER; - //if (string.IsNullOrWhiteSpace(databaseProvider)) - //{ - // databaseProvider = DEFAULT_DATABASE_PROVIDER; - //} - - services.AddDbContext(options => - { - if ( - databaseProvider - .ToLowerInvariant() - .Trim() - .Equals("sqlite", StringComparison.Ordinal) - ) - { - options.UseSqlite(connectionString); - } - else if ( - databaseProvider - .ToLowerInvariant() - .Trim() - .Equals("sqlserver", StringComparison.Ordinal) - ) - { - // only works in windows container - options.UseSqlServer(connectionString); - } - else - { - throw new InvalidOperationException( - "Database provider unknown. Please check configuration" - ); - } - }); - - services.AddLocalization(x => x.ResourcesPath = "Resources"); - - // Inject an implementation of ISwaggerProvider with defaulted settings applied - services.AddSwaggerGen(x => - { - x.AddSecurityDefinition( - "Bearer", - new OpenApiSecurityScheme - { - In = ParameterLocation.Header, - Description = "Please insert JWT with Bearer into field", - Name = "Authorization", - Type = SecuritySchemeType.ApiKey, - BearerFormat = "JWT" - } - ); - - x.SupportNonNullableReferenceTypes(); - - x.AddSecurityRequirement( - new OpenApiSecurityRequirement() - { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference - { - Type = ReferenceType.SecurityScheme, - Id = "Bearer" - } - }, - Array.Empty() - } - } - ); - x.SwaggerDoc("v1", new OpenApiInfo { Title = "RealWorld API", Version = "v1" }); - x.CustomSchemaIds(y => y.FullName); - x.DocInclusionPredicate((version, apiDescription) => true); - x.TagActionsBy(y => new List() - { - y.GroupName ?? throw new InvalidOperationException() - }); - }); - - services.AddCors(); - services - .AddMvc(opt => - { - opt.Conventions.Add(new GroupByApiRootConvention()); - opt.Filters.Add(typeof(ValidatorActionFilter)); - opt.EnableEndpointRouting = false; - }) - .AddJsonOptions(opt => - opt.JsonSerializerOptions.DefaultIgnoreCondition = System - .Text - .Json - .Serialization - .JsonIgnoreCondition - .WhenWritingNull - ); - - services.AddFluentValidationAutoValidation(); - services.AddFluentValidationClientsideAdapters(); - services.AddValidatorsFromAssemblyContaining(); - - services.AddAutoMapper(GetType().Assembly); - - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddSingleton(); - - services.AddJwt(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) - { - loggerFactory.AddSerilogLogging(); - - app.UseMiddleware(); - - app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); - - app.UseAuthentication(); - app.UseMvc(); - - // Enable middleware to serve generated Swagger as a JSON endpoint - app.UseSwagger(c => c.RouteTemplate = "swagger/{documentName}/swagger.json"); - - // Enable middleware to serve swagger-ui assets(HTML, JS, CSS etc.) - app.UseSwaggerUI(x => x.SwaggerEndpoint("/swagger/v1/swagger.json", "RealWorld API V1")); - - app.ApplicationServices.GetRequiredService().Database.EnsureCreated(); - } -} diff --git a/tests/Conduit.IntegrationTests/Features/Articles/CreateTests.cs b/tests/Conduit.IntegrationTests/Features/Articles/CreateTests.cs index 9c8c175d..ff9c2495 100644 --- a/tests/Conduit.IntegrationTests/Features/Articles/CreateTests.cs +++ b/tests/Conduit.IntegrationTests/Features/Articles/CreateTests.cs @@ -11,7 +11,7 @@ public class CreateTests : SliceFixture public async Task Expect_Create_Article() { var command = new Create.Command( - new Create.ArticleData() + new Create.ArticleData { Title = "Test article dsergiu77", Description = "Description of the test article", diff --git a/tests/Conduit.IntegrationTests/Features/Articles/DeleteTests.cs b/tests/Conduit.IntegrationTests/Features/Articles/DeleteTests.cs index 97c6a5fc..dc7a4852 100644 --- a/tests/Conduit.IntegrationTests/Features/Articles/DeleteTests.cs +++ b/tests/Conduit.IntegrationTests/Features/Articles/DeleteTests.cs @@ -15,7 +15,7 @@ public class DeleteTests : SliceFixture public async Task Expect_Delete_Article() { var createCmd = new Create.Command( - new Create.ArticleData() + new Create.ArticleData { Title = "Test article dsergiu77", Description = "Description of the test article", @@ -44,7 +44,7 @@ public async Task Expect_Delete_Article() public async Task Expect_Delete_Article_With_Tags() { var createCmd = new Create.Command( - new Create.ArticleData() + new Create.ArticleData { Title = "Test article dsergiu77", Description = "Description of the test article", @@ -77,7 +77,7 @@ public async Task Expect_Delete_Article_With_Tags() public async Task Expect_Delete_Article_With_Comments() { var createArticleCmd = new Create.Command( - new Create.ArticleData() + new Create.ArticleData { Title = "Test article dsergiu77", Description = "Description of the test article", diff --git a/tests/Conduit.IntegrationTests/Features/Articles/EditTests.cs b/tests/Conduit.IntegrationTests/Features/Articles/EditTests.cs index 1ac62b68..92676e36 100644 --- a/tests/Conduit.IntegrationTests/Features/Articles/EditTests.cs +++ b/tests/Conduit.IntegrationTests/Features/Articles/EditTests.cs @@ -12,7 +12,7 @@ public class EditTests : SliceFixture public async Task Expect_Edit_Article() { var createCommand = new Create.Command( - new Create.ArticleData() + new Create.ArticleData { Title = "Test article dsergiu77", Description = "Description of the test article", diff --git a/tests/Conduit.IntegrationTests/Features/Comments/CommentHelpers.cs b/tests/Conduit.IntegrationTests/Features/Comments/CommentHelpers.cs index 5364a88f..16d8b2e5 100644 --- a/tests/Conduit.IntegrationTests/Features/Comments/CommentHelpers.cs +++ b/tests/Conduit.IntegrationTests/Features/Comments/CommentHelpers.cs @@ -1,7 +1,6 @@ using System.Linq; using System.Net; using System.Threading.Tasks; -using Conduit.Domain; using Conduit.Features.Comments; using Conduit.Infrastructure.Errors; using Conduit.IntegrationTests.Features.Users; diff --git a/tests/Conduit.IntegrationTests/Features/Users/LoginTests.cs b/tests/Conduit.IntegrationTests/Features/Users/LoginTests.cs index d0925448..3251b74c 100644 --- a/tests/Conduit.IntegrationTests/Features/Users/LoginTests.cs +++ b/tests/Conduit.IntegrationTests/Features/Users/LoginTests.cs @@ -23,7 +23,7 @@ public async Task Expect_Login() await InsertAsync(person); var command = new Login.Command( - new Login.UserData() { Email = "email", Password = "password" } + new Login.UserData { Email = "email", Password = "password" } ); var user = await SendAsync(command); diff --git a/tests/Conduit.IntegrationTests/SliceFixture.cs b/tests/Conduit.IntegrationTests/SliceFixture.cs index 11edea01..1b8742bc 100644 --- a/tests/Conduit.IntegrationTests/SliceFixture.cs +++ b/tests/Conduit.IntegrationTests/SliceFixture.cs @@ -10,27 +10,19 @@ namespace Conduit.IntegrationTests; public class SliceFixture : IDisposable { - //private static readonly IConfiguration CONFIG; private readonly IServiceScopeFactory _scopeFactory; private readonly ServiceProvider _provider; private readonly string _dbName = Guid.NewGuid() + ".db"; - - //static SliceFixture() => CONFIG = new ConfigurationBuilder() - // .AddEnvironmentVariables() - // .Build(); - public SliceFixture() { - var startup = new Startup(); var services = new ServiceCollection(); + services.AddConduit(); var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase(_dbName); services.AddSingleton(new ConduitContext(builder.Options)); - startup.ConfigureServices(services); - _provider = services.BuildServiceProvider(); GetDbContext().Database.EnsureCreated(); From 1b7f1d78e24a25472465f1c7544e9a80c0c4e7ca Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Thu, 11 Apr 2024 16:09:43 +0100 Subject: [PATCH 3/3] fmt --- src/Conduit/Features/Articles/List.cs | 6 +----- src/Conduit/Program.cs | 5 +---- tests/Conduit.IntegrationTests/SliceFixture.cs | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Conduit/Features/Articles/List.cs b/src/Conduit/Features/Articles/List.cs index d9ca5790..65db122b 100644 --- a/src/Conduit/Features/Articles/List.cs +++ b/src/Conduit/Features/Articles/List.cs @@ -110,11 +110,7 @@ CancellationToken cancellationToken .AsNoTracking() .ToListAsync(cancellationToken); - return new ArticlesEnvelope - { - Articles = articles, - ArticlesCount = queryable.Count() - }; + return new ArticlesEnvelope { Articles = articles, ArticlesCount = queryable.Count() }; } } } diff --git a/src/Conduit/Program.cs b/src/Conduit/Program.cs index 6992db18..1ea25654 100644 --- a/src/Conduit/Program.cs +++ b/src/Conduit/Program.cs @@ -82,10 +82,7 @@ x.SwaggerDoc("v1", new OpenApiInfo { Title = "RealWorld API", Version = "v1" }); x.CustomSchemaIds(y => y.FullName); x.DocInclusionPredicate((_, _) => true); - x.TagActionsBy(y => new List - { - y.GroupName ?? throw new InvalidOperationException() - }); + x.TagActionsBy(y => new List { y.GroupName ?? throw new InvalidOperationException() }); x.CustomSchemaIds(s => s.FullName?.Replace("+", ".")); }); diff --git a/tests/Conduit.IntegrationTests/SliceFixture.cs b/tests/Conduit.IntegrationTests/SliceFixture.cs index 1b8742bc..f81d25a1 100644 --- a/tests/Conduit.IntegrationTests/SliceFixture.cs +++ b/tests/Conduit.IntegrationTests/SliceFixture.cs @@ -10,10 +10,10 @@ namespace Conduit.IntegrationTests; public class SliceFixture : IDisposable { - private readonly IServiceScopeFactory _scopeFactory; private readonly ServiceProvider _provider; private readonly string _dbName = Guid.NewGuid() + ".db"; + public SliceFixture() { var services = new ServiceCollection();