Exemplo n.º 1
0
        public void GetAppSettingsWorks()
        {
            IAnonymous client = this.GetAnonymousClient()
                                .RoutingTo(TestingEndpointProvider.Default)
                                .GetClient();
            string         recognizedApiKey = DelegatedAppIdentity.Master.ApiKey;
            AppMovSettings appMovSettings   = client.Settings.GetAppSettings(recognizedApiKey);

            CollectionAssert.IsNotEmpty(appMovSettings);
            Assert.That(appMovSettings.GetKeyValue <bool>("enableBiometricAuth:iOS", true), Is.True);
            Assert.That(appMovSettings.GetKeyValue("enableBiometricAuth:Android", true), Is.True);
            Assert.That(appMovSettings.GetKeyValue("enableRememberUsernameLogin", true), Is.True);
        }
Exemplo n.º 2
0
        public void GetSettingsAsynchronouslyWorks()
        {
            IAnonymous client = this.GetAnonymousClient();

            IList <DocTypeInfo> docTypes    = Enumerable.Empty <DocTypeInfo>().ToList();
            string         recognizedApiKey = DelegatedAppIdentity.Master.ApiKey;
            AppMovSettings appMovSettings   = new AppMovSettings();

            Assert.DoesNotThrowAsync(async() => docTypes       = await client.Settings.GetDefaultDocTypesAsync());
            Assert.DoesNotThrowAsync(async() => appMovSettings = await client.Settings.GetAppSettingsAsync(recognizedApiKey));
            CollectionAssert.IsNotEmpty(docTypes);
            CollectionAssert.IsNotEmpty(appMovSettings);
        }
Exemplo n.º 3
0
        public void GetAppSettingsFromCacheWorks()
        {
            IAnonymous client           = this.GetAnonymousClient(CachePolicy.CacheIfAvailable);
            string     recognizedApiKey = DelegatedAppIdentity.Master.ApiKey;

            Assert.DoesNotThrow(() => client.Settings.GetAppSettings(recognizedApiKey));
            for (int index = 1; index <= 10; index++)
            {
                Stopwatch      watch          = Stopwatch.StartNew();
                AppMovSettings appMovSettings = client.Settings.GetAppSettings(recognizedApiKey);
                watch.Stop();
                CollectionAssert.IsNotEmpty(appMovSettings);
                Assert.That(watch.Elapsed, Is.LessThanOrEqualTo(TimeSpan.FromMilliseconds(10)));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Obtiene la configuración de valores de configuración soportados para la aplicación.
        /// </summary>
        /// <param name="apiKey">El identificador de la aplicación.</param>
        /// <returns>
        /// Colección de clavesy valores soportados para la aplicación.
        /// </returns>
        public AppMovSettings GetAppSettings(string apiKey)
        {
            AppMovSettings appMovSettings = CacheStore.Get <AppMovSettings>(CacheKeys.AppMovSettings);

            if (appMovSettings != null)
            {
                return(appMovSettings);
            }

            IRestRequest request = new AspenRequest(Scope.Anonymous, EndpointMapping.AppMovSettings);

            ServiceLocator.Instance.HeadersManager.AddApiKeyHeader(request, apiKey);
            appMovSettings = this.Execute <AppMovSettings>(request);
            CacheStore.Add(CacheKeys.AppMovSettings, appMovSettings);
            return(appMovSettings);
        }