public void _Updates_Typed_Record() { _setup.CheckSetUp(); var model = new SQLServerTable <Transaction>(_connectionStringName, _testTableName, _tablePkColumn); var newRecord = new Transaction() { Amount = 100, Comment = "I Overspent!", Identifier = "XXX" }; // Dump the new record in as an UPDATE: model.Insert(newRecord); int recordPk = newRecord.TransactionId; string newValue = "I changed it!"; newRecord.Identifier = newValue; int updated = model.Update(newRecord); newRecord = model.Find <Transaction>(recordPk); Assert.True(updated > 0 && newRecord.Identifier == newValue); }
public void _Updates_Anonymous_Record() { _setup.CheckSetUp(); var model = new SQLServerTable <Transaction>(_connectionStringName, _testTableName, _tablePkColumn); var newRecord = new Transaction { Amount = 100, Comment = "I Anonymously Overspent!", Identifier = "YYZ" // Bah da-bah-bah-bah da bah-bah-bah-bah da da . . . }; var result = model.Insert(newRecord); int recordPk = result.TransactionId; var updateThis = new { Identifier = "I changed it!" }; int updated = model.Update(updateThis, recordPk); // Retrieve the updated item from the Db: var updatedRecord = model.Find <Transaction>(recordPk); Assert.True(updated > 0 && updatedRecord.Identifier == updateThis.Identifier); }