Skip to content

Commit d2e8ae5

Browse files
committed
Cleanup
- Update Todo.Dapper.Tests to load app project via generated internal Program class (hence adding of InternalsVisibleToAttribute - Changes ports so they don't conflict - Remove unneeded generic type arg from call to AddScoped
1 parent 06cc397 commit d2e8ae5

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

src/MinimalApiPlayground/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"environmentVariables": {
1414
"ASPNETCORE_ENVIRONMENT": "Development"
1515
},
16-
"applicationUrl": "https://localhost:5001;http://localhost:5000",
16+
"applicationUrl": "https://localhost:5005;http://localhost:5004",
1717
"dotnetRunMessages": true
1818
},
1919
"IIS Express": {

src/Todo.Dapper/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
var builder = WebApplication.CreateBuilder(args);
66

77
var connectionString = builder.Configuration.GetConnectionString("TodoDb") ?? "Data Source=todos.db";
8-
builder.Services.AddScoped<SqliteConnection>(_ => new SqliteConnection(connectionString));
8+
builder.Services.AddScoped(_ => new SqliteConnection(connectionString));
99
builder.Services.AddEndpointsApiExplorer();
1010
builder.Services.AddSwaggerGen();
1111

src/Todo.Dapper/Properties/TodoApp.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Todo.Dapper/Todo.Dapper.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@
1313
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.0-*" />
1414
</ItemGroup>
1515

16+
<ItemGroup>
17+
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
18+
<_Parameter1>Todo.Dapper.Tests</_Parameter1>
19+
</AssemblyAttribute>
20+
</ItemGroup>
1621
</Project>

src/Todo.EFCore/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"Todo.EFCore": {
1212
"commandName": "Project",
1313
"dotnetRunMessages": true,
14-
"applicationUrl": "https://localhost:5001;http://localhost:5000",
14+
"applicationUrl": "https://localhost:5003;http://localhost:5002",
1515
"environmentVariables": {
1616
"ASPNETCORE_ENVIRONMENT": "Development"
1717
}

tests/Todo.Dapper.Tests/SmokeTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ public async Task GetSwaggerUI_Returns_OK()
4242
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
4343
}
4444

45-
class TodoApplication : WebApplicationFactory<TodoApp>
45+
class TodoApplication : WebApplicationFactory<Program>
4646
{
4747
protected override IHost CreateHost(IHostBuilder builder)
4848
{
4949
// Add mock/test services to the builder here
5050
builder.ConfigureServices(services =>
5151
{
52-
services.AddScoped<SqliteConnection>(sp =>
52+
services.AddScoped(sp =>
5353
{
5454
// Replace SQL Lite with test DB
5555
return new SqliteConnection("Data Source=testtodos.db");

0 commit comments

Comments
 (0)