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<Program> + 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).
This commit is contained in:
Paul Schneider 2026-06-27 21:03:16 +01:00
commit aaf71bf91c
2 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,36 @@
using System.Threading.Tasks;
using Xunit;
namespace Yavsc.Org.Tests.Smoke;
/// <summary>
/// Smoke for the Account BC (login / registration / OIDC discovery).
/// Hits the in-memory test server through
/// <see cref="TestWebApplicationFactory"/>: no sockets, no
/// self-signed certificates, no real DB (the
/// <c>AddInMemoryCollection</c> in <c>WebServerFixture.SetupHost</c>
/// points the EF context at the in-memory provider).
///
/// <c>GET /signin</c> is the public login endpoint served by
/// <c>Yavsc.Org/Controllers/Accounting/AccountController</c>
/// (decorated <c>[HttpGet(YavscConstants.SigninPath)]</c> with
/// <c>YavscConstants.SigninPath = "~/signin"</c>). A 200 means the
/// entire pipeline (routing + Razor + IdentityServer + EF + DI)
/// is wired correctly end-to-end.
/// </summary>
public class AccountSmokeTests : SmokeTestBase, IClassFixture<TestWebApplicationFactory>
{
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");
}
}

View file

@ -0,0 +1,35 @@
using System.Threading.Tasks;
using Xunit;
namespace Yavsc.Org.Tests.Smoke;
/// <summary>
/// Smoke for the Blog BC. Hits <c>Yavsc.Org</c> on
/// <c>GET /BlogSpot/Index</c> — the front-end page that lists blog
/// posts. The controller is <c>BlogSpotController</c> (note the
/// capital S) under <c>Yavsc.Org/Controllers/Communicating/</c>,
/// without a class-level <c>[Route]</c>, so the conventional
/// <c>/{controller}/{action}</c> route applies (controller name
/// preserved case).
///
/// The blog backend API itself lives in <c>Yavsc.Blogs</c> on a
/// separate host in production; cf.
/// <c>doc/architecture/decoupage-organisation.md</c>. The smoke
/// here asserts the front-end side of the BC.
/// </summary>
public class BlogSmokeTests : SmokeTestBase, IClassFixture<TestWebApplicationFactory>
{
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");
}
}