public void TestToStringCore_Zero_LowerS() { var value = new Timestamp.Value( 0, 1, 1, 0, 0, 0, 0 ); Assert.That( TimestampStringConverter.ToString( "s", CultureInfo.InvariantCulture, ref value ), Is.EqualTo("0000-01-01T00:00:00Z") ); }
public void TestToStringCore_TimestampMax_LowerS() { var value = new Timestamp.Value( 292277026596, 12, 4, 15, 30, 7, 999999999 ); Assert.That( TimestampStringConverter.ToString( "s", CultureInfo.InvariantCulture, ref value ), Is.EqualTo("292277026596-12-04T15:30:07Z") ); }
public void TestToStringCore_TimestampMin_LowerS() { var value = new Timestamp.Value( -292277022657, 1, 27, 8, 29, 52, 0 ); Assert.That( TimestampStringConverter.ToString( "s", CultureInfo.InvariantCulture, ref value ), Is.EqualTo("-292277022657-01-27T08:29:52Z") ); }
public void TestToStringCore_YearMinus10000_LowerS() { var value = new Timestamp.Value( -10000, 10, 10, 10, 10, 10, 123456789 ); Assert.That( TimestampStringConverter.ToString( "s", CultureInfo.InvariantCulture, ref value ), Is.EqualTo("-10000-10-10T10:10:10Z") ); }
public void TestToStringCore_Year10000_UpperO() { var value = new Timestamp.Value( 10000, 10, 10, 10, 10, 10, 123456789 ); Assert.That( TimestampStringConverter.ToString( "O", CultureInfo.InvariantCulture, ref value ), Is.EqualTo("10000-10-10T10:10:10.123456789Z") ); }
public void TestToStringCore_YearMinus1000_UpperO() { var value = new Timestamp.Value( -1000, 1, 1, 0, 0, 0, 0 ); Assert.That( TimestampStringConverter.ToString( "O", CultureInfo.InvariantCulture, ref value ), Is.EqualTo("-1000-01-01T00:00:00.000000000Z") ); }
/// <summary> /// Returns a <see cref="String"/> representation of this instance with the default format and the specified format provider. /// </summary> /// <param name="format"> /// A format string to specify output format. You can specify <c>null</c> for default behavior, which is interpreted as <c>"o"</c>. /// </param> /// <param name="formatProvider"> /// An <see cref="IFormatProvider"/> to provide culture specific format information. /// You can specify <c>null</c> for default behavior, which uses <see cref="CultureInfo.CurrentCulture"/>. /// </param> /// <returns> /// A <see cref="String"/> representation of this instance. /// </returns> /// <exception cref="ArgumentException"> /// <paramref name="format"/> is not valid. /// </exception> /// <remarks> /// <para> /// Currently, only <c>"o"</c> and <c>"O"</c> (ISO 8601 like round trip format) and <c>"s"</c> (ISO 8601 format) are supported. /// Other standard date time format and any custom date time format are not supported. /// </para> /// <para> /// The round trip format is <c>yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff'Z'</c> which 'fffffffff' nanoseconds. /// </para> /// <para> /// As of recommendation of the msgpack specification and consistency with <see cref="DateTime"/> and <see cref="DateTimeOffset"/>, /// the default value of the <paramref name="format"/> is <c>"o"</c> (ISO 8601 like round-trip format) /// and the default value of the <paramref name="formatProvider"/> is <c>null</c> (<see cref="CultureInfo.CurrentCulture"/>. /// If you want to ensure interoperability for other implementation, specify <c>"s"</c> and <see cref="CultureInfo.InvariantCulture"/> resepectively. /// </para> /// </remarks> public string ToString(string format, IFormatProvider formatProvider) { var value = new Value(this); return(TimestampStringConverter.ToString(format, formatProvider, ref value)); }