private void MonitorSection(VisibleMigrationProgressMonitor monitor, string name, int max, params int[] steps) { ProgressReporter progressReporter = monitor.StartSection(name); progressReporter.Start(max); foreach (int step in steps) { progressReporter.Progress(step); } progressReporter.Completed(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void progressNeverReportMoreThenHundredPercent() public virtual void ProgressNeverReportMoreThenHundredPercent() { AssertableLogProvider logProvider = new AssertableLogProvider(); Log log = logProvider.getLog(this.GetType()); VisibleMigrationProgressMonitor monitor = new VisibleMigrationProgressMonitor(log); monitor.Started(1); MonitorSection(monitor, "First", 100, 1, 10, 99, 170); monitor.Completed(); VerifySectionReportedCorrectly(logProvider); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldIncludeDurationInCompletionMessage() public virtual void ShouldIncludeDurationInCompletionMessage() { // given AssertableLogProvider logProvider = new AssertableLogProvider(); Log log = logProvider.getLog(this.GetType()); FakeClock clock = new FakeClock(); VisibleMigrationProgressMonitor monitor = new VisibleMigrationProgressMonitor(log, clock); // when monitor.Started(1); clock.Forward(1500, TimeUnit.MILLISECONDS); monitor.Completed(); // then logProvider.FormattedMessageMatcher().assertContains("took 1s 500ms"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReportAllPercentageSteps() public virtual void ShouldReportAllPercentageSteps() { // GIVEN AssertableLogProvider logProvider = new AssertableLogProvider(); Log log = logProvider.getLog(this.GetType()); VisibleMigrationProgressMonitor monitor = new VisibleMigrationProgressMonitor(log); monitor.Started(1); // WHEN MonitorSection(monitor, "First", 100, 40, 25, 23, 10, 50); monitor.Completed(); // THEN VerifySectionReportedCorrectly(logProvider); }