public async Task AddAsync_ThrowsArgumentNullException <TKey>(
            TKey defaultKey)
        {
            // Arrange
            var mockRepository = new Mock <IRepository <FakeEntity <TKey>, TKey> >(MockBehavior.Strict);

            var businessService = new FakeBusinessService <TKey>(
                _mockUnitOfWork.Object,
                _ => mockRepository.Object,
                _mockBusinessMapper.Object,
                _mockLogger.Object
                );

            // Act & Assert
            Assert.NotNull(defaultKey);

            var exception = await Assert.ThrowsAsync <ArgumentNullException>(
                () => businessService.AddAsync(null)
                );

            Assert.Equal("item", exception.ParamName);
        }
        public async Task AddAsync_Success <TKey>(
            TKey defaultKey,
            FakeAddDto item,
            FakeEntity <TKey> entity,
            FakeDto <TKey> expectedResult)
        {
            // Arrange
            Expression <Action <ILogger> > loggerExpressionAdd = x => x.Log(
                LogLevel.Information,
                0,
                It.Is <It.IsAnyType>((v, t) =>
                                     v.ToString() ==
                                     $"Add item: {item}"
                                     ),
                null,
                It.Is <Func <It.IsAnyType, Exception, string> >((v, t) => true)
                );

            _mockLogger.Setup(loggerExpressionAdd);

            _mockBusinessMapper
            .Setup(
                x => x.Map <FakeAddDto, FakeEntity <TKey> >(item)
                )
            .Returns(entity);

            var mockRepository = new Mock <IRepository <FakeEntity <TKey>, TKey> >(MockBehavior.Strict);

            mockRepository
            .Setup(
                x => x.InsertAsync(entity)
                )
            .ReturnsAsync(entity);

            Expression <Action <ILogger> > loggerExpressionSave = x => x.Log(
                LogLevel.Information,
                0,
                It.Is <It.IsAnyType>((v, t) =>
                                     v.ToString() ==
                                     "Save changes"
                                     ),
                null,
                It.Is <Func <It.IsAnyType, Exception, string> >((v, t) => true)
                );

            _mockLogger
            .Setup(x => x.IsEnabled(LogLevel.Information))
            .Returns(true);
            _mockLogger.Setup(loggerExpressionSave);

            _mockUnitOfWork
            .Setup(
                x => x.CommitAsync()
                )
            .ReturnsAsync(1);

            _mockBusinessMapper
            .Setup(
                x => x.Map <FakeEntity <TKey>, FakeDto <TKey> >(entity)
                )
            .Returns(expectedResult);

            var businessService = new FakeBusinessService <TKey>(
                _mockUnitOfWork.Object,
                _ => mockRepository.Object,
                _mockBusinessMapper.Object,
                _mockLogger.Object
                );

            // Act
            var result = await businessService.AddAsync(item);

            // Assert
            Assert.NotNull(defaultKey);

            _mockLogger.Verify(loggerExpressionAdd, Times.Once);

            _mockBusinessMapper
            .Verify(
                x => x.Map <FakeAddDto, FakeEntity <TKey> >(item),
                Times.Once
                );

            mockRepository
            .Verify(
                x => x.InsertAsync(entity),
                Times.Once
                );

            _mockLogger.Verify(loggerExpressionSave, Times.Once);

            _mockUnitOfWork
            .Verify(
                x => x.CommitAsync(),
                Times.Once
                );

            _mockBusinessMapper
            .Verify(
                x => x.Map <FakeEntity <TKey>, FakeDto <TKey> >(entity),
                Times.Once
                );

            Assert.Equal(expectedResult, result, new FakeDtoEqualityComparer <TKey>());
        }