Table of Contents

Namespace DynaSharp.Testing

Classes

FakeDynamoDb

An in-memory DynamoDB that speaks the wire protocol behind an HttpMessageHandler, for functional tests: a test sets up tables and items, runs the code under test through a real client, and reads the state back. No network, no container, no queued answers.

RecordedExchange

One request that a RecordingHandler sent and what came back: a response, or the exception that took its place.

RecordedRequest

An HTTP request that a StubHandler or a RecordingHandler received. It is a copy, so it stays readable after the client has disposed the request.

RecordedResponse

An HTTP response that a RecordingHandler received from DynamoDB. It is a copy, so it stays readable after the client has disposed the response.

RecordedStsRequest

A request that a StubSts received, read from the socket and decoded the way botocore encodes a form: RFC 3986 percent encoding, and a space as +.

RecordedTransactStep

One action of a recorded TransactWriteItems or TransactGetItems, from TransactItems, so that a test says what a transaction did instead of walking BodyJson: steps[0].ReadItem<EmailClaim>(), steps[2].ConditionText.

RecordingHandler

A DelegatingHandler that passes requests on to an inner handler and records each exchange, so a test can inspect the traffic of a real or emulated DynamoDB: the signed request and the response as they went over the wire. Pass it as HttpHandler.

StubClient

Creates a client for a test: over a handler of the test, in the fixed region us-east-1, with static fake credentials, one attempt per call and no attempt timeout. It reads nothing from the environment, so a test behaves the same on a machine that has AWS_REGION, AWS_ENDPOINT_URL or a shared AWS file and on one that has none.

StubHandler

An HttpMessageHandler that answers requests with canned responses instead of calling DynamoDB, and records every request. Pass it as HttpHandler to test code that uses a DynamoDbClient.

StubResponse

A canned HTTP response for a StubHandler.

StubSts

A stand-in for AWS STS on a port of this machine, for a test of code that gets its credentials from a web identity token, as a pod with IAM roles for service accounts does, or by assuming a role with other credentials. It answers AssumeRoleWithWebIdentity and AssumeRole with canned responses and records every request.

StubStsResponse

A canned answer of a StubSts to AssumeRoleWithWebIdentity or AssumeRole. Credentials(AwsCredentials) and Error(string, string?, HttpStatusCode?) cover what STS says; for anything else, such as a body that is not XML or a status of its own, a test sets StatusCode and Body: new StubStsResponse { StatusCode = HttpStatusCode.ServiceUnavailable, Body = "busy" }.

Enums

TransactStepKind

What a RecordedTransactStep does: the member its action sets on the wire.