Skip to content

Commit

Permalink
Remove the WebMaker class in favor of a partial Program class (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
IliyanAng authored Feb 12, 2023
1 parent f445459 commit 3d35d9e
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/Clean.Architecture.Web/Api/MetaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class MetaController : BaseApiController
[HttpGet("/info")]
public ActionResult<string> Info()
{
var assembly = typeof(WebMarker).Assembly;
var assembly = typeof(Program).Assembly;

var creationDate = System.IO.File.GetCreationTime(assembly.Location);
var version = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;
Expand Down
5 changes: 5 additions & 0 deletions src/Clean.Architecture.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@
}

app.Run();

// Make the implicit Program.cs class public, so integration tests can reference the correct assembly for host building
public partial class Program
{
}
7 changes: 0 additions & 7 deletions src/Clean.Architecture.Web/WebMarker.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace Clean.Architecture.FunctionalTests.ApiEndpoints;

[Collection("Sequential")]
public class ContributorGetById : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class ContributorGetById : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public ContributorGetById(CustomWebApplicationFactory<WebMarker> factory)
public ContributorGetById(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace Clean.Architecture.FunctionalTests.ApiEndpoints;

[Collection("Sequential")]
public class ContributorList : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class ContributorList : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public ContributorList(CustomWebApplicationFactory<WebMarker> factory)
public ContributorList(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace Clean.Architecture.FunctionalTests.ApiEndpoints;

[Collection("Sequential")]
public class ProjectGetById : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class ProjectGetById : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public ProjectGetById(CustomWebApplicationFactory<WebMarker> factory)
public ProjectGetById(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace Clean.Architecture.FunctionalTests.ApiEndpoints;

[Collection("Sequential")]
public class ProjectList : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class ProjectList : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public ProjectList(CustomWebApplicationFactory<WebMarker> factory)
public ProjectList(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace Clean.Architecture.FunctionalTests.ControllerApis;

[Collection("Sequential")]
public class ProjectCreate : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class ProjectCreate : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public ProjectCreate(CustomWebApplicationFactory<WebMarker> factory)
public ProjectCreate(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
namespace Clean.Architecture.FunctionalTests.ControllerApis;

[Collection("Sequential")]
public class MetaControllerInfo : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class MetaControllerInfo : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public MetaControllerInfo(CustomWebApplicationFactory<WebMarker> factory)
public MetaControllerInfo(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace Clean.Architecture.FunctionalTests.ControllerApis;

[Collection("Sequential")]
public class ProjectItemMarkComplete : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class ProjectItemMarkComplete : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public ProjectItemMarkComplete(CustomWebApplicationFactory<WebMarker> factory)
public ProjectItemMarkComplete(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
namespace Clean.Architecture.FunctionalTests.ControllerViews;

[Collection("Sequential")]
public class HomeControllerIndex : IClassFixture<CustomWebApplicationFactory<WebMarker>>
public class HomeControllerIndex : IClassFixture<CustomWebApplicationFactory<Program>>
{
private readonly HttpClient _client;

public HomeControllerIndex(CustomWebApplicationFactory<WebMarker> factory)
public HomeControllerIndex(CustomWebApplicationFactory<Program> factory)
{
_client = factory.CreateClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Clean.Architecture.FunctionalTests;

public class CustomWebApplicationFactory<TStartup> : WebApplicationFactory<TStartup> where TStartup : class
public class CustomWebApplicationFactory<TProgram> : WebApplicationFactory<TProgram> where TProgram : class
{
/// <summary>
/// Overriding CreateHost to avoid creating a separate ServiceProvider per this thread:
Expand All @@ -34,7 +34,7 @@ protected override IHost CreateHost(IHostBuilder builder)
var db = scopedServices.GetRequiredService<AppDbContext>();

var logger = scopedServices
.GetRequiredService<ILogger<CustomWebApplicationFactory<TStartup>>>();
.GetRequiredService<ILogger<CustomWebApplicationFactory<TProgram>>>();

// Ensure the database is created.
db.Database.EnsureCreated();
Expand Down

0 comments on commit 3d35d9e

Please sign in to comment.