public void Should_update_edge_with_generic_object()
{
Database.ClearTestCollection(Database.TestEdgeCollectionName);
var db = new ADatabase(Database.Alias);
var document = new Dictionary<string, object>()
.String("foo", "some string")
.Int("bar", 12345);
var createResult = db
.Document
.CreateEdge(Database.TestEdgeCollectionName, _documents[0].ID(), _documents[1].ID(), document);
var dummy = new Dummy();
dummy.Foo = "some other new string";
dummy.Bar = 54321;
dummy.Baz = 12345;
var updateResult = db
.Document
.Update(createResult.Value.ID(), dummy);
Assert.AreEqual(202, updateResult.StatusCode);
Assert.IsTrue(updateResult.Success);
Assert.IsTrue(updateResult.HasValue);
Assert.AreEqual(updateResult.Value.ID(), createResult.Value.ID());
Assert.AreEqual(updateResult.Value.Key(), createResult.Value.Key());
Assert.AreNotEqual(updateResult.Value.Rev(), createResult.Value.Rev());
var getResult = db
.Document
.Get(updateResult.Value.ID());
Assert.AreEqual(getResult.Value.ID(), updateResult.Value.ID());
Assert.AreEqual(getResult.Value.Key(), updateResult.Value.Key());
Assert.AreEqual(getResult.Value.Rev(), updateResult.Value.Rev());
Assert.AreNotEqual(getResult.Value.String("foo"), document.String("foo"));
Assert.AreEqual(getResult.Value.String("foo"), dummy.Foo);
Assert.AreNotEqual(getResult.Value.Int("bar"), document.Int("bar"));
Assert.AreEqual(getResult.Value.Int("bar"), dummy.Bar);
Assert.AreEqual(getResult.Value.Int("baz"), dummy.Baz);
}