Skip to content

Commit

Permalink
finalizing property names and types
Browse files Browse the repository at this point in the history
  • Loading branch information
pgautier404 committed Oct 6, 2022
1 parent 61d9721 commit a94c2ef
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The preferred way of interpreting the return values from the Momento .NET method
CacheGetResponse getResponse = await client.GetAsync(CACHE_NAME, KEY);
if (getResponse is CacheGetResponse.Hit hitResponse)
{
Console.WriteLine($"\nLookedup value: {hitResponse.String()}, Stored value: {VALUE}");
Console.WriteLine($"\nLooked up value: {hitResponse.ValueString}, Stored value: {VALUE}");
} else {
// you can handle other cases via pattern matching in `else if` blocks, or a default case
// via the `else` block. For each return value your IDE should be able to give you code
Expand Down
2 changes: 1 addition & 1 deletion src/Momento.Sdk/ISimpleCacheClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public interface ISimpleCacheClient : IDisposable
/// <code>
/// if (response is CacheGetResponse.Hit hitResponse)
/// {
/// return hitResponse.StringValue;
/// return hitResponse.ValueString;
/// } else if (response is CacheGetResponse.Error errorResponse)
/// {
/// // handle error as appropriate
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheGetResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Momento.Sdk.Responses;
/// <code>
/// if (response is CacheGetResponse.Hit hitResponse)
/// {
/// return hitResponse.StringValue;
/// return hitResponse.ValueString;
/// } else if (response is CacheGetResponse.Error errorResponse)
/// {
/// // handle error as appropriate
Expand All @@ -41,22 +41,22 @@ public Hit(_GetResponse response)
/// <summary>
/// Value from the cache as a byte array.
/// </summary>
public byte[] ByteArrayValue
public byte[] ValueByteArray
{
get => value.ToByteArray();
}

/// <summary>
/// Value from the cache as a string.
/// </summary>
public string StringValue
public string ValueString
{
get => value.ToStringUtf8();
}

public override string ToString()
{
return $"{base.ToString()}: {this.StringValue}";
return $"{base.ToString()}: {this.ValueString}";
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Integration/Momento.Sdk.Tests/SimpleCacheDataTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task SetAsync_KeyIsByteArrayValueIsByteArray_HappyPath()
CacheGetResponse response = await client.GetAsync(cacheName, key);
Assert.True(response is CacheGetResponse.Hit);
var goodResponse = (CacheGetResponse.Hit)response;
byte[]? setValue = goodResponse.ByteArrayValue;
byte[] setValue = goodResponse.ValueByteArray;
Assert.Equal(value, setValue);

key = Utils.NewGuidByteArray();
Expand All @@ -55,7 +55,7 @@ public async Task SetAsync_KeyIsByteArrayValueIsByteArray_HappyPath()
response = await client.GetAsync(cacheName, key);
Assert.True(response is CacheGetResponse.Hit);
goodResponse = (CacheGetResponse.Hit)response;
setValue = goodResponse.ByteArrayValue;
setValue = goodResponse.ValueByteArray;
Assert.Equal(value, setValue);
}

Expand Down Expand Up @@ -97,7 +97,7 @@ public async Task SetAsync_KeyIsStringValueIsString_HappyPath()
CacheGetResponse response = await client.GetAsync(cacheName, key);
Assert.True(response is CacheGetResponse.Hit);
var goodResponse = (CacheGetResponse.Hit)response;
string? setValue = goodResponse.StringValue;
string setValue = goodResponse.ValueString;
Assert.Equal(value, setValue);

// Set with TTL
Expand All @@ -109,7 +109,7 @@ public async Task SetAsync_KeyIsStringValueIsString_HappyPath()
response = await client.GetAsync(cacheName, key);
Assert.True(response is CacheGetResponse.Hit);
goodResponse = (CacheGetResponse.Hit)response;
setValue = goodResponse.StringValue;
setValue = goodResponse.ValueString;
Assert.Equal(value, setValue);
}

Expand Down Expand Up @@ -150,7 +150,7 @@ public async Task SetAsync_KeyIsStringValueIsByteArray_HappyPath()

CacheGetResponse response = await client.GetAsync(cacheName, key);
var goodResponse = (CacheGetResponse.Hit)response;
byte[]? setValue = goodResponse.ByteArrayValue;
byte[] setValue = goodResponse.ValueByteArray;
Assert.Equal(value, setValue);

// Set with TTL
Expand All @@ -161,7 +161,7 @@ public async Task SetAsync_KeyIsStringValueIsByteArray_HappyPath()

response = await client.GetAsync(cacheName, key);
var anotherGoodResponse = (CacheGetResponse.Hit)response;
byte[]? anotherSetValue = anotherGoodResponse.ByteArrayValue;
byte[] anotherSetValue = anotherGoodResponse.ValueByteArray;
Assert.Equal(value, anotherSetValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public void CorrectResultMapping()
ByteString body = ByteString.CopyFromUtf8(cacheBody);
_GetResponse serverResponseHit = new _GetResponse() { CacheBody = body, Result = ECacheResult.Hit };
CacheGetResponse.Hit responseHit = new CacheGetResponse.Hit(serverResponseHit);
Assert.Equal(cacheBody, responseHit.StringValue);
Assert.Equal(cacheBody, responseHit.ValueString);
}
}

0 comments on commit a94c2ef

Please sign in to comment.