これが私のコードです:
public class Program
{
static void Main(string[] args)
{
exec1();
Console.WriteLine("completed");
Console.Read();
}
public static void exec1()
{
using (IDBConnection conn = new SQLiteConnection("Data Source=test.db"))
{
conn.Open();
IDbCommand command = conn.CreateCommand();
command.CommandText = "select * from user";
IDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader[1]);
}
}
}
}
単体テスト:
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Program.exec1();
}
}
デバッグでうまく動作し、テストクラスを使用して実行するとエラーが発生します。
System.Data.SQLite.SQLiteException: SQL ロジック エラーまたは欠落しているデータベースにそのようなテーブルはありません: ユーザー