FromDateTimeOffset() public static method

Convert specified DateTimeOffset to Int64 as MessagePack defacto-standard.
public static FromDateTimeOffset ( DateTimeOffset value ) : long
value DateTimeOffset .
return long
コード例 #1
0
        public void TestExplicitDateTime_OverflowSeconds()
        {
            var source = new Timestamp(MessagePackConvert.FromDateTimeOffset(DateTimeOffset.MaxValue) + 1L, checked (( int )(DateTimeOffset.MaxValue.Ticks % 10000000 * 100)));

            Assert.Throws <InvalidOperationException>(() => { var x = ( DateTime )source; });
        }
コード例 #2
0
        public void TestToDateTime_OverflowNanoseconds()
        {
            var source = new Timestamp(MessagePackConvert.FromDateTimeOffset(DateTimeOffset.MaxValue) + 1, 0);

            Assert.Throws <InvalidOperationException>(() => source.ToDateTime());
        }