Skip to content

Commit

Permalink
Merge pull request #213 from jonorossi/changes_array_non_null
Browse files Browse the repository at this point in the history
Change DmlResponse<T>.Changes to default to an empty array
  • Loading branch information
mfenniak committed Apr 17, 2015
2 parents bbecf22 + 3de60cf commit d6f7c86
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

* Upgraded default RethinkDB protocol to version 0.4, which is only supported on RethinkDB 2.0 and above. To use rethinkdb-net with an earlier version of RethinkDB, change the connection's Protocol property to ```RethinkDb.Protocols.Version_0_3_Json.Instance```. [PR #211](https://github.com/mfenniak/rethinkdb-net/pull/211)

* Changed DmlResponse<T>.Changes to return an empty array rather than null if no changes were made. [PR #213](https://github.com/mfenniak/rethinkdb-net/pull/213)


## 0.10.0.0 (2015-04-14)

Expand Down
12 changes: 12 additions & 0 deletions rethinkdb-net-test/Integration/SingleObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ public void DeleteAndReturnValuesSequence()
Assert.That(resp.Changes[0].NewValue, Is.Null);
}

[Test]
public void DeleteAndReturnValuesSequenceNoChanges()
{
var resp = connection.Run(testTable.Filter(o => o.Name == "foo").DeleteAndReturnChanges());
Assert.That(resp, Is.Not.Null);
Assert.That(resp.FirstError, Is.Null);
Assert.That(resp.Deleted, Is.EqualTo(0));
Assert.That(resp.GeneratedKeys, Is.Null);
Assert.That(resp.Changes, Is.Not.Null);
Assert.That(resp.Changes, Has.Length.EqualTo(0));
}

[Test]
public void GetUpdateNumericAdd()
{
Expand Down
5 changes: 5 additions & 0 deletions rethinkdb-net/DmlResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public class DmlResponse
[DataContract]
public class DmlResponse<T> : DmlResponse
{
public DmlResponse()
{
Changes = new DmlResponseChange<T>[0];
}

[DataMember(Name = "changes")]
public DmlResponseChange<T>[] Changes;
}
Expand Down

0 comments on commit d6f7c86

Please sign in to comment.