public async Task DeleteProductOptionShouldReturnSuccessWhenCommandSuccess()
        {
            // Arrange
            _mediator.Setup(e => e.Send(It.IsAny <DeleteProductOptionCommand>(), It.IsAny <CancellationToken>())).Returns(Task.CompletedTask);

            // Act
            var service = new ProductOptionService(_mapper.Object, _mediator.Object);

            var result = await service.DeleteProductOption(new DeleteProductOptionCommand(Guid.NewGuid()));

            // Assert
            Assert.AreEqual(result.IsSuccess, true);
        }
        public async Task DeleteProductOptionShouldReturnExeptionWhenCommandFail()
        {
            // Arrange
            _mediator.Setup(e => e.Send(It.IsAny <DeleteProductOptionCommand>(), It.IsAny <CancellationToken>())).ThrowsAsync(new Exception("Exception error!"));

            // Act
            var service = new ProductOptionService(_mapper.Object, _mediator.Object);

            var result = await service.DeleteProductOption(new DeleteProductOptionCommand(Guid.NewGuid()));

            // Assert
            Assert.AreEqual(result.IsSuccess, false);
            Assert.AreEqual(result.FailureReason, "Exception error!");
        }
        public async Task DeleteProductOptionShouldReturnGroupedValidationExeptionWhenCommandFail()
        {
            // Arrange
            var validationExceptions = new List <ValidationFailure>()
            {
                new ValidationFailure("p1", "error p1"),
                new ValidationFailure("p2", "error p2")
            };

            _mediator.Setup(e => e.Send(It.IsAny <DeleteProductOptionCommand>(), It.IsAny <CancellationToken>())).ThrowsAsync(new ValidationException(validationExceptions));

            // Act
            var service = new ProductOptionService(_mapper.Object, _mediator.Object);

            var result = await service.DeleteProductOption(new DeleteProductOptionCommand(Guid.NewGuid()));

            // Assert
            Assert.AreEqual(result.IsSuccess, false);
            Assert.IsTrue(result.FailureReason.Contains("error p1"));
            Assert.IsTrue(result.FailureReason.Contains("error p2"));
        }