Skip to content
Browse files

NCBC-234: Return CAS value with ExecuteGetJson

Change-Id: Ic8301aacf6c88d132f230e208878bb149824166f
Reviewed-on: http://review.couchbase.org/24977
Reviewed-by: Saakshi Manocha <saakshi.manocha@globallogic.com>
Tested-by: Saakshi Manocha <saakshi.manocha@globallogic.com>
  • Loading branch information...
1 parent ffa9975 commit cff3ff01b7264a674da4ef9343fe30b192105b5a @johnzablocki johnzablocki committed with saakshimanocha Mar 4, 2013
View
14 src/Couchbase.Tests/CouchbaseJsonExtensionTests.cs
@@ -123,12 +123,15 @@ public void When_Execute_Getting_City_With_Json_Get_Result_Value_Is_Returned_As_
var result = _Client.ExecuteStoreJson(StoreMode.Set, "city_Boston_MA", city);
Assert.That(result.Success, Is.True);
- var savedCity = _Client.ExecuteGetJson<City>("city_Boston_MA").Value;
+ var getResult = _Client.ExecuteGetJson<City>("city_Boston_MA");
+ Assert.That(getResult.Success, Is.True);
+ Assert.That(getResult.Cas, Is.GreaterThan(0).And.EqualTo(result.Cas));
+
+ Assert.That(getResult.Value, Is.InstanceOf<City>());
+ Assert.That(getResult.Value.Name, Is.StringMatching("Boston"));
+ Assert.That(getResult.Value.Type, Is.StringMatching("city"));
+ Assert.That(getResult.Value.State, Is.StringMatching("MA"));
- Assert.That(savedCity, Is.InstanceOf<City>());
- Assert.That(savedCity.Name, Is.StringMatching("Boston"));
- Assert.That(savedCity.Type, Is.StringMatching("city"));
- Assert.That(savedCity.State, Is.StringMatching("MA"));
}
/// <summary>
@@ -152,7 +155,6 @@ public void When_Getting_City_With_JsonGet_City_Is_Returned_As_City()
}
#endregion
-
private class City
{
[JsonProperty("name")]
View
1 src/Couchbase/Extensions/CouchbaseClientExtensions.cs
@@ -102,6 +102,7 @@ public static bool CasJson(this ICouchbaseClient client, StoreMode mode, string
var result = client.ExecuteGet<string>(key);
var retVal = new GetOperationResult<T>();
result.Combine(retVal);
+ retVal.Cas = result.Cas;
if (! result.Success)
{

0 comments on commit cff3ff0

Please sign in to comment.
Something went wrong with that request. Please try again.