123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using XGame.Framework.Assertions;
- using System.Diagnostics;
- namespace XGame.Framework
- {
- public static partial class Assert
- {
- //public static void IsNull<T>(T value) where T : class
- //{
- // IsNull(value, null);
- //}
- //public static void IsNull<T>(T value, string format, params object[] args) where T : class
- //{
- // if (typeof(object).IsAssignableFrom(typeof(T)))
- // {
- // IsNull(value as object, format, args);
- // }
- // else if (value != null)
- // {
- // Fail(AssertionMessageUtil.NullFailureMessage(value, true), format, args);
- // }
- //}
- [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
- public static void IsNull(object value, string format, params object[] args)
- {
- if (value != null)
- Fail(AssertionMessageUtil.NullFailureMessage(value, true), format, args);
- }
- [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
- public static void IsNull<T>(object value, T e) where T : System.Exception
- {
- if (value != null)
- Fail(AssertionMessageUtil.NullFailureMessage(value, true), e);
- }
- [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
- public static void IsNotNull(object value)
- {
- IsNotNull(value, null);
- }
- //public static void IsNotNull<T>(T value) where T : class
- //{
- // IsNotNull(value, null);
- //}
- //public static void IsNotNull<T>(T value, string format, params object[] args) where T : class
- //{
- // if (typeof(object).IsAssignableFrom(typeof(T)))
- // {
- // IsNotNull(value as object, format, args);
- // }
- // else if (value == null)
- // {
- // Fail(AssertionMessageUtil.NullFailureMessage(value, false), format, args);
- // }
- //}
- [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
- public static void IsNotNull(object value, string format, params object[] args)
- {
- if (value == null)
- Fail(AssertionMessageUtil.NullFailureMessage(value, false), format, args);
- }
- [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)]
- public static void IsNotNull<T>(object value, T e) where T : System.Exception
- {
- if (value == null)
- Fail(AssertionMessageUtil.NullFailureMessage(value, false), e);
- }
- }
- }
|