public async Task ExecuteInvoke_WithBasicAuthorizationBad_ThrowException()
        {
            // Arrange
            _httpContext.Request.Headers["Authorization"] = $"Basic ";
            var middleware = new MiddlewareSecurityAuth(_next.Object, _configuration.Object);

            // Act
            Func <Task> task = async() => await middleware.Invoke(_httpContext);

            // Assert
            await task.Should().ThrowAsync <NotImplementedException>();
        }
        public async Task ExecuteInvoke_WithJwtAuthorizationGood_NotThrowException(string token, string issuer)
        {
            // Arrange
            _configurationSection.Setup(opt => opt.Value).Returns(token);
            _configuration.Setup(v => v["SECRET_KEY"]).Returns(_configurationSection.Object.Value);

            _configurationSection.Setup(opt => opt.Value).Returns(issuer);
            _configuration.Setup(v => v["ISSUER"]).Returns(_configurationSection.Object.Value);

            _httpContext.Request.Headers["Authorization"] = $"Bearer {GetJwt()}";

            var middlewae = new MiddlewareSecurityAuth(_next.Object, _configuration.Object);

            // Act
            Func <Task> task = async() => await middlewae.Invoke(_httpContext);

            // Assert
            await task.Should().NotThrowAsync();
        }
        public async Task ExecuteInvoke_WithBasicAuthorizationGood_NotThrowException(string username, string password)
        {
            // Arrange
            _configurationSection.Setup(opt => opt.Value).Returns(username);
            _configuration.Setup(v => v["USER"]).Returns(_configurationSection.Object.Value);

            _configurationSection.Setup(opt => opt.Value).Returns(password);
            _configuration.Setup(v => v["PASS"]).Returns(_configurationSection.Object.Value);

            string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password));

            _httpContext.Request.Headers["Authorization"] = $"Basic {credentials}";

            var middleware = new MiddlewareSecurityAuth(_next.Object, _configuration.Object);

            // Act
            Func <Task> task = async() => await middleware.Invoke(_httpContext);

            // Assert
            await task.Should().NotThrowAsync();
        }