Skip to content

Support sending requests with CancellationToken #262

Closed
@bgold09

Description

@bgold09

When testing the full server stack, it can be useful to invoke an operation with a CancellationToken other than CancellationToken.None, i.e.

new CancellationToken(canceled: true)

This support can be introduced by modifying ServerTestBuilder:

  1. Add a private field CancellationToken cancellationToken to the class, which by default is initialized to CancellationToken.None to preserve the current behavior
  2. Add a method IServerTestBuilder WithCancellationToken(CancellationToken cancellationToken) which sets the private field
  3. In ServerTestBuilder +124, send the request with the value of this.cancellationToken

What are your thoughts on this idea and its potential implementation? I'd be happy to implement it myself; your library has already been very helpful in testing my WebApi application.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions