public async Task ListShouldReturnAllRecords()
        {
            // Arrange
            List <Tag> tags = new List <Tag>()
            {
                new Tag("tag1"), new Tag("tag2")
            };

            RepositoryHelper.ForInstruction.CreateInstruction(Guid.NewGuid(), "name-1", "description", "icon", "content", "image", "video", tags);
            RepositoryHelper.ForInstruction.CreateInstruction(Guid.NewGuid(), "name-2", "description", "icon", "content", "image", "video", tags);
            RepositoryHelper.ForInstruction.CreateInstruction(Guid.NewGuid(), "name-3", "description", "icon", "content", "image", "video", tags);

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

            // Assert
            result.Should().HaveCount(3);
        }
        public async Task <Result> Handle(ListInstructionQuery request, CancellationToken cancellationToken)
        {
            Result result;

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

                var instructionDomains = await _instructionReadRepository.ListAsync(filter, skip, top);

                var instructionModels = _mapper.Map <IEnumerable <InstructionModel> >(instructionDomains);
                var count             = instructionModels.Count();
                var sourcesModel      = new InstructionsModel {
                    Value = instructionModels, Count = count, NextLink = null
                };

                result = Result.Ok(sourcesModel);
            }
            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.ListInstructionFailure);
            }
            return(result);
        }