public async Task AuthorisedAcessWithToken()
        {
            var encryptionManager = _serviceProvider.GetService <IEncryptionManager>();
            var requestBody       = new AuthenticationModel
            {
                Username = "******",
                Password = encryptionManager.EncryptAESPassword("pu")
            };
            var response = await _client.PostAsync("/api/Account/login", ContentHelper.GetStringContent(requestBody));

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);

            var loginResponseContent = await response.Content.ReadAsStringAsync();

            var loginResult = JsonSerializer.Deserialize <UserDetailDTO>(loginResponseContent);

            _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(JwtBearerDefaults.AuthenticationScheme, loginResult.Token);
            var weatherForecastContent = await _client.GetAsync("api/weatherforecast");

            Assert.AreEqual(HttpStatusCode.OK, weatherForecastContent.StatusCode);
        }
        public async Task ValidateToken()
        {
            var encryptionManager = _serviceProvider.GetService <IEncryptionManager>();
            var requestBody       = new AuthenticationModel
            {
                Username = "******",
                Password = encryptionManager.EncryptAESPassword("pu")
            };
            var response = await _client.PostAsync("/api/Account/login", ContentHelper.GetStringContent(requestBody));

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);

            var loginResponseContent = await response.Content.ReadAsStringAsync();

            var loginResult = JsonSerializer.Deserialize <UserDetailDTO>(loginResponseContent);

            var jwtAuthManager = _serviceProvider.GetService <IJWTTokenManager>();

            var(principal, jwtSecurityToken) = jwtAuthManager.DecodeJwtToken(loginResult.Token);
            Assert.IsNotNull(jwtSecurityToken);
            Assert.AreEqual(loginResult.Token, jwtSecurityToken.RawData);
            Assert.AreEqual(requestBody.Username, principal.Identity.Name);
            Assert.AreEqual("Privileged", principal.FindFirst(ClaimTypes.Role).Value);
        }