public async Task <Result> Handle(ListRemarkQuery request, CancellationToken cancellationToken)
        {
            Result result;

            try
            {
                Expression <Func <Remark, bool> > filter = null;
                int?skip = request.Skip.ToNullableInt();
                int?top  = request.Top.ToNullableInt();

                var remarkDomains = await _remarkReadRepository.ListAsync(filter, skip, top);

                var remarkModels = _mapper.Map <IEnumerable <RemarkModel> >(remarkDomains);
                var count        = remarkModels.Count();
                var remarksModel = new RemarksModel {
                    Value = remarkModels, Count = count, NextLink = null
                };

                result = Result.Ok(remarksModel);
            }
            catch (FilterODataException)
            {
                result = Result.Fail(new System.Collections.Generic.List <Failure>()
                {
                    new HandlerFault()
                    {
                        Code    = HandlerFaultCode.InvalidQueryFilter.Name,
                        Message = HandlerFailures.InvalidQueryFilter,
                        Target  = "$filter"
                    }
                }
                                     );
            }
            catch
            {
                result = Result.Fail(CustomFailures.ListRemarkFailure);
            }

            return(result);
        }
        public async Task ListShouldReturnAllRecords()
        {
            // Arrange
            RemarkIcon           icon           = new RemarkIcon(Guid.NewGuid());
            List <DefaultRemark> defaultRemarks = new List <DefaultRemark>()
            {
                new DefaultRemark("defaultRemark1"), new DefaultRemark("defaultRemark2")
            };
            List <Tag> tags = new List <Tag>()
            {
                new Tag("tag1"), new Tag("tag2")
            };

            RepositoryHelper.ForRemark.CreateRemark(Guid.NewGuid(), "name-1", "nameOnApplication", "description", icon, defaultRemarks, tags);
            RepositoryHelper.ForRemark.CreateRemark(Guid.NewGuid(), "name-2", "nameOnApplication", "description", icon, defaultRemarks, tags);
            RepositoryHelper.ForRemark.CreateRemark(Guid.NewGuid(), "name-3", "nameOnApplication", "description", icon, defaultRemarks, tags);

            // Act
            var result = await _repository.ListAsync(null, null, null);

            // Assert
            result.Should().HaveCount(3);
        }