Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
Expand All @@ -19,11 +19,12 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="HotChocolate" Version="16.0.9"/>
<PackageReference Include="HotChocolate.AspNetCore" Version="16.0.9"/>
<PackageReference Include="HotChocolate.Data" Version="16.0.9"/>
<PackageReference Include="HotChocolate.Types.OffsetPagination" Version="16.0.9"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1"/>
<PackageReference Include="HotChocolate" Version="16.1.3"/>
<PackageReference Include="HotChocolate.AspNetCore" Version="16.1.3"/>
<PackageReference Include="HotChocolate.Data" Version="16.1.3"/>
<PackageReference Include="HotChocolate.Types.Analyzers" Version="16.1.3"/>
<PackageReference Include="HotChocolate.Types.OffsetPagination" Version="16.1.3"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageReference Include="NSubstitute" Version="5.3.0"/>
<PackageReference Include="Snapshooter.Xunit" Version="1.3.1"/>
<PackageReference Include="xunit" Version="2.9.3"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class Query
public string GetMessage() => "Message";

[UseOffsetPaging]
[UseSorting]
[UseFiltering]
[UseSorting]
public async Task<List<SampleResponse>> GetSampleResponses(
[Range(0, 100)] double percentage,
QueryContext<SampleResponse> queryContext,
Expand Down Expand Up @@ -195,4 +195,14 @@ public class SampleExtension
}
}.AsQueryable();
}

}

/// <summary>
/// Sample query methods that get registered via source generation.
/// </summary>
[QueryType]
public static partial class SourceGeneratorQuery
{
public static string? GetTextSourceGenerator([StringLength(5, MinimumLength = 3)] string? txt) => txt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -636,4 +636,23 @@
Assert.Equal(numberOfErrors, result.ExpectOperationResult().Errors?.Count);
result.ExpectOperationResult().ToJson().MatchSnapshot(new SnapshotNameExtension($"{description}.snap"));
}

[Theory]
[InlineData("""{ textSourceGenerator(txt: "a") }""", 1, "text_source_gen__min_length_3")]
[InlineData("""{ textSourceGenerator(txt: "abcdefg") }""", 1, "text_source_gen__max_length_5")]
public async Task Validation_Should_Return_Expected_Errors_From_Source_Generated_Fields(string query, int numberOfErrors, string description)

Check warning on line 643 in DataAnnotatedModelValidations.Tests/Pipeline/PipelineExecutionTests.cs

View workflow job for this annotation

GitHub Actions / build

Theory method 'Validation_Should_Return_Expected_Errors_From_Source_Generated_Fields' on test class 'PipelineExecutionTests' does not use parameter 'description'. Use the parameter, or remove the parameter and associated data. (https://xunit.net/xunit.analyzers/rules/xUnit1026)

Check warning on line 643 in DataAnnotatedModelValidations.Tests/Pipeline/PipelineExecutionTests.cs

View workflow job for this annotation

GitHub Actions / build

Theory method 'Validation_Should_Return_Expected_Errors_From_Source_Generated_Fields' on test class 'PipelineExecutionTests' does not use parameter 'description'. Use the parameter, or remove the parameter and associated data. (https://xunit.net/xunit.analyzers/rules/xUnit1026)

Check warning on line 643 in DataAnnotatedModelValidations.Tests/Pipeline/PipelineExecutionTests.cs

View workflow job for this annotation

GitHub Actions / build

Theory method 'Validation_Should_Return_Expected_Errors_From_Source_Generated_Fields' on test class 'PipelineExecutionTests' does not use parameter 'description'. Use the parameter, or remove the parameter and associated data. (https://xunit.net/xunit.analyzers/rules/xUnit1026)

Check warning on line 643 in DataAnnotatedModelValidations.Tests/Pipeline/PipelineExecutionTests.cs

View workflow job for this annotation

GitHub Actions / build

Theory method 'Validation_Should_Return_Expected_Errors_From_Source_Generated_Fields' on test class 'PipelineExecutionTests' does not use parameter 'description'. Use the parameter, or remove the parameter and associated data. (https://xunit.net/xunit.analyzers/rules/xUnit1026)

Check warning on line 643 in DataAnnotatedModelValidations.Tests/Pipeline/PipelineExecutionTests.cs

View workflow job for this annotation

GitHub Actions / build

Theory method 'Validation_Should_Return_Expected_Errors_From_Source_Generated_Fields' on test class 'PipelineExecutionTests' does not use parameter 'description'. Use the parameter, or remove the parameter and associated data. (https://xunit.net/xunit.analyzers/rules/xUnit1026)

Check warning on line 643 in DataAnnotatedModelValidations.Tests/Pipeline/PipelineExecutionTests.cs

View workflow job for this annotation

GitHub Actions / build

Theory method 'Validation_Should_Return_Expected_Errors_From_Source_Generated_Fields' on test class 'PipelineExecutionTests' does not use parameter 'description'. Use the parameter, or remove the parameter and associated data. (https://xunit.net/xunit.analyzers/rules/xUnit1026)
{
var result = await new ServiceCollection()
.AddGraphQLServer()
.AddSorting()
.AddFiltering()
.AddQueryContext()
.AddTestsTypes()
.AddDataAnnotationsValidator()
.ExecuteRequestAsync(query);


Assert.Equal(numberOfErrors, result.ExpectOperationResult().Errors?.Count);
//result.ExpectOperationResult().ToJson().MatchSnapshot(new SnapshotNameExtension($"{description}.snap"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type Query {
skip: Int
take: Int
percentage: Float!
order: [SampleResponseSortInput!] @cost(weight: "10")
where: SampleResponseFilterInput @cost(weight: "10")
order: [SampleResponseSortInput!] @cost(weight: "10")
): SampleResponsesCollectionSegment
@listSize(
assumedSize: 100
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
Expand All @@ -22,7 +22,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="HotChocolate.Types" Version="16.0.9"/>
<PackageReference Include="HotChocolate.Types" Version="16.1.3"/>
</ItemGroup>

<ItemGroup>
Expand Down
Loading