コード例 #1
0
        public void SubtractDateTimeTest()
        {
            Require.ProviderIsNot(StorageProvider.MySql);
            ExecuteInsideSession(() => {
                RunTest <SingleDateTimeEntity>(c => c.DateTime.Subtract(SecondDateTime) == FirstDateTime.Subtract(SecondDateTime));
                RunTest <SingleDateTimeEntity>(c => c.MillisecondDateTime.Subtract(SecondDateTime) == FirstMillisecondDateTime.Subtract(SecondDateTime));
                RunTest <SingleDateTimeEntity>(c => c.NullableDateTime.Value.Subtract(SecondDateTime) == NullableDateTime.Subtract(SecondDateTime));

                RunWrongTest <SingleDateTimeEntity>(c => c.DateTime.Subtract(SecondDateTime) == FirstDateTime.Subtract(WrongDateTime));
                RunWrongTest <SingleDateTimeEntity>(c => c.MillisecondDateTime.Subtract(SecondDateTime) == FirstMillisecondDateTime.Subtract(WrongDateTime));
                RunWrongTest <SingleDateTimeEntity>(c => c.NullableDateTime.Value.Subtract(SecondDateTime) == NullableDateTime.Subtract(WrongDateTime));
            });
        }
コード例 #2
0
        public void SubtractTimeSpanTest()
        {
            ExecuteInsideSession(() => {
                RunTest <SingleDateTimeEntity>(c => c.DateTime.Subtract(FirstOffset) == FirstDateTime.Subtract(FirstOffset));
                RunTest <SingleDateTimeEntity>(c => c.MillisecondDateTime.Subtract(SecondOffset) == FirstMillisecondDateTime.Subtract(SecondOffset));
                RunTest <SingleDateTimeEntity>(c => c.NullableDateTime.Value.Subtract(FirstOffset) == NullableDateTime.Subtract(FirstOffset));

                RunWrongTest <SingleDateTimeEntity>(c => c.DateTime.Subtract(FirstOffset) == FirstDateTime.Subtract(WrongOffset));
                RunWrongTest <SingleDateTimeEntity>(c => c.MillisecondDateTime.Subtract(SecondOffset) == FirstMillisecondDateTime.Subtract(WrongOffset));
                RunWrongTest <SingleDateTimeEntity>(c => c.NullableDateTime.Value.Subtract(FirstOffset) == NullableDateTime.Subtract(WrongOffset));
            });
        }