public async Task PocoTest_Delete() { var item = new SamplePocoClass("column1", 1, new DateTime(2000, 01, 02)); var pocoTable = new PocoTable <SamplePocoClass>(); var connection = new ConnectionMemory(); // creat table, insert sample column, and then delete. await pocoTable.CreateTable(connection, true, CancellationToken.None); await pocoTable.ExecuteInsert(connection, item, CancellationToken.None); await pocoTable.ExecuteDelete(connection, item, CancellationToken.None); var reader = connection.GetTransformReader(pocoTable.Table); var moreRecords = await reader.ReadAsync(); Assert.False(moreRecords); }
public async Task PocoTest_Update() { var item = new SamplePocoClass("column1", 1, new DateTime(2000, 01, 02)); var updateItem = new SamplePocoClass("column1", 2, new DateTime(2000, 01, 03)); var pocoTable = new PocoTable <SamplePocoClass>(); var connection = new ConnectionMemory(); // creat table, insert sample column, and then update. await pocoTable.CreateTable(connection, true, CancellationToken.None); await pocoTable.ExecuteInsert(connection, item, CancellationToken.None); await pocoTable.ExecuteUpdate(connection, updateItem, CancellationToken.None); var reader = connection.GetTransformReader(pocoTable.Table); await reader.ReadAsync(); Assert.Equal("column1", reader["StringColumn"]); Assert.Equal(2, reader["IntColumn"]); Assert.Equal(new DateTime(2000, 01, 03), reader["DateColumn"]); }