public async Task Handle_ValidCompany_ReturnsSpecyficType()
        {
            //Arrange
            var handler = new DeleteCompanyCommandHandler(_mockCompanyRepository.Object, _logger.Object, _mockCurrentUserService.Object);

            var command = new DeleteCompanyCommand()
            {
                Id = "1"
            };

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

            //Assert
            result.ShouldBeOfType <Unit>();
        }
        public void Handle_InvalidCompanyId_ThrowsNotFoundException()
        {
            //Arrange
            var handler = new DeleteCompanyCommandHandler(_mockCompanyRepository.Object, _logger.Object, _mockCurrentUserService.Object);

            var command = new DeleteCompanyCommand()
            {
                Id = "99"
            };

            //Act
            Func <Task> func = () => handler.Handle(command, CancellationToken.None);

            //Assert
            func.ShouldThrowAsync <NotFoundException>();
        }
        public void Handle_NotOwnerUser_ThrowsForbiddenAccessException()
        {
            //Arrange
            _mockCurrentUserService.SetupGet(x => x.UserId).Returns("user2");

            var handler = new DeleteCompanyCommandHandler(_mockCompanyRepository.Object, _logger.Object, _mockCurrentUserService.Object);

            var command = new DeleteCompanyCommand()
            {
                Id = "1"
            };

            //Act
            Func <Task> func = () => handler.Handle(command, CancellationToken.None);

            //Assert
            func.ShouldThrowAsync <ForbiddenAccessException>();
        }
        public async Task Handle_ValidCompany_DeletedFromCompanyRepository()
        {
            //Arrange
            var handler = new DeleteCompanyCommandHandler(_mockCompanyRepository.Object, _logger.Object, _mockCurrentUserService.Object);

            var allCompaniesBeforeCount = (await _mockCompanyRepository.Object.GetAllAsync()).Count;

            var command = new DeleteCompanyCommand()
            {
                Id = "1"
            };

            //Act
            await handler.Handle(command, CancellationToken.None);

            var allCompaniesAfterCount = await _mockCompanyRepository.Object.GetAllAsync();

            //Assert
            allCompaniesAfterCount.Count.ShouldBe(allCompaniesBeforeCount - 1);
        }