public async Task HandleShouldReturnOk()
        {
            // Arrange
            var mapperMock = new Mock <IMapper>();

            mapperMock.Setup(x => x.Map <IEnumerable <DamageCodeModel> >(It.IsAny <object>())).Returns(Enumerable.Empty <DamageCodeModel>());
            var mapper = mapperMock.Object;

            var damageCodeReadRepositoryMock = new Mock <IDamageCodeReadRepository>();

            damageCodeReadRepositoryMock.Setup(x => x.ListAsync(It.IsAny <Expression <Func <DamageCode, bool> > >(), It.IsAny <int?>(), It.IsAny <int?>())).Returns(Task.FromResult(Enumerable.Empty <DamageCode>()));
            var damageCodeReadRepository = damageCodeReadRepositoryMock.Object;

            var damageCodeOdataProviderMock = new Mock <IDamageCodeOdataProvider>();

            damageCodeOdataProviderMock.Setup(x => x.GetFilterPredicate(It.IsAny <string>())).Returns((Expression <Func <DamageCode, bool> >)null);
            var damageCodeOdataProvider = damageCodeOdataProviderMock.Object;

            var query = new ListDamageCodeQuery(null, null, null);

            var handler = new ListDamageCodeQueryHandler(mapper, damageCodeReadRepository, damageCodeOdataProvider);

            // Act
            var result = await handler.Handle(query, CancellationToken.None);

            // Assert
            result.IsFailure.Should().BeFalse();
            result.Should().BeOfType(typeof(Result <DamageCodesModel>));
        }
        public async Task HandleShouldReturnFailWhenDatabaseSpecificErrorOccurs()
        {
            // Arrange
            var mapperMock = new Mock <IMapper>();

            mapperMock.Setup(x => x.Map <IEnumerable <DamageCodeModel> >(It.IsAny <object>())).Returns(Enumerable.Empty <DamageCodeModel>());
            var mapper = mapperMock.Object;

            var damageCodeReadRepositoryMock = new Mock <IDamageCodeReadRepository>();

            damageCodeReadRepositoryMock.Setup(x => x.ListAsync(It.IsAny <Expression <Func <DamageCode, bool> > >(), It.IsAny <int?>(), It.IsAny <int?>())).Throws <SomeDatabaseSpecificException>();
            var damageCodeReadRepository = damageCodeReadRepositoryMock.Object;

            var damageCodeOdataProviderMock = new Mock <IDamageCodeOdataProvider>();

            damageCodeOdataProviderMock.Setup(x => x.GetFilterPredicate(It.IsAny <string>())).Returns((Expression <Func <DamageCode, bool> >)null);
            var damageCodeOdataProvider = damageCodeOdataProviderMock.Object;

            var query = new ListDamageCodeQuery(null, null, null);

            var handler = new ListDamageCodeQueryHandler(mapper, damageCodeReadRepository, damageCodeOdataProvider);

            // Act
            var result = await handler.Handle(query, CancellationToken.None);

            // Assert
            result.IsFailure.Should().BeTrue();
            result.Failures.Should().OnlyContain(x => x.Message == CustomFailures.ListDamageCodeFailure);
        }