Skip to content

Commit

Permalink
chore: rename ListRemoveAll to ListRemoveValue (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
malandis authored Sep 2, 2022
1 parent 4896da2 commit 8264db8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions src/Momento.Sdk/Incubating/Internal/ScsDataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,17 +447,17 @@ public async Task<CacheListFetchResponse> ListFetchAsync(string cacheName, strin
return new CacheListFetchResponse(response);
}

public async Task<CacheListRemoveAllResponse> ListRemoveAllAsync(string cacheName, string listName, byte[] value)
public async Task<CacheListRemoveAllResponse> ListRemoveValueAsync(string cacheName, string listName, byte[] value)
{
return await ListRemoveAllAsync(cacheName, listName, value.ToByteString());
return await ListRemoveValueAsync(cacheName, listName, value.ToByteString());
}

public async Task<CacheListRemoveAllResponse> ListRemoveAllAsync(string cacheName, string listName, string value)
public async Task<CacheListRemoveAllResponse> ListRemoveValueAsync(string cacheName, string listName, string value)
{
return await ListRemoveAllAsync(cacheName, listName, value.ToByteString());
return await ListRemoveValueAsync(cacheName, listName, value.ToByteString());
}

public async Task<CacheListRemoveAllResponse> ListRemoveAllAsync(string cacheName, string listName, ByteString value)
public async Task<CacheListRemoveAllResponse> ListRemoveValueAsync(string cacheName, string listName, ByteString value)
{
_ListRemoveRequest request = new()
{
Expand Down
10 changes: 5 additions & 5 deletions src/Momento.Sdk/Incubating/SimpleCacheClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,23 +639,23 @@ public async Task<CacheListFetchResponse> ListFetchAsync(string cacheName, strin
/// <param name="value">The value to completely remove from the list.</param>
/// <returns>Task representing the result of the cache operation.</returns>
/// <exception cref="ArgumentNullException">Any of <paramref name="cacheName"/>, <paramref name="listName"/>, or <paramref name="value"/> is <see langword="null"/>.</exception>
public async Task<CacheListRemoveAllResponse> ListRemoveAllAsync(string cacheName, string listName, byte[] value)
public async Task<CacheListRemoveAllResponse> ListRemoveValueAsync(string cacheName, string listName, byte[] value)
{
Utils.ArgumentNotNull(cacheName, nameof(cacheName));
Utils.ArgumentNotNull(listName, nameof(listName));
Utils.ArgumentNotNull(value, nameof(value));

return await this.dataClient.ListRemoveAllAsync(cacheName, listName, value);
return await this.dataClient.ListRemoveValueAsync(cacheName, listName, value);
}

/// <inheritdoc cref="ListRemoveAllAsync(string, string, byte[])"/>
public async Task<CacheListRemoveAllResponse> ListRemoveAllAsync(string cacheName, string listName, string value)
/// <inheritdoc cref="ListRemoveValueAsync(string, string, byte[])"/>
public async Task<CacheListRemoveAllResponse> ListRemoveValueAsync(string cacheName, string listName, string value)
{
Utils.ArgumentNotNull(cacheName, nameof(cacheName));
Utils.ArgumentNotNull(listName, nameof(listName));
Utils.ArgumentNotNull(value, nameof(value));

return await this.dataClient.ListRemoveAllAsync(cacheName, listName, value);
return await this.dataClient.ListRemoveValueAsync(cacheName, listName, value);
}

/// <inheritdoc />
Expand Down
32 changes: 16 additions & 16 deletions tests/Integration/Momento.Sdk.Incubating.Tests/ListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,13 @@ public async Task ListFetchAsync_HasContentByteArray_HappyPath()
[InlineData(null, "my-list", new byte[] { 0x00 })]
[InlineData("cache", null, new byte[] { 0x00 })]
[InlineData("cache", "my-list", null)]
public async Task ListRemoveAllAsync_NullChecksByteArray_ThrowsException(string cacheName, string listName, byte[] value)
public async Task ListRemoveValueAsync_NullChecksByteArray_ThrowsException(string cacheName, string listName, byte[] value)
{
await Assert.ThrowsAsync<ArgumentNullException>(async () => await client.ListRemoveAllAsync(cacheName, listName, value));
await Assert.ThrowsAsync<ArgumentNullException>(async () => await client.ListRemoveValueAsync(cacheName, listName, value));
}

[Fact]
public async Task ListRemoveAllAsync_ValueIsByteArray_HappyPath()
public async Task ListRemoveValueAsync_ValueIsByteArray_HappyPath()
{
var listName = Utils.NewGuidString();
var list = new List<byte[]>() { Utils.NewGuidByteArray(), Utils.NewGuidByteArray(), Utils.NewGuidByteArray() };
Expand All @@ -535,15 +535,15 @@ public async Task ListRemoveAllAsync_ValueIsByteArray_HappyPath()
await client.ListPushBackAsync(cacheName, listName, valueOfInterest, false);

// Remove value of interest
await client.ListRemoveAllAsync(cacheName, listName, valueOfInterest);
await client.ListRemoveValueAsync(cacheName, listName, valueOfInterest);

// Test not there
var cachedList = (await client.ListFetchAsync(cacheName, listName)).ByteArrayList!;
Assert.True(list.ListEquals(cachedList));
}

[Fact]
public async Task ListRemoveAllAsync_ValueIsByteArray_ValueNotPresentNoop()
public async Task ListRemoveValueAsync_ValueIsByteArray_ValueNotPresentNoop()
{
var listName = Utils.NewGuidString();
var list = new List<byte[]>() { Utils.NewGuidByteArray(), Utils.NewGuidByteArray(), Utils.NewGuidByteArray() };
Expand All @@ -553,32 +553,32 @@ public async Task ListRemoveAllAsync_ValueIsByteArray_ValueNotPresentNoop()
await client.ListPushBackAsync(cacheName, listName, value, false);
}

await client.ListRemoveAllAsync(cacheName, listName, Utils.NewGuidByteArray());
await client.ListRemoveValueAsync(cacheName, listName, Utils.NewGuidByteArray());

var cachedList = (await client.ListFetchAsync(cacheName, listName)).ByteArrayList!;
Assert.True(list.ListEquals(cachedList));
}

[Fact]
public async Task ListRemoveAllAsync_ValueIsByteArray_ListNotThereNoop()
public async Task ListRemoveValueAsync_ValueIsByteArray_ListNotThereNoop()
{
var listName = Utils.NewGuidString();
Assert.Equal(CacheGetStatus.MISS, (await client.ListFetchAsync(cacheName, listName)).Status);
await client.ListRemoveAllAsync(cacheName, listName, Utils.NewGuidByteArray());
await client.ListRemoveValueAsync(cacheName, listName, Utils.NewGuidByteArray());
Assert.Equal(CacheGetStatus.MISS, (await client.ListFetchAsync(cacheName, listName)).Status);
}

[Theory]
[InlineData(null, "my-list", "")]
[InlineData("cache", null, "")]
[InlineData("cache", "my-list", null)]
public async Task ListRemoveAllAsync_NullChecksString_ThrowsException(string cacheName, string listName, string value)
public async Task ListRemoveValueAsync_NullChecksString_ThrowsException(string cacheName, string listName, string value)
{
await Assert.ThrowsAsync<ArgumentNullException>(async () => await client.ListRemoveAllAsync(cacheName, listName, value));
await Assert.ThrowsAsync<ArgumentNullException>(async () => await client.ListRemoveValueAsync(cacheName, listName, value));
}

[Fact]
public async Task ListRemoveAllAsync_ValueIsString_HappyPath()
public async Task ListRemoveValueAsync_ValueIsString_HappyPath()
{
var listName = Utils.NewGuidString();
var list = new List<string>() { Utils.NewGuidString(), Utils.NewGuidString(), Utils.NewGuidString() };
Expand All @@ -594,15 +594,15 @@ public async Task ListRemoveAllAsync_ValueIsString_HappyPath()
await client.ListPushBackAsync(cacheName, listName, valueOfInterest, false);

// Remove value of interest
await client.ListRemoveAllAsync(cacheName, listName, valueOfInterest);
await client.ListRemoveValueAsync(cacheName, listName, valueOfInterest);

// Test not there
var cachedList = (await client.ListFetchAsync(cacheName, listName)).StringList()!;
Assert.True(list.SequenceEqual(cachedList));
}

[Fact]
public async Task ListRemoveAllAsync_ValueIsByteString_ValueNotPresentNoop()
public async Task ListRemoveValueAsync_ValueIsByteString_ValueNotPresentNoop()
{
var listName = Utils.NewGuidString();
var list = new List<string>() { Utils.NewGuidString(), Utils.NewGuidString(), Utils.NewGuidString() };
Expand All @@ -612,18 +612,18 @@ public async Task ListRemoveAllAsync_ValueIsByteString_ValueNotPresentNoop()
await client.ListPushBackAsync(cacheName, listName, value, false);
}

await client.ListRemoveAllAsync(cacheName, listName, Utils.NewGuidString());
await client.ListRemoveValueAsync(cacheName, listName, Utils.NewGuidString());

var cachedList = (await client.ListFetchAsync(cacheName, listName)).StringList()!;
Assert.True(list.SequenceEqual(cachedList));
}

[Fact]
public async Task ListRemoveAllAsync_ValueIsString_ListNotThereNoop()
public async Task ListRemoveValueAsync_ValueIsString_ListNotThereNoop()
{
var listName = Utils.NewGuidString();
Assert.Equal(CacheGetStatus.MISS, (await client.ListFetchAsync(cacheName, listName)).Status);
await client.ListRemoveAllAsync(cacheName, listName, Utils.NewGuidString());
await client.ListRemoveValueAsync(cacheName, listName, Utils.NewGuidString());
Assert.Equal(CacheGetStatus.MISS, (await client.ListFetchAsync(cacheName, listName)).Status);
}
}

0 comments on commit 8264db8

Please sign in to comment.