An open API service indexing awesome lists of open source software.

https://github.com/verifytests/verify.cosmos

Adds Verify support to verify Azure CosmosDB.
https://github.com/verifytests/verify.cosmos

Last synced: 10 months ago
JSON representation

Adds Verify support to verify Azure CosmosDB.

Awesome Lists containing this project

README

          

# Verify.Cosmos

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://ci.appveyor.com/api/projects/status/89flq4nfrcmnykd0?svg=true)](https://ci.appveyor.com/project/SimonCropp/Verify-Cosmos)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.Cosmos.svg)](https://www.nuget.org/packages/Verify.Cosmos/)

Adds [Verify](https://github.com/VerifyTests/Verify) support to verify [Azure CosmosDB](https://docs.microsoft.com/en-us/azure/cosmos-db/).

**See [Milestones](../../milestones?state=closed) for release notes.**

## NuGet package

https://nuget.org/packages/Verify.Cosmos/

## Usage


```cs
[ModuleInitializer]
public static void Init() =>
VerifyCosmos.Initialize();
```
snippet source | anchor

### ItemResponse

A `ItemResponse` can be verified:


```cs
var response = await container.CreateItemAsync(
item,
new PartitionKey(item.LastName));
await Verify(response);
```
snippet source | anchor

Resulting in:


```txt
{
RequestCharge: 7.4,
Headers: {},
StatusCode: Created,
Resource: {
Id: Guid_1,
LastName: Andersen,
Address: {
State: WA,
County: King,
City: Seattle
}
}
}
```
snippet source | anchor

### FeedResponse

A `FeedResponse` can be verified:


```cs
using var iterator = container.GetItemLinqQueryable()
.Where(b => b.Id == item.Id)
.ToFeedIterator();
var feedResponse = await iterator.ReadNextAsync();
await Verify(feedResponse);
```
snippet source | anchor

Resulting in:


```txt
{
RequestCharge: 2.8,
Count: 1,
Headers: {},
StatusCode: OK,
Resource: [
{
Id: Guid_1,
LastName: Andersen,
Address: {
State: WA,
County: King,
City: Seattle
}
}
]
}
```
snippet source | anchor

## Icon

[Approval](https://thenounproject.com/term/approval/1759519/) designed by [Mike Zuidgeest](https://thenounproject.com/zuidgeest/) from [The Noun Project](https://thenounproject.com/).