測試Testing

您可能會想要使用近似連線至實際資料庫,而不實際進行資料庫 I/O 作業的方式來測試元件。You may want to test components using something that approximates connecting to the real database, without the overhead of actual database I/O operations.

有兩種主要的方式可以這麼做:There are two main options for doing this:

  • SQLite 記憶體內部模式 可讓您對行為類似關聯式資料庫的提供者寫入有效率的測試。SQLite in-memory mode allows you to write efficient tests against a provider that behaves like a relational database.
  • InMemory 提供者 是相依性最低的輕量型提供者,但行為不一定永遠都如同關聯式資料庫。The InMemory provider is a lightweight provider that has minimal dependencies, but does not always behave like a relational database.