Class AzureTestData

Namespace
XBullet.EasyTesting.Azure
Assembly
XBullet.EasyTesting.Azure.dll

Creates common Azure SDK response and paging values without a mocking framework.

public static class AzureTestData
Inheritance
AzureTestData
Inherited Members

Methods

AsyncPageable<T>(params Page<T>[])

Creates an asynchronous pageable sequence from pages.

public static AsyncPageable<T> AsyncPageable<T>(params Page<T>[] pages) where T : notnull

Parameters

pages Page<T>[]

The non-null ordered array of pages to expose. An empty array produces an empty pageable sequence. Page instances and their raw responses remain caller-owned.

Returns

AsyncPageable<T>

An asynchronous pageable sequence that yields the supplied pages in order.

Type Parameters

T

The non-null item type contained in the pages.

ModelResponse<T>(T, int, Action<TestAzureResponse>?)

Creates a model response with a configurable raw response.

public static Response<T> ModelResponse<T>(T value, int status = 200, Action<TestAzureResponse>? configure = null)

Parameters

value T

The model value to retain in the response; nullable values are accepted when T permits them.

status int

The raw HTTP status code from 100 through 599. The default is 200.

configure Action<TestAzureResponse>

An optional callback invoked synchronously once with the new raw response before it is wrapped. The callback may mutate the response but must not dispose it.

Returns

Response<T>

A model response containing value and the configured raw response. Dispose the raw response returned by GetRawResponse() after use.

Type Parameters

T

The type of model value carried by the response.

Page<T>(IEnumerable<T>, string?, Response?)

Creates one Azure result page.

public static Page<T> Page<T>(IEnumerable<T> values, string? continuationToken = null, Response? response = null) where T : notnull

Parameters

values IEnumerable<T>

A non-null sequence of page values. The sequence is enumerated immediately into a stable array.

continuationToken string

The token for retrieving the next page, or null for a terminal page.

response Response

The optional raw response associated with the page. When null, a new 200 response is created. A supplied response is retained, and its caller retains disposal ownership.

Returns

Page<T>

A page containing the materialized values, continuation token, and raw response.

Type Parameters

T

The non-null item type contained in the page.

Pageable<T>(params Page<T>[])

Creates a synchronous pageable sequence from pages.

public static Pageable<T> Pageable<T>(params Page<T>[] pages) where T : notnull

Parameters

pages Page<T>[]

The non-null ordered array of pages to expose. An empty array produces an empty pageable sequence. Page instances and their raw responses remain caller-owned.

Returns

Pageable<T>

A synchronous pageable sequence that yields the supplied pages in order.

Type Parameters

T

The non-null item type contained in the pages.

Response(int, string?)

Creates a raw Azure response.

public static TestAzureResponse Response(int status = 200, string? reasonPhrase = null)

Parameters

status int

The HTTP status code from 100 through 599. The default is 200.

reasonPhrase string

The reason phrase, or null to derive a standard phrase from status. Unknown status codes receive an empty phrase.

Returns

TestAzureResponse

A new mutable response that the caller owns and should dispose after use.