-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expressionの値をテストする #2127
Labels
Comments
Merged
Repositoryメソッドに引数として渡すExpression の値が正確に検証できていないテストケース
※Expressionを引数に持つRepositoryメソッド 引数としてメソッドに渡されるExpressionの検証案
- public async Task<IReadOnlyList<CatalogItem>> FindAsync(Expression<Func<CatalogItem, bool>> specification, int skip, int take, CancellationToken cancellationToken = default)
+ public async Task<IReadOnlyList<CatalogItem>> FindAsync(long? brandId, long? categoryId, int skip, int take, CancellationToken cancellationToken = default)
|
Repositoryメソッドの引数として渡されるオブジェクトの検証方針
上記の方針により、以下のテストに関して新たにテストを追加する必要があると考えられる。
なお、以下のテストについては他のテストケースでカバーされているため新たなテストは実装不要と考えられる。
|
未実装のRepository呼び出しを検証するテスト
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
概要
現状の単体テストでは、リポジトリに渡される検索条件が単体テストの中で確認されていない。
例えば samples/Dressca/dressca-backend/tests/Dressca.UnitTests.ApplicationCore/ApplicationService/CatalogApplicationServiceTest.cs では以下のように実装されている。
Assertする際、検索条件の検証が
It.IsAny<Expression<Func<CatalogItem, bool>>>()
で行われており、適切に検索条件がテストされているとは言えない。検索条件が正しく設定されているかテストする必要がある。
詳細 / 機能詳細(オプション)
対象のテストを明らかにしてから着手する必要がある。
必要に応じて Sub-issue を作成して、少しずつ対処する。
完了条件
The text was updated successfully, but these errors were encountered: