public void CastToTime(string s, int hour, int minute, int second, int millis, int?offsetHour, int?offsetMinute) { var type = PrimitiveTypes.String(); var value = new SqlString(s); var casted = type.CastTo(value, PrimitiveTypes.Time()); Assert.IsNotNull(casted); Assert.IsInstanceOf <SqlDateTime>(casted); var date = (SqlDateTime)casted; Assert.AreEqual(01, date.Year); Assert.AreEqual(01, date.Month); Assert.AreEqual(01, date.Day); Assert.AreEqual(hour, date.Hour); Assert.AreEqual(minute, date.Minute); Assert.AreEqual(second, date.Second); Assert.AreEqual(millis, date.Millisecond); var offset = (offsetHour != null && offsetMinute != null) ? new SqlDayToSecond(0, offsetHour.Value, offsetMinute.Value, 0) : SqlDayToSecond.Zero; Assert.AreEqual(offset, date.Offset); }