public async Task ApplyWhereClause_EmptyFilter_ReturnsNull() { var mockManager = new QueryMockManager(); var mapperMock = mockManager.ConfigureMapperMock <PostReply, PostReplyDto, PostReplyFilterDto>(); var queryMock = mockManager.ConfigureQueryMock <PostReply>(); var postReplyQueryObject = new PostReplyQueryObject(mapperMock.Object, queryMock.Object); var filter = new PostReplyFilterDto(); var temp = await postReplyQueryObject.ExecuteQuery(filter); Assert.AreEqual(null, mockManager.CapturedPredicate); }
public async Task ApplyWhereClause_FilterByUsername_ReturnsCorrectSimplePredicate() { Guid filteredPostId = Guid.NewGuid(); var mockManager = new QueryMockManager(); var expectedPredicate = new SimplePredicate(nameof(PostReply.PostId), ValueComparingOperator.Equal, filteredPostId); var mapperMock = mockManager.ConfigureMapperMock <PostReply, PostReplyDto, PostReplyFilterDto>(); var queryMock = mockManager.ConfigureQueryMock <PostReply>(); var postReplyQueryObject = new PostReplyQueryObject(mapperMock.Object, queryMock.Object); var filter = new PostReplyFilterDto { PostId = filteredPostId }; var temp = await postReplyQueryObject.ExecuteQuery(filter); Assert.AreEqual(expectedPredicate, mockManager.CapturedPredicate); }