GraphQL.AspNet.TestFramework
1.3.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package GraphQL.AspNet.TestFramework --version 1.3.0
NuGet\Install-Package GraphQL.AspNet.TestFramework -Version 1.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GraphQL.AspNet.TestFramework" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GraphQL.AspNet.TestFramework --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GraphQL.AspNet.TestFramework, 1.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GraphQL.AspNet.TestFramework as a Cake Addin #addin nuget:?package=GraphQL.AspNet.TestFramework&version=1.3.0 // Install GraphQL.AspNet.TestFramework as a Cake Tool #tool nuget:?package=GraphQL.AspNet.TestFramework&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
GraphQL ASP.NET Test Framework
General Documentation
Test Framework Documentation
GraphQL ASP.NET is a fully featured graphql library that utilizes a controller/action programming model similar to ASP.NET. This library is a 1st party test framework to allow you quickly spin up a test server and test your controller methods in an isolated manner.
// Excute a simple Test against a controller method
public async Task WhenGivenTwoNumbers_TheSumIsReturned()
{
// **Arrange**
var expectedOutput = @"{
""data"" : {
""addTwoNumbers"": 13
}
}"
// generate a 'server' of a schema with one controller
var server = new TestServerBuilder()
.AddController<CalculatorController>()
.Build();
// build a request to send to the server
var queryBuilder = server.CreateQueryContextBuilder();
queryBuilder.AddQueryText("query { addTwoNumbers(num1: 5, num2: 8) }");
// **Act**
var jsonResult = await server.RenderResult(queryBuilder);
// **Assert**
CommonAssertions.AreEqualJsonStrings(expectedOutput, jsonResult);
}
Supported Features
- Setup specific authentication and authorization scenarios to test security.
- Mock and inject any dependencies for your controllers.
- Interrogate the
IQueryExecutionResult
object for specific data, messages, metrics or thrown exceptions. - Render the resultant json document that would be sent to the requestor.
Read the documentation for full details
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- GraphQL.AspNet (>= 1.3.0)
- NSubstitute (>= 5.0.0)
- System.Collections.Immutable (>= 1.6.0)
- System.ComponentModel.Annotations (>= 4.3.0)
- System.Drawing.Common (>= 4.7.2)
- System.Runtime.Caching (>= 4.6.0)
- System.Text.Encodings.Web (>= 4.7.2)
- System.Text.Json (>= 4.6.0)
- System.Text.RegularExpressions (>= 4.3.1)
-
net7.0
- GraphQL.AspNet (>= 1.3.0)
- NSubstitute (>= 5.0.0)
- System.Collections.Immutable (>= 1.6.0)
- System.ComponentModel.Annotations (>= 4.3.0)
- System.Drawing.Common (>= 4.7.2)
- System.Runtime.Caching (>= 4.6.0)
- System.Text.Encodings.Web (>= 4.7.2)
- System.Text.Json (>= 4.6.0)
- System.Text.RegularExpressions (>= 4.3.1)
-
net8.0
- GraphQL.AspNet (>= 1.3.0)
- NSubstitute (>= 5.0.0)
- System.Collections.Immutable (>= 1.6.0)
- System.ComponentModel.Annotations (>= 4.3.0)
- System.Drawing.Common (>= 4.7.2)
- System.Runtime.Caching (>= 4.6.0)
- System.Text.Encodings.Web (>= 4.7.2)
- System.Text.Json (>= 4.6.0)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.