public virtual void TestInitialState()
        {
            StartupProgressView view = startupProgress.CreateView();

            NUnit.Framework.Assert.IsNotNull(view);
            NUnit.Framework.Assert.AreEqual(0L, view.GetElapsedTime());
            NUnit.Framework.Assert.AreEqual(0.0f, view.GetPercentComplete(), 0.001f);
            IList <Phase> phases = new AList <Phase>();

            foreach (Phase phase in view.GetPhases())
            {
                phases.AddItem(phase);
                NUnit.Framework.Assert.AreEqual(0L, view.GetElapsedTime(phase));
                NUnit.Framework.Assert.IsNull(view.GetFile(phase));
                NUnit.Framework.Assert.AreEqual(0.0f, view.GetPercentComplete(phase), 0.001f);
                NUnit.Framework.Assert.AreEqual(long.MinValue, view.GetSize(phase));
                NUnit.Framework.Assert.AreEqual(Status.Pending, view.GetStatus(phase));
                NUnit.Framework.Assert.AreEqual(0L, view.GetTotal(phase));
                foreach (Step step in view.GetSteps(phase))
                {
                    NUnit.Framework.Assert.Fail(string.Format("unexpected step %s in phase %s at initial state"
                                                              , step, phase));
                }
            }
            Assert.AssertArrayEquals(Sharpen.Collections.ToArray(EnumSet.AllOf <Phase>()), Sharpen.Collections.ToArray
                                         (phases));
        }
        public virtual void GetMetrics(MetricsCollector collector, bool all)
        {
            StartupProgressView  prog    = startupProgress.CreateView();
            MetricsRecordBuilder builder = collector.AddRecord(StartupProgressMetricsInfo);

            builder.AddCounter(Interns.Info("ElapsedTime", "overall elapsed time"), prog.GetElapsedTime
                                   ());
            builder.AddGauge(Interns.Info("PercentComplete", "overall percent complete"), prog
                             .GetPercentComplete());
            foreach (Phase phase in prog.GetPhases())
            {
                AddCounter(builder, phase, "Count", " count", prog.GetCount(phase));
                AddCounter(builder, phase, "ElapsedTime", " elapsed time", prog.GetElapsedTime(phase
                                                                                               ));
                AddCounter(builder, phase, "Total", " total", prog.GetTotal(phase));
                AddGauge(builder, phase, "PercentComplete", " percent complete", prog.GetPercentComplete
                             (phase));
            }
        }