public async Task ApplyWhereClause_EmptyFilter_ReturnsNull() { var mockManager = new QueryMockManager(); var mapperMock = mockManager.ConfigureMapperMock <Hashtag, HashtagDto, HashtagFilterDto>(); var queryMock = mockManager.ConfigureQueryMock <Hashtag>(); var hashtagQueryObject = new HashtagQueryObject(mapperMock.Object, queryMock.Object); var filter = new HashtagFilterDto(); var temp = await hashtagQueryObject.ExecuteQuery(filter); Assert.AreEqual(null, mockManager.CapturedPredicate); }
public async Task ApplyWhereClause_FilterByTagString_ReturnsCorrectPredicate() { const string filteredTag = "Hashtag"; var mockManager = new QueryMockManager(); var expectedPredicate = new CompositePredicate(new List <IPredicate> { new SimplePredicate(nameof(Hashtag.Tag), ValueComparingOperator.Equal, filteredTag) }, LogicalOperator.AND); var mapperMock = mockManager.ConfigureMapperMock <Hashtag, HashtagDto, HashtagFilterDto>(); var queryMock = mockManager.ConfigureQueryMock <Hashtag>(); var hashtagQueryObject = new HashtagQueryObject(mapperMock.Object, queryMock.Object); var filter = new HashtagFilterDto { Tag = filteredTag }; var temp = await hashtagQueryObject.ExecuteQuery(filter); Assert.AreEqual(expectedPredicate, mockManager.CapturedPredicate); }