public void SetUp() { var f = ReadFileTest.TEST_FILE; int expectedFileSize = Ck2SaveFile.EstimateNbLines(new FileInfo(f)); _file = new Ck2SaveFile(f); _file.Parse(CallerContext.Empty); Assert.That(_file.FullyParsed, Is.True); Assert.That(_file.Map, Is.Not.Null); Assert.That(_file.NbReadLines, Is.EqualTo(expectedFileSize).Within(expectedFileSize * 0.1)); }
internal CallerContext PrepareContextBeforeProcessing() { var cts = new CancellationTokenSource(); var syncContext = SynchronizationContext.Current; Action <int> progressReport = (i => syncContext.Post(_ => ProgressBar.Increment(1), null)); var context = new CallerContext() { CancelToken = cts.Token, ProgressReport = progressReport }; _cancelAction = () => { SetUiEnable(true); cts.Cancel(); }; ProgressBar.Value = 0; ProgressBar.Minimum = 0; ProgressBar.Maximum = Ck2SaveFile.EstimateNbLines(FilesHandler.SelectedFile); return(context); }
public void SetUp() { _file = new Ck2SaveFile(ReadFileTest.SHORT_FILE); _file.Parse(CallerContext.Empty); }