タグ

Moqに関するtorimetalのブックマーク (3)

  • Moq : Mocking Framework for .NET - Qiita

    Moq は、テストダブル(=単体テスト用の代役オブジェクト)を簡単に作るためのライブラリです。 テストダブル 単体テストにおける問題のひとつとして、以下のようなことがあります。 テスト対象の依存オブジェクトが・・・ ネットワーク通信が必要 データベースアクセスが必要 など、外部に依存する場合、そのままでは単体テストを作りにくいです。 これを解決するために、実際のオブジェクトの代わりを用意します。 テスト用の代役オブジェクトをテストダブルと呼びます。テストダブルはその役割に応じて、スタブ、モック、フェイク、などと呼称されます(それらの違いについては、記事の主題と直接は関係がないので割愛します)。 典型的なテストダブルの実装 テストダブルはあくまで代役なので、物と同じ振る舞いはしません。単体テストが動けば良いと割り切ります。 物と同じ I/F を持つ。 通信などの振る舞いはしない。 特定

    Moq : Mocking Framework for .NET - Qiita
  • Quickstart

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

    Quickstart
  • Testing with a mocking framework - EF6

    When writing tests for your application it is often desirable to avoid hitting the database. Entity Framework allows you to achieve this by creating a context – with behavior defined by your tests – that makes use of in-memory data. Options for creating test doubles There are two different approaches that can be used to create an in-memory version of your context. Create your own test doubles – Th

    Testing with a mocking framework - EF6
  • 1