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.
- Host: GitHub
- URL: https://github.com/verifytests/verify.cosmos
- Owner: VerifyTests
- License: mit
- Created: 2021-01-20T09:05:40.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T16:26:05.000Z (about 2 years ago)
- Last Synced: 2024-05-01T09:37:51.794Z (about 2 years ago)
- Language: C#
- Homepage:
- Size: 343 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
Awesome Lists containing this project
README
#
Verify.Cosmos
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/Verify-Cosmos)
[](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/).