From aaf71bf91ca29d971d0bad00fac5fc5bbba8be9c Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 27 Jun 2026 21:03:16 +0100 Subject: [PATCH] tests: smoke tests for Account and Blog BCs Two tests, two bounded contexts (BCs as enumerated in doc/ddd-exploration-2026-06-14.md): - AccountSmokeTests : GET /signin YavscConstants.SigninPath = "~/signin" Routing + Razor + IdentityServer + EF + DI all wired. - BlogSmokeTests : GET /BlogSpot/Index BlogSpotController (note the capital S) under Controllers/Communicating/. No class-level [Route], so conventional /{controller}/{action} applies. Both use TestWebApplicationFactory + the EF InMemory provider wired by WebServerFixture.SetupHost, so they boot the production HTTP pipeline without sockets, certs or a real DB. Closes the 'Tests d'integration smoke par BC' item of Jalon 0 in ROADMAP.md (Yavsc.Api / Yavsc.Blogs coverage to come). --- .../Smoke/AccountSmokeTests.cs | 36 +++++++++++++++++++ src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs | 35 ++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs create mode 100644 src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs diff --git a/src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs b/src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs new file mode 100644 index 00000000..50f92d63 --- /dev/null +++ b/src/Yavsc.Org.Tests/Smoke/AccountSmokeTests.cs @@ -0,0 +1,36 @@ +using System.Threading.Tasks; +using Xunit; + +namespace Yavsc.Org.Tests.Smoke; + +/// +/// Smoke for the Account BC (login / registration / OIDC discovery). +/// Hits the in-memory test server through +/// : no sockets, no +/// self-signed certificates, no real DB (the +/// AddInMemoryCollection in WebServerFixture.SetupHost +/// points the EF context at the in-memory provider). +/// +/// GET /signin is the public login endpoint served by +/// Yavsc.Org/Controllers/Accounting/AccountController +/// (decorated [HttpGet(YavscConstants.SigninPath)] with +/// YavscConstants.SigninPath = "~/signin"). A 200 means the +/// entire pipeline (routing + Razor + IdentityServer + EF + DI) +/// is wired correctly end-to-end. +/// +public class AccountSmokeTests : SmokeTestBase, IClassFixture +{ + private readonly TestWebApplicationFactory _factory; + + public AccountSmokeTests(TestWebApplicationFactory factory) + { + _factory = factory; + } + + [Fact] + public async Task GetSignin_returns_a_page() + { + using var client = _factory.CreateClient(); + await AssertResponds(client, "/signin"); + } +} diff --git a/src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs b/src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs new file mode 100644 index 00000000..8aa95347 --- /dev/null +++ b/src/Yavsc.Org.Tests/Smoke/BlogSmokeTests.cs @@ -0,0 +1,35 @@ +using System.Threading.Tasks; +using Xunit; + +namespace Yavsc.Org.Tests.Smoke; + +/// +/// Smoke for the Blog BC. Hits Yavsc.Org on +/// GET /BlogSpot/Index — the front-end page that lists blog +/// posts. The controller is BlogSpotController (note the +/// capital S) under Yavsc.Org/Controllers/Communicating/, +/// without a class-level [Route], so the conventional +/// /{controller}/{action} route applies (controller name +/// preserved case). +/// +/// The blog backend API itself lives in Yavsc.Blogs on a +/// separate host in production; cf. +/// doc/architecture/decoupage-organisation.md. The smoke +/// here asserts the front-end side of the BC. +/// +public class BlogSmokeTests : SmokeTestBase, IClassFixture +{ + private readonly TestWebApplicationFactory _factory; + + public BlogSmokeTests(TestWebApplicationFactory factory) + { + _factory = factory; + } + + [Fact] + public async Task GetBlogSpotIndex_returns_a_page() + { + using var client = _factory.CreateClient(); + await AssertResponds(client, "/BlogSpot/Index"); + } +}