Skip to content

Loading…

Failing test case for Upsert on single column #179

Merged
merged 1 commit into from

2 participants

@theospears

Upsert fails with Ado when you only specify a single column. This patch contains a failing test case. I am undecided between whether this should be fixed by changing the behaviour of Update to allow updating no data, or by changing Upsert to only update when there is data to change, so have not included a fix.

@theospears theospears Test for doing upsert with only a single column
It is possible to do an upsert specifying only columns. This fails under
the AdoAdapter because its update assumes that at least one column to
update will be specified.
cd19ca9
@markrendle markrendle merged commit 365ba94 into markrendle:master
@markrendle
Owner

Making test pass now... thanks for the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2012
  1. @theospears

    Test for doing upsert with only a single column

    theospears committed
    It is possible to do an upsert specifying only columns. This fails under
    the AdoAdapter because its update assumes that at least one column to
    update will be specified.
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 Simple.Data.SqlTest/UpsertTests.cs
View
12 Simple.Data.SqlTest/UpsertTests.cs
@@ -401,5 +401,17 @@ public void TestUpsertWithVarBinaryMaxColumn()
blob = db.Blobs.FindById(1);
Assert.IsTrue(image.SequenceEqual(blob.Data));
}
+
+ [Test]
+ public void TestUpsertWithSingleArgumentAndExistingObject()
+ {
+ var db = DatabaseHelper.Open();
+
+ var actual = db.Users.UpsertById(Id: 1);
+
+ Assert.IsNotNull(actual);
+ Assert.AreEqual(1, actual.Id);
+ Assert.AreEqual("Ford Prefect", actual.Name);
+ }
}
}
Something went wrong with that request. Please try again.