예제 #1
0
      public void GuardExtensions_GuardAreEqual_Does_Not_Throw_ArgumentNullException_When_Has_Value()
      {
          object test = new object();

          try
          {
              GuardExtensions.GuardIsNotNull(test, nameof(test));
          }
          catch (ArgumentNullException)
          {
              Assert.Fail("Unexpected ArgumentNullException was thrown in Guard.GuardIsNotNull(this object, string) method.");
          }
      }
예제 #2
0
      public void GuardExtensions_GuardIsNotNull_Throws_ArgumentNullException_When_Null_And_Includes_Parameter_Name()
      {
          object test = null;

          try
          {
              GuardExtensions.GuardIsNotNull(test, nameof(test));
          }
          catch (ArgumentNullException ex)
          {
              Assert.AreEqual(ex.ParamName, nameof(test));
          }
      }
예제 #3
0
      public void GuardExtensions_GuardAreEqual_Throws_ArgumentNullException_When_Null_And_Includes_Parameter_Name()
      {
          int ObjA = 10;
          int objB = ObjA;

          try
          {
              GuardExtensions.GuardAreEqual(objB, objB, nameof(objB));
          }
          catch (ArgumentNullException ex)
          {
              Assert.AreEqual(ex.ParamName, nameof(objB));
          }
      }