public void PhaseTracer_at_MinDateTime() { var pr = new PhaseTracer("Idle"); pr.UpdPhase("Busy1", DateTime.MinValue.AddMinutes(1.2)); pr.UpdPhase("Busy2", DateTime.MinValue.AddMinutes(2)); pr.UpdPhase("Idle", DateTime.MinValue.AddMinutes(2.5)); pr.UpdPhase("Busy2", DateTime.MinValue.AddMinutes(2.9)); if (Diff(pr.GetProportion("Idle", DateTime.MinValue.AddMinutes(3)), 1.6 / 3)) { Assert.Fail(); } if (Diff(pr.GetProportion("Busy1", DateTime.MinValue.AddMinutes(3)), 0.8 / 3)) { Assert.Fail(); } if (Diff(pr.GetProportion("Busy2", DateTime.MinValue.AddMinutes(3)), 0.6 / 3)) { Assert.Fail(); } if (Diff(pr.GetProportion("Other", DateTime.MinValue.AddMinutes(3)), 0)) { Assert.Fail(); } }
public void PhaseTracer_with_WarmUp() { var pr = new PhaseTracer("Idle"); pr.UpdPhase("Busy1", DateTime.MinValue.AddMinutes(1.2)); pr.WarmedUp(DateTime.MinValue.AddMinutes(1.5)); pr.UpdPhase("Busy2", DateTime.MinValue.AddMinutes(2)); pr.UpdPhase("Idle", DateTime.MinValue.AddMinutes(2.5)); pr.UpdPhase("Busy2", DateTime.MinValue.AddMinutes(2.9)); if (Diff(pr.GetProportion("Idle", DateTime.MinValue.AddMinutes(3)), 0.4 / 1.5)) { Assert.Fail(); } if (Diff(pr.GetProportion("Busy1", DateTime.MinValue.AddMinutes(3)), 0.5 / 1.5)) { Assert.Fail(); } if (Diff(pr.GetProportion("Busy2", DateTime.MinValue.AddMinutes(3)), 0.6 / 1.5)) { Assert.Fail(); } }