public async Task TestReplaceExactNonExistentRecordReturnsFalseDoesNotCreateRecord() { bool res = await PocoView.ReplaceAsync(null, GetPoco(1, "1"), GetPoco(1, "2")); Assert.IsFalse(res); Assert.IsNull(await PocoView.GetAsync(null, GetPoco(1))); }
public async Task TestReplaceExactExistingRecordWithSameValueReturnsTrueReplacesOld() { await PocoView.UpsertAsync(null, GetPoco(1, "1")); bool res = await PocoView.ReplaceAsync(null, GetPoco(1, "1"), GetPoco(1, "22")); Assert.IsTrue(res); Assert.AreEqual("22", (await PocoView.GetAsync(null, GetPoco(1))) !.Val); }
public async Task TestReplaceExactExistingRecordWithDifferentValueReturnsFalseDoesNotReplace() { await PocoView.UpsertAsync(null, GetPoco(1, "1")); bool res = await PocoView.ReplaceAsync(null, GetPoco(1, "11"), GetPoco(1, "22")); Assert.IsFalse(res); Assert.AreEqual("1", (await PocoView.GetAsync(null, GetPoco(1))) !.Val); }
public async Task TestReplaceExistingRecordReturnsTrueOverwrites() { await PocoView.UpsertAsync(null, GetPoco(1, "1")); bool res = await PocoView.ReplaceAsync(null, GetPoco(1, "2")); Assert.IsTrue(res); Assert.AreEqual("2", (await PocoView.GetAsync(null, GetPoco(1))) !.Val); }