public async Task CreatePaymentTypeAsync_Returns_New_GetPaymentTypeDto()
        {
            //Arrange
            _fixture.MockPaymentTypeService.Setup(x => x.AddPaymentTypeAsync(It.IsAny <PaymentType>()))
            .ReturnsAsync(_fixture.CreatedNewPaymentType);

            var repository = new PaymentTypeRepository(AutoMapperSingleton.Mapper, _fixture.MockPaymentTypeService.Object);

            //Act
            var result = await repository.CreatePaymentTypeAsync(_fixture.CreatePaymentTypeDto);

            //Assert
            result.Should().BeOfType(typeof(GetPaymentTypeDto));
            result.Id.Should().Be(3);
            result.Name.Should().Be(_fixture.CreatePaymentTypeDto.Name);
            result.CreditPeriod.Should().Be(_fixture.CreatePaymentTypeDto.CreditPeriod);
        }
        public async Task CreatePaymentTypeAsync_Throws_ConflictException()
        {
            //Arrange
            _fixture.MockPaymentTypeService.Setup(x => x.GetPaymentTypeAsync(It.IsAny <Expression <Func <PaymentType, bool> > >()))
            .Returns <Expression <Func <PaymentType, bool> > >(expression => Task.FromResult(_fixture.PaymentTypes.AsQueryable().FirstOrDefault(expression)));

            var repository = new PaymentTypeRepository(AutoMapperSingleton.Mapper, _fixture.MockPaymentTypeService.Object);

            //Act
            var exception = await Assert.ThrowsAsync <RestException>(() => repository.CreatePaymentTypeAsync(new CreatePaymentTypeDto {
                Name = "Credit", CreditPeriod = 10
            }));

            //Assert
            exception.ErrorCode.Should().Be(HttpStatusCode.Conflict);
            exception.ErrorMessage.Should().Be("Payment type Credit is already available.");
            exception.ErrorType.Should().Be(HttpStatusCode.Conflict.ToString());
        }