public void TimeSpan_MinMax() { TimeSpan max = TimeSpan.MaxValue; TimeSpan min = TimeSpan.MinValue; BVector d = new BVector(); d.Add(max); d.Add1(false); d.Add(min); Assert.AreEqual(max, d.GetTimeSpan()); Assert.AreEqual(false, d.Get1()); Assert.AreEqual(min, d.GetTimeSpan()); }
public void TimeSpan_Basic() { TimeSpan ts = new TimeSpan(DateTime.Now.Ticks); BVector d = new BVector(); d.Add(ts); Assert.AreEqual(ts, d.GetTimeSpan()); }
/// <summary> /// Reads the next random value added by <see cref="WriteRandomValue(BVector)"/> /// </summary> /// <param name="d"></param> /// <returns></returns> public static object ReadNextRandomValue(BVector d) { bool nullable = d.Get1(); byte valueType = d.Get8(); switch (valueType) { case 0: if (nullable) { return(d.GetIntN()); } return(d.GetInt()); case 1: if (nullable) { return(d.GetLongN()); } return(d.GetLong()); case 2: if (nullable) { return(d.GetShortN()); } return(d.GetShort()); case 3: if (nullable) { return(d.GetByteN()); } return(d.GetByte()); case 4: return(d.GetString()); case 5: return(d.GetAscii()); case 6: if (nullable) { return(d.GetDateTimeN()); } return(d.GetDateTime()); case 7: if (nullable) { return(d.GetDecimalN()); } return(d.GetDecimal()); case 8: if (nullable) { return(d.GetDoubleN()); } return(d.GetDouble()); case 9: return(d.Get1()); case 10: return(d.GetTimeSpan()); case 11: return(d.GetByteArray()); } return(null); }