public void GetSettingsAsynchronouslyWorks()
        {
            IDelegatedApp client = this.GetDelegatedClient();

            IList <CarrierInfo>     carriers      = Enumerable.Empty <CarrierInfo>().ToList();
            IList <DocTypeInfo>     docTypes      = Enumerable.Empty <DocTypeInfo>().ToList();
            IList <MenuItemInfo>    menuItems     = Enumerable.Empty <MenuItemInfo>().ToList();
            MiscellaneousSettings   miscellaneous = new MiscellaneousSettings();
            IList <PaymentTypeInfo> paymentTypes  = Enumerable.Empty <PaymentTypeInfo>().ToList();
            IList <TopUpInfo>       topUpValues   = Enumerable.Empty <TopUpInfo>().ToList();
            IList <TranTypeInfo>    tranTypes     = Enumerable.Empty <TranTypeInfo>().ToList();

            Assert.DoesNotThrowAsync(async() => carriers      = await client.Settings.GetCarriersAsync());
            Assert.DoesNotThrowAsync(async() => docTypes      = await client.Settings.GetDocTypesAsync());
            Assert.DoesNotThrowAsync(async() => menuItems     = await client.Settings.GetMenuAsync());
            Assert.DoesNotThrowAsync(async() => miscellaneous = await client.Settings.GetMiscellaneousSettingsAsync());
            Assert.DoesNotThrowAsync(async() => paymentTypes  = await client.Settings.GetPaymentTypesAsync());
            Assert.DoesNotThrowAsync(async() => topUpValues   = await client.Settings.GetTopUpValuesAsync());
            Assert.DoesNotThrowAsync(async() => tranTypes     = await client.Settings.GetTranTypesAsync());
            CollectionAssert.IsNotEmpty(carriers);
            CollectionAssert.IsNotEmpty(docTypes);
            CollectionAssert.IsNotEmpty(menuItems);
            CollectionAssert.IsNotEmpty(miscellaneous);
            CollectionAssert.IsNotEmpty(paymentTypes);
            CollectionAssert.IsNotEmpty(topUpValues);
            CollectionAssert.IsNotEmpty(tranTypes);
        }
Пример #2
0
        //---------------------------------------------------------------------
        static void AppendMiscellaneousSettings(
            CommandLineBuilder builder,
            MiscellaneousSettings settings)
        {
            if (!string.IsNullOrWhiteSpace(settings.OptionalConfigFile))
            {
                builder.AppendArgument(ConfigFileFlag, CovertToDirectPath(settings.OptionalConfigFile));
            }

            switch (settings.LogTypeValue)
            {
            case MiscellaneousSettings.LogType.Quiet:
                builder.AppendArgument(QuietFlag, null);
                break;

            case MiscellaneousSettings.LogType.Verbose:
                builder.AppendArgument(VerboseFlag, null);
                break;

            case MiscellaneousSettings.LogType.Normal: break;
            }

            if (settings.ContinueAfterCppExceptions)
            {
                builder.AppendArgument(ContinueAfterCppExceptionFlag, null);
            }
        }
Пример #3
0
        private void PrintCertificate(Document document)
        {
            if (ReprintMode != ReprintMode.Certificate)
            {
                return;
            }

            MiscellaneousSettings miscellaneousSettings = GetInstance <ISettingsRepository <MiscellaneousSettings> >().GetMiscellaneousSettings();

            document.ToPDF(excludeLogos: miscellaneousSettings.ExcludeLogosWhenPrinting).Print();
        }
        public void GetMiscellaneousSettingsFromCacheWorks()
        {
            IDelegatedApp client = this.GetDelegatedClient(CachePolicy.CacheIfAvailable);

            Assert.DoesNotThrow(() => client.Settings.GetMiscellaneousSettings());
            for (int index = 1; index <= 10; index++)
            {
                Stopwatch             watch         = Stopwatch.StartNew();
                MiscellaneousSettings miscellaneous = client.Settings.GetMiscellaneousSettings();
                watch.Stop();
                CollectionAssert.IsNotEmpty(miscellaneous);
                Assert.That(watch.Elapsed, Is.LessThanOrEqualTo(TimeSpan.FromMilliseconds(10)));
            }
        }
Пример #5
0
        /// <summary>
        /// Obtiene la configuración de valores misceláneos soportados para la aplicación.
        /// </summary>
        /// <returns>
        /// Colección de valores admitidos.
        /// </returns>
        public MiscellaneousSettings GetMiscellaneousSettings()
        {
            MiscellaneousSettings miscellaneousSettings = CacheStore.Get <MiscellaneousSettings>(CacheKeys.MiscellaneousSettings);

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

            IRestRequest request = new AspenRequest(Scope.Delegated, EndpointMapping.MiscellaneousSettings);

            miscellaneousSettings = this.Execute <MiscellaneousSettings>(request);
            CacheStore.Add(CacheKeys.MiscellaneousSettings, miscellaneousSettings);
            return(miscellaneousSettings);
        }
        //---------------------------------------------------------------------
        void AppendMiscellaneousSettings(
            StreamWriter writer,
            CommandLineBuilder builder,
            MiscellaneousSettings settings)
        {
            if (!string.IsNullOrWhiteSpace(settings.OptionalConfigFile))
            {
                try
                {
                    var lines = File.ReadAllLines(settings.OptionalConfigFile);
                    foreach (var line in lines)
                    {
                        writer.WriteLine(line);
                    }
                }
                catch (FileNotFoundException)
                {
                    string message = $"Cannot find the config file defined in Miscellanous tab: {settings.OptionalConfigFile}";
                    throw new VSPackageException(message);
                }
            }

            switch (settings.LogTypeValue)
            {
            case MiscellaneousSettings.LogType.Quiet:
                builder.AppendArgument(QuietFlag, null);
                break;

            case MiscellaneousSettings.LogType.Verbose:
                builder.AppendArgument(VerboseFlag, null);
                break;

            case MiscellaneousSettings.LogType.Normal: break;
            }

            if (settings.ContinueAfterCppExceptions)
            {
                AppendArgument(writer, ContinueAfterCppExceptionFlag, null);
            }
        }
        public void GetMiscellaneousSettingsWorks()
        {
            MiscellaneousSettings miscellaneous = this.GetDelegatedClient().Settings.GetMiscellaneousSettings();

            CollectionAssert.IsNotEmpty(miscellaneous);
        }