Skip to content

Commit

Permalink
Merge branch 'master' into merge-master-into-openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
bkoelman committed Oct 16, 2024
2 parents 0a3fa63 + eb2ef95 commit a03b349
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2024.2.5",
"version": "2024.2.6",
"commands": [
"jb"
],
Expand All @@ -17,7 +17,7 @@
"rollForward": false
},
"dotnet-reportgenerator-globaltool": {
"version": "5.3.10",
"version": "5.3.11",
"commands": [
"reportgenerator"
],
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/QueryString/QueryStringParserBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public QueryStringParserBenchmarks()

var request = new JsonApiRequest
{
PrimaryResourceType = resourceGraph.GetResourceType(typeof(QueryableResource)),
PrimaryResourceType = resourceGraph.GetResourceType<QueryableResource>(),
IsCollection = true
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public async Task DeleteAsync(TResource? resourceFromDatabase, [DisallowNull] TI
await _resourceDefinitionAccessor.OnWritingAsync(placeholderResource, WriteOperationKind.DeleteResource, cancellationToken);

var deleteBuilder = new DeleteResourceStatementBuilder(_dataModelService);
DeleteNode deleteNode = deleteBuilder.Build(ResourceType, placeholderResource.Id!);
DeleteNode deleteNode = deleteBuilder.Build(ResourceType, placeholderResource.Id);
CommandDefinition sqlCommand = _dapperFacade.GetSqlCommand(deleteNode, cancellationToken);

await ExecuteInTransactionAsync(async transaction =>
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Middleware/TraceLogWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public override void Write(Utf8JsonWriter writer, TWrapper value, JsonSerializer

internal sealed partial class TraceLogWriter<T>(ILoggerFactory loggerFactory) : TraceLogWriter
{
private readonly ILogger _logger = loggerFactory.CreateLogger(typeof(T));
private readonly ILogger _logger = loggerFactory.CreateLogger<T>();

public void LogMethodStart(object? parameters = null, [CallerMemberName] string memberName = "")
{
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public QueryLayer ComposeForUpdate<TId>([DisallowNull] TId id, ResourceType prim
{
ArgumentGuard.NotNull(primaryResourceType);

IImmutableSet<IncludeElementExpression> includeElements = _targetedFields.Relationships
ImmutableHashSet<IncludeElementExpression> includeElements = _targetedFields.Relationships
.Select(relationship => new IncludeElementExpression(relationship)).ToImmutableHashSet();

AttrAttribute primaryIdAttribute = GetIdAttribute(primaryResourceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(WorkItem).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(int));
property.PropertyType.Should().Be<int>();
}

[Fact]
Expand Down Expand Up @@ -162,7 +162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(UserAccount).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(long));
property.PropertyType.Should().Be<long>();
}

[Fact]
Expand Down Expand Up @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(Guid));
property.PropertyType.Should().Be<Guid>();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(Guid));
property.PropertyType.Should().Be<Guid>();
}

[Theory]
Expand Down Expand Up @@ -134,7 +134,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(Guid));
property.PropertyType.Should().Be<Guid>();
}

[Theory]
Expand Down Expand Up @@ -185,7 +185,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(string));
property.PropertyType.Should().Be<string>();
}

[Theory]
Expand Down Expand Up @@ -236,7 +236,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(string));
property.PropertyType.Should().Be<string>();
}

[Theory]
Expand Down Expand Up @@ -292,7 +292,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(string));
property.PropertyType.Should().Be<string>();
}

[Theory]
Expand Down Expand Up @@ -475,7 +475,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(string));
property.PropertyType.Should().Be<string>();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(Guid));
property.PropertyType.Should().Be<Guid>();
}

[Fact]
Expand Down Expand Up @@ -375,7 +375,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>

PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable<object>.Id));
property.ShouldNotBeNull();
property.PropertyType.Should().Be(typeof(string));
property.PropertyType.Should().Be<string>();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ internal void Reset()

internal void AssertLeftType<TLeft>()
{
LeftDeclaredType.Should().Be(typeof(TLeft));
LeftDeclaredType.Should().Be<TLeft>();
LeftReflectedTypeName.Should().Be(typeof(TLeft).Name);

Request.ShouldNotBeNull();
Request.PrimaryResourceType.ShouldNotBeNull();
Request.PrimaryResourceType.ClrType.Should().Be(typeof(TLeft));
Request.Relationship?.LeftType.ClrType.Should().Be(typeof(TLeft));
Request.PrimaryResourceType.ClrType.Should().Be<TLeft>();
Request.Relationship?.LeftType.ClrType.Should().Be<TLeft>();
}

internal void AssertRightTypes(params Type[] types)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,17 @@ private abstract class FileSystemEntry : Identifiable<long>
public FileSystemEntry Parent { get; set; } = null!;

[HasMany]
public IList<FileSystemEntry> Children { get; set; } = new List<FileSystemEntry>();
public List<FileSystemEntry> Children { get; set; } = [];
}

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
private sealed class DirectoryEntry : FileSystemEntry
{
[HasMany]
public IList<DirectoryEntry> Subdirectories { get; set; } = new List<DirectoryEntry>();
public List<DirectoryEntry> Subdirectories { get; set; } = [];

[HasMany]
public IList<FileEntry> Files { get; set; } = new List<FileEntry>();
public List<FileEntry> Files { get; set; } = [];
}

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public void Resolves_correct_type_for_lazy_loading_proxy()
ResourceType resourceType = resourceGraph.GetResourceType(proxy.GetType());

// Assert
resourceType.ClrType.Should().Be(typeof(ResourceOfInt32));
resourceType.ClrType.Should().Be<ResourceOfInt32>();
}

[Fact]
Expand Down
3 changes: 3 additions & 0 deletions test/UnitTests/Graph/Implementation.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using JetBrains.Annotations;

namespace UnitTests.Graph;

[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
internal sealed class Implementation : IGenericInterface<int>;
8 changes: 4 additions & 4 deletions test/UnitTests/Graph/TypeLocatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public void GetContainerRegistrationFromAssembly_Gets_Implementation()

// Assert
result.ShouldNotBeNull();
result.Value.implementationType.Should().Be(typeof(Implementation));
result.Value.serviceInterface.Should().Be(typeof(IGenericInterface<int>));
result.Value.implementationType.Should().Be<Implementation>();
result.Value.serviceInterface.Should().Be<IGenericInterface<int>>();
}

[Fact]
Expand All @@ -39,7 +39,7 @@ public void GetIdType_Correctly_Identifies_JsonApiResource()
Type? idType = typeLocator.LookupIdType(type);

// Assert
idType.Should().Be(typeof(int));
idType.Should().Be<int>();
}

[Fact]
Expand Down Expand Up @@ -71,7 +71,7 @@ public void ResolveResourceDescriptor_Returns_Type_If_Type_Is_IIdentifiable()
// Assert
descriptor.ShouldNotBeNull();
descriptor.ResourceClrType.Should().Be(resourceClrType);
descriptor.IdClrType.Should().Be(typeof(int));
descriptor.IdClrType.Should().Be<int>();
}

[Fact]
Expand Down
1 change: 0 additions & 1 deletion tests.runsettings
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<xUnit>
<ParallelAlgorithm>aggressive</ParallelAlgorithm>
<ShowLiveOutput>true</ShowLiveOutput>
</xUnit>
<RunConfiguration>
Expand Down

0 comments on commit a03b349

Please sign in to comment.