Skip to content

Handler Test Sample

成功結果をShouldlyで、下流との協調をNSubstituteで検証する例。固定TimeProviderと呼び出し元のCancellationTokenを同時に確認する。

TestRoomCreateCommands.Valid()はrepository固有のfixture/builderを表すplaceholderであり、このsource単体ではcompileしない。実際のtestでは近傍のfixtureを再利用するか、対象Value Objectのfactoryで有効なcommandを組み立てる。

このsampleは、時刻やcancellationに依存しないHandlerにも同じassertionを要求するものではない。

具体的なassertionの形はRoomCreateHandlerTests.csを読む。 規則とsampleが食い違う場合はSKILL.mdを正とする。