Ejemplo n.º 1
0
        public async Task UpdateDocumentAsync_WhenUpdatingValidObject_ThenObjectGetUpdatedSuccessfully()
        {
            // Arrange
            var cat = new Cat {
                Name = "Kitty"
            };
            await _cosmonautClient.CreateDocumentAsync(_databaseId, _collectionName, cat);

            // Act
            cat.Name = "MEGAKITTY";
            var updated = await _cosmonautClient.UpdateDocumentAsync(_databaseId, _collectionName, cat);

            // Assert
            updated.IsSuccess.Should().BeTrue();
            updated.Entity.Should().BeEquivalentTo(cat);
            updated.ResourceResponse.StatusCode.Should().Be(HttpStatusCode.OK);
            updated.ResourceResponse.Resource.GetPropertyValue <string>("Name").Should().Be("MEGAKITTY");
            updated.CosmosOperationStatus.Should().Be(CosmosOperationStatus.Success);
        }