コード例 #1
0
        public void EqualsToDateTimeOffsetWithAnotherOffset()
        {
            ExecuteInsideSession(() => {
                RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToOffset(FirstOffset));
                RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToOffset(SecondOffset));
                RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToOffset(TimeSpan.Zero));
                RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToLocalTime());
                RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToUniversalTime());

                RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToOffset(FirstOffset));
                RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToOffset(SecondOffset));
                RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToOffset(TimeSpan.Zero));
                RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToLocalTime());
                RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToUniversalTime());

                RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToOffset(FirstOffset));
                RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToOffset(SecondOffset));
                RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToOffset(TimeSpan.Zero));
                RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToLocalTime());
                RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToUniversalTime());

                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToOffset(FirstOffset));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToOffset(SecondOffset));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToOffset(TimeSpan.Zero));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToLocalTime());
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToUniversalTime());

                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToOffset(FirstOffset));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToOffset(SecondOffset));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToOffset(TimeSpan.Zero));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToLocalTime());
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToUniversalTime());

                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToOffset(FirstOffset));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToOffset(SecondOffset));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToOffset(TimeSpan.Zero));
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToLocalTime());
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToUniversalTime());
            });
        }
コード例 #2
0
        public void CompareToDateTimeTest()
        {
            ExecuteInsideSession(() => {
                RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset > FirstDateTimeOffset.ToLocalTime().AddHours(-1));
                RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset > FirstMillisecondDateTimeOffset.ToUniversalTime().AddMilliseconds(-1));
                RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset > NullableDateTimeOffset.ToLocalTime().Date);

                RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset < FirstDateTimeOffset.ToLocalTime().AddHours(1));
                RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset < FirstMillisecondDateTimeOffset.ToUniversalTime().AddMilliseconds(1));
                RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset < NullableDateTimeOffset.ToUniversalTime().AddYears(1));

                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset > FirstDateTimeOffset.ToLocalTime());
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset < FirstMillisecondDateTimeOffset.ToLocalTime());
                RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset > NullableDateTimeOffset.AddDays(1).ToUniversalTime());
            });
        }