public void NullOrEmptyStringCanBeParsedAsTimeOffsetsObject() { ITimeOffsets parsed; Assert.IsFalse(TimeOffsets.TryParse(null, out parsed)); Assert.IsFalse(TimeOffsets.TryParse("", out parsed)); }
void IViewModel.OnClosingDialog() { source.Annotation = annotation; if (TimeOffsets.TryParse(timeOffset, out var newTimeOffset)) { source.TimeOffsets = newTimeOffset; } }
void IViewEvents.OnClosingDialog() { source.Annotation = currentWindow.ReadControl(ControlFlag.AnnotationTextBox | ControlFlag.Value); ITimeOffsets newTimeOffset; if (TimeOffsets.TryParse(currentWindow.ReadControl(ControlFlag.TimeOffsetTextBox | ControlFlag.Value), out newTimeOffset)) { source.TimeOffsets = newTimeOffset; } }
void TestStringification() { var timeOffsets = init.ToTimeOffsets(); ITimeOffsets parsed; var str = timeOffsets.ToString(); Assert.IsTrue(TimeOffsets.TryParse(str, out parsed)); Assert.IsTrue(parsed.Equals(timeOffsets)); Assert.IsTrue(timeOffsets.Equals(parsed)); Assert.AreEqual(timeOffsets.GetHashCode(), parsed.GetHashCode()); }
public void TimeSpanCanBeParsedAsTimeOffsetsObject() { ITimeOffsets parsed; Assert.IsTrue(TimeOffsets.TryParse("00:00:00", out parsed)); Assert.AreEqual(TimeSpan.Zero, parsed.BaseOffset); Assert.IsTrue(TimeOffsets.TryParse("00:00:01", out parsed)); Assert.AreEqual(TimeSpan.FromSeconds(1), parsed.BaseOffset); Assert.IsTrue(TimeOffsets.TryParse("00:00:00.001", out parsed)); Assert.AreEqual(TimeSpan.FromMilliseconds(1), parsed.BaseOffset); }