Пример #1
0
        private void TestDeleteRecords()
        {
            try
            {
                _logger.Message("Testing DeleteRecords");
                //making the table
                List <Column> cols = new List <Column>();
                cols.Add(new Column(Column.DataType.Int, "Int", 100));
                cols.Add(new Column(Column.DataType.Double, "Double", 1));
                cols.Add(new Column(Column.DataType.Char, "String", 20));
                manager.CreateTable(dbName, tableName, cols);

                //making records to be inserted
                List <String> l1 = new List <string>();
                l1.Add("5");
                l1.Add("5.1");
                l1.Add("random1");
                Record r1 = new Record(l1);

                List <String> l2 = new List <string>();
                l2.Add("2048000");
                l2.Add("5.2");
                l2.Add("random2");
                Record r2 = new Record(l2);

                manager.InsertRecord(r1);
                manager.InsertRecord(r2);

                Dictionary <int, Record> recordsToDelete = new Dictionary <int, Record>();
                recordsToDelete.Add(12, r1);
                manager.DeleteRecords(recordsToDelete);

                List <Record> allRecords = manager.SelectRecords(null);
                Assert.AreEqual(1, allRecords.Count);
                AssertRecords(r2, allRecords[0]);
            }
            catch (Exception e)
            {
                _logger.Error(e.Message);
            }
            finally
            {
                manager.DropTable(dbName, tableName);
            }
        }