public void CheckTimeSpan() { MemoryStream buffer = new MemoryStream(); IFieldWriter writer = new FieldWriter(buffer); IFieldReader reader = new FieldReader(buffer); foreach (ulong value in new UInt64[] { 0x0, 0x1, 0x9999, 0xffff, 0xffffffff, 0xffffffffffff, 0xffffffffffffffff, 0x7fffffffffffffff, 0x9999999999999999 }) { buffer.Position = 0; TimeSpan expected = new TimeSpan((long)value); writer.Write(expected); buffer.Position = 0; TimeSpan actual = reader.ReadTimeSpan(); Assert.AreEqual(expected, actual); } }