public void CancelInitialization_CallingMethod_PutsFileProviderInStateCancelled()
        {
            //Arrange
            var efp = new ExcelFileProvider(Path);

            //Act
            efp.CancelInitialization();
            while (efp.Status == ProviderStatus.CancellationInProgress)
            {
                Thread.Sleep(200);
            }

            //Assert
            Assert.AreEqual(ProviderStatus.CancellationComplete, efp.Status);
        }
Ejemplo n.º 2
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            var consoleLoggerFactory = LoggerFactory.Create(builder =>
            {
                builder
                .SetMinimumLevel(LogLevel.Information)
                .AddConsole();
            });

            GlobalSettings.LibraryLoggerFactory = consoleLoggerFactory;
            GlobalSettings.UseGuiTranslatorForLocalizationUtils = true;

            IFileProvider efp = new ExcelFileProvider("Resource/Language_File.xlsx", "gloss");

            //IFileProvider jfp = new JsonFileProvider("Resource/Language_File_as_json.json");

            FileLiteralProvider.Initialize(efp, new CultureInfo("en"));
        }
        private ExcelFileProvider CreateNewExcelFileProvider(bool withBackup)
        {
            ExcelFileProvider efp;

            if (withBackup)
            {
                efp = new ExcelFileProvider(Path, GlossaryTag, BackupPath);
            }
            else
            {
                efp = new ExcelFileProvider(Path, GlossaryTag);
            }

            //unlike AbstractLiteralProvider.Instance efp cannot be accessed in tests until it is initialized.
            while (efp.Status == ProviderStatus.InitializationInProgress)
            {
                Thread.Sleep(200);
            }

            return(efp);
        }