public void Initialize()
        {
            FulcrumApplicationHelper.UnitTestSetup(typeof(ServiceAuthenticationHelperVersion2Test).FullName);

            _httpClientMock = new Mock <IHttpClient>();

            ServiceAuthenticationHelper.HttpClient = _httpClientMock.Object;
            ServiceAuthenticationHelper.ClearCache();
            _authenticationHelper = new ServiceAuthenticationHelper();

            _clientConfigurations = new List <ClientConfiguration>
            {
                new ClientConfiguration
                {
                    Name           = ClientName,
                    Authentication = "Default"
                }
            };
            _authentications = new List <ClientAuthorizationSettings> {
                new ClientAuthorizationSettings
                {
                    Id = "Default",
                    AuthorizationType = ClientAuthorizationSettings.AuthorizationTypeEnum.Basic,
                    Username          = "******",
                    Password          = "******"
                }
            };
            CreateLeverConfiguration();
        }
        public void Initialize()
        {
            FulcrumApplicationHelper.UnitTestSetup(typeof(ServiceAuthenticationHelperVersion2Test).FullName);

            _httpClientMock = new Mock <IHttpClient>();

            ServiceAuthenticationHelper.HttpClient = _httpClientMock.Object;
            ServiceAuthenticationHelper.ClearCache();
            _authenticationHelper = new ServiceAuthenticationHelper();
        }
        public async Task PlatformServiceSuccess()
        {
            var          tokenRefresherMock = new Mock <ITokenRefresher>();
            const string platformJwt        = "platform-dancing";

            tokenRefresherMock
            .Setup(x => x.GetJwtTokenAsync(It.IsAny <CancellationToken>()))
            .ReturnsAsync(new AuthenticationToken {
                Type = "Bearer", AccessToken = platformJwt, ExpiresOn = DateTimeOffset.UtcNow.AddHours(1)
            });

            var helper = new ServiceAuthenticationHelper(tokenRefresherMock.Object);

            var auth = new ClientAuthorizationSettings
            {
                AuthorizationType = ClientAuthorizationSettings.AuthorizationTypeEnum.NexusPlatformService
            };
            var result = await helper.GetAuthorizationForClientAsync(Tenant, auth, ClientName);

            Assert.IsNotNull(result, JsonConvert.SerializeObject(auth, Formatting.Indented));
            Assert.AreEqual("bearer", result.Type.ToLowerInvariant());
            Assert.AreEqual(platformJwt, result.Token, result.Token);
        }