public void UpdateTest2() { var expression = new UpdateExpression(new[] { Change.Add("list", new[] { "A", "B", "C" }), Change.Remove("deleted") }, new JsonObject(), new AttributeCollection()); Assert.Equal(@"REMOVE deleted ADD list :v0", expression.ToString()); }
public void UpdateTest3() { var expression = new UpdateExpression(new[] { Change.Replace("deleted", new DateTime(2015, 01, 01)), Change.Replace("colors", new [] { "red", "yellow", "blue" }), Change.Replace("version", 1) }, new JsonObject(), new AttributeCollection()); Assert.Equal(@"SET deleted = :v0, colors = :v1, version = :v2", expression.ToString()); }
public void UpdateTest4() { var expression = new UpdateExpression(new[] { Change.Replace("deleted", new DateTime(2015, 01, 01)), Change.Replace("colors", new [] { "red", "yellow", "blue" }), Change.Remove("deleted"), Change.Add("version", 1), Change.Replace("modified", DateTime.UtcNow) }, new JsonObject(), new AttributeCollection()); Assert.Equal(@"SET deleted = :v0, colors = :v1, modified = :v3 REMOVE deleted ADD version :v2", expression.ToString()); }
public void UpdateTest1() { var locked = DateTimeOffset.FromUnixTimeSeconds(1497212690).UtcDateTime; var attributeNames = new JsonObject(); var values = new AttributeCollection(); var expression = new UpdateExpression(new[] { Change.Replace("locked", locked) }, attributeNames, values); Assert.Equal(@"SET locked = :v0", expression.ToString()); Assert.Equal(1497212690L, values.Get(":v0").Value); }