public void Remove_DifferentCas_CasMismatch() { // Arrange var existingObject = new object(); var bucket = new MockBucket { { "key", existingObject } }; Assert.True(bucket.TryGetMock("key", out var mockDocument)); var originalCas = mockDocument.Cas; // Act var result = bucket.Remove("key", originalCas - 1); // Assert Assert.False(result.Success); Assert.Equal(ResponseStatus.DocumentMutationDetected, result.Status); Assert.True(bucket.TryGetMock("key", out mockDocument)); Assert.Equal(existingObject, mockDocument?.Content); }
public void Remove_NewDoc_KeyNotFound() { // Arrange var bucket = new MockBucket(); // Act var result = bucket.Remove("key"); // Assert Assert.False(result.Success); Assert.Equal(ResponseStatus.KeyNotFound, result.Status); }
public void Remove_ExistingDoc_Removes() { // Arrange var bucket = new MockBucket { { "key", new object() } }; // Act var result = bucket.Remove("key"); // Assert Assert.True(result.Success); Assert.Equal(ResponseStatus.Success, result.Status); Assert.False(bucket.TryGetMock("key", out _)); }