I have two C # projects, Model and ModelTest. The model consists of ActiveRecord objects (wrapper around Hibernate). In ModelTest, I created a simple unit test:
[TestClass] public class UnitTest1 { [TestInitialize] public void Init() { Model.Init(); Model.CreateSchema(); } [TestMethod] public void TestMethod1() { } }
Model.Init () registers all types of model assembly using ActiveRecord. Model.CreateSchema () wraps ActiveRecordStarter.CreateSchema (), which calls CreateSchema () NHibernate.
This code works fine if I run the unit test, but it fails if I "debug" the unit test. In debug mode, an exception is thrown in CreateSchema ():
NpgsqlException: 'ERROR: 42P01: table "user" does not exist'
The exception appears to be during a SQL call to "drop table user cascade", which obviously does not work if the database is empty before running the test. I assume that the crash is always sent before creating a new table.
Does Npgsql work in debug mode with respect to the result of a drop request?
source share