Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the WebMaker class in favor of a partial Program class #507

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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