public static void Log ( TimeSpan ts, string actionName, string context, string sDetail ) { Messaging.Bus.Instance.Send ( new Messaging.StatusMessage ( Messaging.StatusMessage.Types.Debug, context, actionName + " took " + ts.ToPrettyString ( ), sDetail ) ); }
public static IMatcher<TimeSpan?> BetweenIncluding(TimeSpan expectFrom, TimeSpan expectTo) { return Matchers.Function((TimeSpan? actual) => actual.IsValidTimeSpan() && expectFrom.SafeCompareTo(actual) <= 0 && expectTo.SafeCompareTo(actual) >= 0, "a TimeSpan where " + expectFrom.ToPrettyString() + " <= value <= " + expectTo.ToPrettyString()); }
public void UtilityToPrettyTime() { TimeSpan timeSpan = new TimeSpan(3, 6, 27, 38); Assert.AreEqual("3d 6h", timeSpan.ToPrettyString()); timeSpan = new TimeSpan(0, 4, 36, 59, 875); Assert.AreEqual("4h 36m", timeSpan.ToPrettyString()); timeSpan = new TimeSpan(0, 0, 12, 17, 0); Assert.AreEqual("12m 17s", timeSpan.ToPrettyString()); timeSpan = new TimeSpan(0, 0, 0, 2, 850); Assert.AreEqual("2.8s", timeSpan.ToPrettyString()); timeSpan = new TimeSpan(0, 0, 0, 0, 300); Assert.AreEqual("0.3s", timeSpan.ToPrettyString()); }
public void TimeSpan_Com_CentoECinquenta_Segundos_TEST() { TimeSpan t = new TimeSpan(0, 0, 150); Assert.AreEqual("2 minutos", t.ToPrettyString()); }
public static IMatcher<TimeSpan?> Not(TimeSpan expect) { return Matchers.Function((TimeSpan? actual) => actual.IsValidTimeSpan() && actual != expect, "a TimeSpan != " + expect.ToPrettyString()); }
public static IMatcher<TimeSpan?> LessThanOrEqualTo(TimeSpan expect) { return Matchers.Function((TimeSpan? actual) => actual.IsValidTimeSpan() && expect.SafeCompareTo(actual) >= 0, "a TimeSpan <= " + expect.ToPrettyString()); }
public static IMatcher<TimeSpan?> GreaterThan(TimeSpan expect) { return Matchers.Function((TimeSpan? actual) => actual.IsValidTimeSpan() && expect.SafeCompareTo(actual) < 0, "a TimeSpan > " + expect.ToPrettyString()); }
public static IMatcher<TimeSpan?> EqualTo(TimeSpan expect) { return Matchers.Function((TimeSpan? actual) => actual == expect, "a TimeSpan == " + expect.ToPrettyString()); }
private void UpdateTimerMessage(TimeSpan timeSpan, bool isCanceling) { var formattedValue = timeSpan.ToPrettyString(); if (isCanceling) { formattedValue = $"Canceling... {formattedValue}"; } StatusInfo.ExecutionTimerMessage = formattedValue; }
public void TimeSpan_Com_Trinta_Segundos_TEST() { TimeSpan t = new TimeSpan(0, 0, 30); Assert.AreEqual("30 segundos", t.ToPrettyString()); }