Example #1
0
        public void CannotBeLessThanFail(IComparable value, IComparable minValue)
        {
            try
            {
                value.CannotBeLessThan(minValue);

                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("Value cannot be null.", ex.Message);
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual($"Value cannot be less than {minValue}.", ex.Message);
            }

            try
            {
                value.CannotBeLessThan(minValue, () => throw new InvalidOperationException("Test."));

                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("Value cannot be null.", ex.Message);
            }
            catch (InvalidOperationException ex)
            {
                Assert.AreEqual("Test.", ex.Message);
            }
        }
Example #2
0
        public void CannotBeLessThanFail(IComparable value, IComparable minValue)
        {
            try
            {
                value.CannotBeLessThan(minValue);

                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("Value cannot be null.", ex.Message);
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual($"Value cannot be less than {minValue}.", ex.Message);
            }
        }
Example #3
0
 public void CannotBeLessThan(IComparable value, IComparable max)
 {
     Assert.AreSame(value, value.CannotBeLessThan(max));
 }