Skip to content

Commit 2a39297

Browse files
author
Bart Koelman
committed
Annotated DbContexts in integration tests
1 parent 1dd2c2b commit 2a39297

File tree

33 files changed

+85
-151
lines changed

33 files changed

+85
-151
lines changed

test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionDbContext.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,10 +6,10 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Archiving
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class TelevisionDbContext : DbContext
108
{
11-
public DbSet<TelevisionNetwork> Networks { get; set; }
12-
public DbSet<TelevisionStation> Stations { get; set; }
13-
public DbSet<TelevisionBroadcast> Broadcasts { get; set; }
14-
public DbSet<BroadcastComment> Comments { get; set; }
9+
public DbSet<TelevisionNetwork> Networks => Set<TelevisionNetwork>();
10+
public DbSet<TelevisionStation> Stations => Set<TelevisionStation>();
11+
public DbSet<TelevisionBroadcast> Broadcasts => Set<TelevisionBroadcast>();
12+
public DbSet<BroadcastComment> Comments => Set<BroadcastComment>();
1513

1614
public TelevisionDbContext(DbContextOptions<TelevisionDbContext> options)
1715
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/OperationsDbContext.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -10,12 +8,12 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.AtomicOperations
108
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
119
public sealed class OperationsDbContext : DbContext
1210
{
13-
public DbSet<Playlist> Playlists { get; set; }
14-
public DbSet<MusicTrack> MusicTracks { get; set; }
15-
public DbSet<Lyric> Lyrics { get; set; }
16-
public DbSet<TextLanguage> TextLanguages { get; set; }
17-
public DbSet<Performer> Performers { get; set; }
18-
public DbSet<RecordCompany> RecordCompanies { get; set; }
11+
public DbSet<Playlist> Playlists => Set<Playlist>();
12+
public DbSet<MusicTrack> MusicTracks => Set<MusicTrack>();
13+
public DbSet<Lyric> Lyrics => Set<Lyric>();
14+
public DbSet<TextLanguage> TextLanguages => Set<TextLanguage>();
15+
public DbSet<Performer> Performers => Set<Performer>();
16+
public DbSet<RecordCompany> RecordCompanies => Set<RecordCompany>();
1917

2018
public OperationsDbContext(DbContextOptions<OperationsDbContext> options)
2119
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/ExtraDbContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeDbContext.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -10,9 +8,9 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.CompositeKeys
108
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
119
public sealed class CompositeDbContext : DbContext
1210
{
13-
public DbSet<Car> Cars { get; set; }
14-
public DbSet<Engine> Engines { get; set; }
15-
public DbSet<Dealership> Dealerships { get; set; }
11+
public DbSet<Car> Cars => Set<Car>();
12+
public DbSet<Engine> Engines => Set<Engine>();
13+
public DbSet<Dealership> Dealerships => Set<Dealership>();
1614

1715
public CompositeDbContext(DbContextOptions<CompositeDbContext> options)
1816
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/PolicyDbContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,7 +6,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ContentNegotiation
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class PolicyDbContext : DbContext
108
{
11-
public DbSet<Policy> Policies { get; set; }
9+
public DbSet<Policy> Policies => Set<Policy>();
1210

1311
public PolicyDbContext(DbContextOptions<PolicyDbContext> options)
1412
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultDbContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,7 +6,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ControllerActionResults
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class ActionResultDbContext : DbContext
108
{
11-
public DbSet<Toothbrush> Toothbrushes { get; set; }
9+
public DbSet<Toothbrush> Toothbrushes => Set<Toothbrush>();
1210

1311
public ActionResultDbContext(DbContextOptions<ActionResultDbContext> options)
1412
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,8 +6,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.CustomRoutes
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class CustomRouteDbContext : DbContext
108
{
11-
public DbSet<Town> Towns { get; set; }
12-
public DbSet<Civilian> Civilians { get; set; }
9+
public DbSet<Town> Towns => Set<Town>();
10+
public DbSet<Civilian> Civilians => Set<Civilian>();
1311

1412
public CustomRouteDbContext(DbContextOptions<CustomRouteDbContext> options)
1513
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingDbContext.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -10,9 +8,9 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.EagerLoading
108
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
119
public sealed class EagerLoadingDbContext : DbContext
1210
{
13-
public DbSet<State> States { get; set; }
14-
public DbSet<Street> Streets { get; set; }
15-
public DbSet<Building> Buildings { get; set; }
11+
public DbSet<State> States => Set<State>();
12+
public DbSet<Street> Streets => Set<Street>();
13+
public DbSet<Building> Buildings => Set<Building>();
1614

1715
public EagerLoadingDbContext(DbContextOptions<EagerLoadingDbContext> options)
1816
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ErrorDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,8 +6,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ExceptionHandling
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class ErrorDbContext : DbContext
108
{
11-
public DbSet<ConsumerArticle> ConsumerArticles { get; set; }
12-
public DbSet<ThrowingArticle> ThrowingArticles { get; set; }
9+
public DbSet<ConsumerArticle> ConsumerArticles => Set<ConsumerArticle>();
10+
public DbSet<ThrowingArticle> ThrowingArticles => Set<ThrowingArticle>();
1311

1412
public ErrorDbContext(DbContextOptions<ErrorDbContext> options)
1513
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,8 +6,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.HostingInIIS
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class HostingDbContext : DbContext
108
{
11-
public DbSet<ArtGallery> ArtGalleries { get; set; }
12-
public DbSet<Painting> Paintings { get; set; }
9+
public DbSet<ArtGallery> ArtGalleries => Set<ArtGallery>();
10+
public DbSet<Painting> Paintings => Set<Painting>();
1311

1412
public HostingDbContext(DbContextOptions<HostingDbContext> options)
1513
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/ObfuscationDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,8 +6,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.IdObfuscation
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class ObfuscationDbContext : DbContext
108
{
11-
public DbSet<BankAccount> BankAccounts { get; set; }
12-
public DbSet<DebitCard> DebitCards { get; set; }
9+
public DbSet<BankAccount> BankAccounts => Set<BankAccount>();
10+
public DbSet<DebitCard> DebitCards => Set<DebitCard>();
1311

1412
public ObfuscationDbContext(DbContextOptions<ObfuscationDbContext> options)
1513
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -10,8 +8,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.InputValidation.ModelState
108
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
119
public sealed class ModelStateDbContext : DbContext
1210
{
13-
public DbSet<SystemDirectory> Directories { get; set; }
14-
public DbSet<SystemFile> Files { get; set; }
11+
public DbSet<SystemDirectory> Directories => Set<SystemDirectory>();
12+
public DbSet<SystemFile> Files => Set<SystemFile>();
1513

1614
public ModelStateDbContext(DbContextOptions<ModelStateDbContext> options)
1715
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowDbContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -10,7 +8,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.InputValidation.RequestBody
108
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
119
public sealed class WorkflowDbContext : DbContext
1210
{
13-
public DbSet<Workflow> Workflows { get; set; }
11+
public DbSet<Workflow> Workflows => Set<Workflow>();
1412

1513
public WorkflowDbContext(DbContextOptions<WorkflowDbContext> options)
1614
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinksDbContext.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -10,9 +8,9 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Links
108
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
119
public sealed class LinksDbContext : DbContext
1210
{
13-
public DbSet<PhotoAlbum> PhotoAlbums { get; set; }
14-
public DbSet<Photo> Photos { get; set; }
15-
public DbSet<PhotoLocation> PhotoLocations { get; set; }
11+
public DbSet<PhotoAlbum> PhotoAlbums => Set<PhotoAlbum>();
12+
public DbSet<Photo> Photos => Set<Photo>();
13+
public DbSet<PhotoLocation> PhotoLocations => Set<PhotoLocation>();
1614

1715
public LinksDbContext(DbContextOptions<LinksDbContext> options)
1816
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/Logging/AuditDbContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,7 +6,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Logging
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class AuditDbContext : DbContext
108
{
11-
public DbSet<AuditEntry> AuditEntries { get; set; }
9+
public DbSet<AuditEntry> AuditEntries => Set<AuditEntry>();
1210

1311
public AuditDbContext(DbContextOptions<AuditDbContext> options)
1412
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/Meta/SupportDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,8 +6,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Meta
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class SupportDbContext : DbContext
108
{
11-
public DbSet<ProductFamily> ProductFamilies { get; set; }
12-
public DbSet<SupportTicket> SupportTickets { get; set; }
9+
public DbSet<ProductFamily> ProductFamilies => Set<ProductFamily>();
10+
public DbSet<SupportTicket> SupportTickets => Set<SupportTicket>();
1311

1412
public SupportDbContext(DbContextOptions<SupportDbContext> options)
1513
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,8 +6,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Microservices.FireAndForgetDel
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class FireForgetDbContext : DbContext
108
{
11-
public DbSet<DomainUser> Users { get; set; }
12-
public DbSet<DomainGroup> Groups { get; set; }
9+
public DbSet<DomainUser> Users => Set<DomainUser>();
10+
public DbSet<DomainGroup> Groups => Set<DomainGroup>();
1311

1412
public FireForgetDbContext(DbContextOptions<FireForgetDbContext> options)
1513
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxDbContext.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using JsonApiDotNetCoreTests.IntegrationTests.Microservices.Messages;
53
using Microsoft.EntityFrameworkCore;
@@ -9,9 +7,9 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Microservices.TransactionalOut
97
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
108
public sealed class OutboxDbContext : DbContext
119
{
12-
public DbSet<DomainUser> Users { get; set; }
13-
public DbSet<DomainGroup> Groups { get; set; }
14-
public DbSet<OutgoingMessage> OutboxMessages { get; set; }
10+
public DbSet<DomainUser> Users => Set<DomainUser>();
11+
public DbSet<DomainGroup> Groups => Set<DomainGroup>();
12+
public DbSet<OutgoingMessage> OutboxMessages => Set<OutgoingMessage>();
1513

1614
public OutboxDbContext(DbContextOptions<OutboxDbContext> options)
1715
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyDbContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -12,8 +10,8 @@ public sealed class MultiTenancyDbContext : DbContext
1210
{
1311
private readonly ITenantProvider _tenantProvider;
1412

15-
public DbSet<WebShop> WebShops { get; set; }
16-
public DbSet<WebProduct> WebProducts { get; set; }
13+
public DbSet<WebShop> WebShops => Set<WebShop>();
14+
public DbSet<WebProduct> WebProducts => Set<WebProduct>();
1715

1816
public MultiTenancyDbContext(DbContextOptions<MultiTenancyDbContext> options, ITenantProvider tenantProvider)
1917
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/SwimmingDbContext.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,9 +6,9 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.NamingConventions
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class SwimmingDbContext : DbContext
108
{
11-
public DbSet<SwimmingPool> SwimmingPools { get; set; }
12-
public DbSet<WaterSlide> WaterSlides { get; set; }
13-
public DbSet<DivingBoard> DivingBoards { get; set; }
9+
public DbSet<SwimmingPool> SwimmingPools => Set<SwimmingPool>();
10+
public DbSet<WaterSlide> WaterSlides => Set<WaterSlide>();
11+
public DbSet<DivingBoard> DivingBoards => Set<DivingBoard>();
1412

1513
public SwimmingDbContext(DbContextOptions<SwimmingDbContext> options)
1614
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/NonJsonApiControllers/NonJsonApiDbContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDbContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -8,7 +6,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings.Filtering
86
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
97
public sealed class FilterDbContext : DbContext
108
{
11-
public DbSet<FilterableResource> FilterableResources { get; set; }
9+
public DbSet<FilterableResource> FilterableResources => Set<FilterableResource>();
1210

1311
public FilterDbContext(DbContextOptions<FilterDbContext> options)
1412
: base(options)

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringDbContext.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using Microsoft.EntityFrameworkCore;
53

@@ -10,15 +8,15 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings
108
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
119
public sealed class QueryStringDbContext : DbContext
1210
{
13-
public DbSet<Blog> Blogs { get; set; }
14-
public DbSet<BlogPost> Posts { get; set; }
15-
public DbSet<Label> Labels { get; set; }
16-
public DbSet<Comment> Comments { get; set; }
17-
public DbSet<WebAccount> Accounts { get; set; }
18-
public DbSet<AccountPreferences> AccountPreferences { get; set; }
19-
public DbSet<LoginAttempt> LoginAttempts { get; set; }
20-
public DbSet<Calendar> Calendars { get; set; }
21-
public DbSet<Appointment> Appointments { get; set; }
11+
public DbSet<Blog> Blogs => Set<Blog>();
12+
public DbSet<BlogPost> Posts => Set<BlogPost>();
13+
public DbSet<Label> Labels => Set<Label>();
14+
public DbSet<Comment> Comments => Set<Comment>();
15+
public DbSet<WebAccount> Accounts => Set<WebAccount>();
16+
public DbSet<AccountPreferences> AccountPreferences => Set<AccountPreferences>();
17+
public DbSet<LoginAttempt> LoginAttempts => Set<LoginAttempt>();
18+
public DbSet<Calendar> Calendars => Set<Calendar>();
19+
public DbSet<Appointment> Appointments => Set<Appointment>();
2220

2321
public QueryStringDbContext(DbContextOptions<QueryStringDbContext> options)
2422
: base(options)

0 commit comments

Comments
 (0)