Skip to content

Commit e97deb0

Browse files
author
Bart Koelman
committed
Applied new Resharper suggestions
1 parent 7b473b9 commit e97deb0

File tree

16 files changed

+31
-31
lines changed

16 files changed

+31
-31
lines changed

src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ protected void AssertIsNotClearingRequiredToOneRelationship(RelationshipAttribut
297297
if (relationship is HasOneAttribute)
298298
{
299299
INavigation? navigation = GetNavigation(relationship);
300-
bool isRelationshipRequired = navigation?.ForeignKey?.IsRequired ?? false;
300+
bool isRelationshipRequired = navigation?.ForeignKey.IsRequired ?? false;
301301

302302
bool isClearingRelationship = rightValue == null;
303303

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/OperationsDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected override void OnModelCreating(ModelBuilder builder)
2424
{
2525
builder.Entity<MusicTrack>()
2626
.HasOne(musicTrack => musicTrack.Lyric)
27-
.WithOne(lyric => lyric!.Track!)
27+
.WithOne(lyric => lyric.Track!)
2828
.HasForeignKey<MusicTrack>("LyricId");
2929

3030
builder.Entity<MusicTrack>()

test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected override void OnModelCreating(ModelBuilder builder)
2828

2929
builder.Entity<Engine>()
3030
.HasOne(engine => engine.Car)
31-
.WithOne(car => car!.Engine)
31+
.WithOne(car => car.Engine)
3232
.HasForeignKey<Engine>();
3333

3434
builder.Entity<Dealership>()

test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public async Task Denies_JsonApi_ContentType_header_with_profile()
182182
};
183183

184184
const string route = "/policies";
185-
string contentType = $"{HeaderConstants.MediaType}; profile=something";
185+
const string contentType = $"{HeaderConstants.MediaType}; profile=something";
186186

187187
// Act
188188
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody, contentType);
@@ -217,7 +217,7 @@ public async Task Denies_JsonApi_ContentType_header_with_extension()
217217
};
218218

219219
const string route = "/policies";
220-
string contentType = $"{HeaderConstants.MediaType}; ext=something";
220+
const string contentType = $"{HeaderConstants.MediaType}; ext=something";
221221

222222
// Act
223223
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody, contentType);
@@ -287,7 +287,7 @@ public async Task Denies_JsonApi_ContentType_header_with_CharSet()
287287
};
288288

289289
const string route = "/policies";
290-
string contentType = $"{HeaderConstants.MediaType}; charset=ISO-8859-4";
290+
const string contentType = $"{HeaderConstants.MediaType}; charset=ISO-8859-4";
291291

292292
// Act
293293
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody, contentType);
@@ -322,7 +322,7 @@ public async Task Denies_JsonApi_ContentType_header_with_unknown_parameter()
322322
};
323323

324324
const string route = "/policies";
325-
string contentType = $"{HeaderConstants.MediaType}; unknown=unexpected";
325+
const string contentType = $"{HeaderConstants.MediaType}; unknown=unexpected";
326326

327327
// Act
328328
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody, contentType);
@@ -375,7 +375,7 @@ public async Task Denies_JsonApi_ContentType_header_at_operations_endpoint()
375375

376376
responseDocument.Errors.ShouldHaveCount(1);
377377

378-
string detail = $"Please specify '{HeaderConstants.AtomicOperationsMediaType}' instead of '{contentType}' for the Content-Type header value.";
378+
const string detail = $"Please specify '{HeaderConstants.AtomicOperationsMediaType}' instead of '{contentType}' for the Content-Type header value.";
379379

380380
ErrorObject error = responseDocument.Errors[0];
381381
error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType);

test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
9393
await dbContext.SaveChangesAsync();
9494
});
9595

96-
string route = $"{PathPrefix}/photoAlbums?include=photos";
96+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
9797

9898
// Act
9999
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -346,7 +346,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
346346
}
347347
};
348348

349-
string route = $"{PathPrefix}/photoAlbums?include=photos";
349+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
350350

351351
// Act
352352
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody);

test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
9393
await dbContext.SaveChangesAsync();
9494
});
9595

96-
string route = $"{PathPrefix}/photoAlbums?include=photos";
96+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
9797

9898
// Act
9999
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -346,7 +346,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
346346
}
347347
};
348348

349-
string route = $"{PathPrefix}/photoAlbums?include=photos";
349+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
350350

351351
// Act
352352
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody);

test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinksDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected override void OnModelCreating(ModelBuilder builder)
2121
{
2222
builder.Entity<Photo>()
2323
.HasOne(photo => photo.Location)
24-
.WithOne(location => location!.Photo)
24+
.WithOne(location => location.Photo)
2525
.HasForeignKey<Photo>("LocationId");
2626
}
2727
}

test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
9393
await dbContext.SaveChangesAsync();
9494
});
9595

96-
string route = $"{PathPrefix}/photoAlbums?include=photos";
96+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
9797

9898
// Act
9999
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -346,7 +346,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
346346
}
347347
};
348348

349-
string route = $"{PathPrefix}/photoAlbums?include=photos";
349+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
350350

351351
// Act
352352
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody);

test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
9393
await dbContext.SaveChangesAsync();
9494
});
9595

96-
string route = $"{PathPrefix}/photoAlbums?include=photos";
96+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
9797

9898
// Act
9999
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -346,7 +346,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
346346
}
347347
};
348348

349-
string route = $"{PathPrefix}/photoAlbums?include=photos";
349+
const string route = $"{PathPrefix}/photoAlbums?include=photos";
350350

351351
// Act
352352
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecutePostAsync<Document>(route, requestBody);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public FilterTests(IntegrationTestContext<TestableStartup<QueryStringDbContext>,
3030
public async Task Cannot_filter_in_unknown_scope()
3131
{
3232
// Arrange
33-
string route = $"/webAccounts?filter[{Unknown.Relationship}]=equals(title,null)";
33+
const string route = $"/webAccounts?filter[{Unknown.Relationship}]=equals(title,null)";
3434

3535
// Act
3636
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -52,7 +52,7 @@ public async Task Cannot_filter_in_unknown_scope()
5252
public async Task Cannot_filter_in_unknown_nested_scope()
5353
{
5454
// Arrange
55-
string route = $"/webAccounts?filter[posts.{Unknown.Relationship}]=equals(title,null)";
55+
const string route = $"/webAccounts?filter[posts.{Unknown.Relationship}]=equals(title,null)";
5656

5757
// Act
5858
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
836836
public async Task Cannot_include_unknown_relationship()
837837
{
838838
// Arrange
839-
string route = $"/webAccounts?include={Unknown.Relationship}";
839+
const string route = $"/webAccounts?include={Unknown.Relationship}";
840840

841841
// Act
842842
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -858,7 +858,7 @@ public async Task Cannot_include_unknown_relationship()
858858
public async Task Cannot_include_unknown_nested_relationship()
859859
{
860860
// Arrange
861-
string route = $"/blogs?include=posts.{Unknown.Relationship}";
861+
const string route = $"/blogs?include=posts.{Unknown.Relationship}";
862862

863863
// Act
864864
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
441441
responseDocument.Included[2].Type.Should().Be("comments");
442442
responseDocument.Included[2].Id.Should().Be(blogs[1].Owner!.Posts[1].Comments.ElementAt(1).StringId);
443443

444-
string linkPrefix = $"{HostPrefix}/blogs?include=owner.posts.comments";
444+
const string linkPrefix = $"{HostPrefix}/blogs?include=owner.posts.comments";
445445

446446
responseDocument.Links.ShouldNotBeNull();
447447
responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}");
@@ -455,7 +455,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
455455
public async Task Cannot_paginate_in_unknown_scope()
456456
{
457457
// Arrange
458-
string route = $"/webAccounts?page[number]={Unknown.Relationship}:1";
458+
const string route = $"/webAccounts?page[number]={Unknown.Relationship}:1";
459459

460460
// Act
461461
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -477,7 +477,7 @@ public async Task Cannot_paginate_in_unknown_scope()
477477
public async Task Cannot_paginate_in_unknown_nested_scope()
478478
{
479479
// Arrange
480-
string route = $"/webAccounts?page[size]=posts.{Unknown.Relationship}:1";
480+
const string route = $"/webAccounts?page[size]=posts.{Unknown.Relationship}:1";
481481

482482
// Act
483483
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
456456
public async Task Cannot_sort_in_unknown_scope()
457457
{
458458
// Arrange
459-
string route = $"/webAccounts?sort[{Unknown.Relationship}]=id";
459+
const string route = $"/webAccounts?sort[{Unknown.Relationship}]=id";
460460

461461
// Act
462462
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
@@ -478,7 +478,7 @@ public async Task Cannot_sort_in_unknown_scope()
478478
public async Task Cannot_sort_in_unknown_nested_scope()
479479
{
480480
// Arrange
481-
string route = $"/webAccounts?sort[posts.{Unknown.Relationship}]=id";
481+
const string route = $"/webAccounts?sort[posts.{Unknown.Relationship}]=id";
482482

483483
// Act
484484
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
705705
public async Task Cannot_select_on_unknown_resource_type()
706706
{
707707
// Arrange
708-
string route = $"/webAccounts?fields[{Unknown.ResourceType}]=id";
708+
const string route = $"/webAccounts?fields[{Unknown.ResourceType}]=id";
709709

710710
// Act
711711
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);

test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/ReadWriteDbContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ protected override void OnModelCreating(ModelBuilder builder)
2424
{
2525
builder.Entity<WorkItem>()
2626
.HasOne(workItem => workItem.Assignee)
27-
.WithMany(userAccount => userAccount!.AssignedItems);
27+
.WithMany(userAccount => userAccount.AssignedItems);
2828

2929
builder.Entity<WorkItem>()
3030
.HasMany(workItem => workItem.Subscribers)
3131
.WithOne();
3232

3333
builder.Entity<WorkItemGroup>()
3434
.HasOne(workItemGroup => workItemGroup.Color)
35-
.WithOne(color => color!.Group!)
35+
.WithOne(color => color.Group!)
3636
.HasForeignKey<RgbColor>("GroupId");
3737

3838
builder.Entity<WorkItem>()
3939
.HasOne(workItem => workItem.Parent)
40-
.WithMany(workItem => workItem!.Children);
40+
.WithMany(workItem => workItem.Children);
4141

4242
builder.Entity<WorkItem>()
4343
.HasMany(workItem => workItem.RelatedFrom)

test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroKeyDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected override void OnModelCreating(ModelBuilder builder)
2525

2626
builder.Entity<Player>()
2727
.HasOne(player => player.ActiveGame)
28-
.WithMany(game => game!.ActivePlayers);
28+
.WithMany(game => game.ActivePlayers);
2929
}
3030
}
3131
}

0 commit comments

Comments
 (0)