public async Task GetFilteredByTypeReturnsItems() { //Arrange _goodRepositoryMock .Setup(x => x.FilterIncludeAsync(It.IsAny <Expression <Func <GoodEntity, bool> > >(), It.IsAny <string[]>())) .ReturnsAsync((Expression <Func <GoodEntity, bool> > x, string [] y) => _fakeGoodsStore.Where(x.Compile()).ToList()); _mapperMock .Setup(x => x.Map <IEnumerable <GoodDto> >(It.IsAny <IEnumerable <GoodEntity> >())) .Returns((IEnumerable <GoodEntity> x) => x.Select(y => new GoodDto() { Name = y.Name, GoodTypeId = y.GoodTypeId })); var typeId = 10; //Act var resultGoods = await _goodService.GetFilteredByTypeAsync(typeId); //Assert Assert.IsTrue(resultGoods.All(x => x.GoodTypeId == typeId)); Assert.AreEqual( _fakeGoodsStore.Count(x => x.GoodTypeId == typeId), resultGoods.Count()); }