コード例 #1
0
        public void CanTruncateTable()
        {
            //create and insert data to test against
            var npgsqlCommand = DbConnection.CreateCommand();

            npgsqlCommand.CommandText = @"CREATE TABLE IF NOT EXISTS test (id int);";
            npgsqlCommand.ExecuteNonQuery();

            npgsqlCommand.CommandText = @"INSERT INTO test values (1);";
            npgsqlCommand.ExecuteNonQuery();

            CountRows().Should().Be(1);

            _databaseActions.TruncateTable(_contextMock.Object, "test");
            CountRows().Should().Be(0);
        }