Skip to content

Commit

Permalink
Migrated breaking changes for use with Hotchocolate 14 (#114)
Browse files Browse the repository at this point in the history
* Migrated breaking changes for use with Hotchocolate 14-rc

QueryResult is now OperationResult

* Renamed QueryResultExtensions to OperationResultExtensions

Renamed QueryResultExtensions to OperationResultExtensions

* Fixed spelling mistakes

Fixed simple spelling mistakes:
AssertSuceessResult is now AssertSuccessResult
formattedMessagePlaceholerValues is now formattedMessagePlaceholderValues
FieldSkipValidationPredecate is now FieldSkipValidationPredicate

* Updated HotChocolate.Execute to 14.0.0-rc.3.2

* Updated HotChocolate.Execution to 14

* Updated HotChocolate.Execution nuget package to 14.1.0
  • Loading branch information
d-lundy authored Nov 26, 2024
1 parent 0208b5f commit 81f34f6
Show file tree
Hide file tree
Showing 17 changed files with 177 additions and 177 deletions.
4 changes: 2 additions & 2 deletions src/AppAny.HotChocolate.FluentValidation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<!-- </ItemGroup>-->

<ItemGroup Label="Packages">
<PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="HotChocolate.Execution" Version="13.8.1" />
<PackageReference Include="FluentValidation" Version="11.10.0" />
<PackageReference Include="HotChocolate.Execution" Version="14.1.0" />
</ItemGroup>

<ItemGroup Label="Assets">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task CustomErrorCode()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameWithErrorCodeValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task AddFluentValidation()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -69,7 +69,7 @@ public async Task UseFluentValidation()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

namespace AppAny.HotChocolate.FluentValidation.Tests
{
public static class QueryResultExtensions
public static class OperationResultExtensions
{
public static void AssertNullResult(this QueryResult result)
public static void AssertNullResult(this OperationResult result)
{
var (key, value) = Assert.Single(result.Data!);

Assert.Equal("test", key);
Assert.Null(value);
}

public static void AssertSuceessResult(this QueryResult result)
public static void AssertSuccessResult(this OperationResult result)
{
var (key, value) = Assert.Single(result.Data!);

Expand All @@ -27,7 +27,7 @@ public static void AssertSuceessResult(this QueryResult result)
}

public static void AssertDefaultErrorMapper(
this QueryResult result,
this OperationResult result,
string code,
string message,
params Action<KeyValuePair<string, object?>>[] elementInspectors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task AddFluentValidation()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -69,7 +69,7 @@ public async Task UseFluentValidation()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task SingleInput()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithMultipleInputsEmptyName));

result.AssertNullResult();
Expand All @@ -53,7 +53,7 @@ public async Task DoubleInput()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithMultipleInputsEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -102,7 +102,7 @@ public async Task SecondInput()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithMultipleInputsEmptyName));

result.AssertNullResult();
Expand All @@ -129,10 +129,10 @@ public async Task NoInputs()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithMultipleInputsEmptyName));

result.AssertSuceessResult();
result.AssertSuccessResult();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Multiple()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.MultipleMutationsWithEmptyName));

Assert.Collection(result.Data!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task NullResult_WithCodeExtension()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -57,7 +57,7 @@ public async Task NullResult_ValidatorOverride()
services.AddTransient<NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -87,7 +87,7 @@ public async Task ThrowsNoMessageSet()
services.AddTransient<NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand All @@ -108,7 +108,7 @@ public async Task ThrowsNullInputValidator()
}));
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand All @@ -132,10 +132,10 @@ public async Task CustomInputValidatorHasNoValidators()
}));
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertSuceessResult();
result.AssertSuccessResult();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task AddFluentValidation()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -74,7 +74,7 @@ public async Task UseFluentValidation()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -108,7 +108,7 @@ public async Task UseDefaultErrorMapperWithDetails()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -172,7 +172,7 @@ public async Task UseDefaultErrorMapperWithDetailsWithOperationName()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithOperationNameEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -236,7 +236,7 @@ public async Task UseDefaultErrorMapperWithExtendedDetails()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -288,13 +288,13 @@ public async Task UseDefaultErrorMapperWithExtendedDetails()
Assert.Equal(ValidationDefaults.ExtensionKeys.CustomStateKey, customState.Key);
Assert.Null(customState.Value);
},
formattedMessagePlaceholerValues =>
formattedMessagePlaceholderValues =>
{
Assert.Equal(
ValidationDefaults.ExtensionKeys.FormattedMessagePlaceholderValuesKey,
formattedMessagePlaceholerValues.Key);
formattedMessagePlaceholderValues.Key);

var values = Assert.IsType<Dictionary<string, object>>(formattedMessagePlaceholerValues.Value);
var values = Assert.IsType<Dictionary<string, object>>(formattedMessagePlaceholderValues.Value);

Assert.Collection(values,
propertyName =>
Expand Down Expand Up @@ -338,7 +338,7 @@ public async Task UseDefaultErrorMapperWithCustomExtendedDetails()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down Expand Up @@ -390,13 +390,13 @@ public async Task UseDefaultErrorMapperWithCustomExtendedDetails()
Assert.Equal(ValidationDefaults.ExtensionKeys.CustomStateKey, customState.Key);
Assert.Null(customState.Value);
},
formattedMessagePlaceholerValues =>
formattedMessagePlaceholderValues =>
{
Assert.Equal(
ValidationDefaults.ExtensionKeys.FormattedMessagePlaceholderValuesKey,
formattedMessagePlaceholerValues.Key);
formattedMessagePlaceholderValues.Key);

var values = Assert.IsType<Dictionary<string, object>>(formattedMessagePlaceholerValues.Value);
var values = Assert.IsType<Dictionary<string, object>>(formattedMessagePlaceholderValues.Value);

Assert.Collection(values,
propertyName =>
Expand Down Expand Up @@ -443,7 +443,7 @@ public async Task MultipleErrorMappers()
services.AddTransient<IValidator<TestPersonInput>, NotEmptyNameValidator>();
});

var result = Assert.IsType<QueryResult>(
var result = Assert.IsType<OperationResult>(
await executor.ExecuteAsync(TestSetup.Mutations.WithEmptyName));

result.AssertNullResult();
Expand Down
Loading

0 comments on commit 81f34f6

Please sign in to comment.