Пример #1
0
        public void CannotBeEqualToFail(IComparable value1, IComparable value2)
        {
            try
            {
                value1.CannotBeEqualTo(value2);

                Assert.Fail();
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual($"Value cannot be of equal to {value2}.", ex.Message);
            }
        }
Пример #2
0
        public void CannotBeEqualToFail(IComparable value1, IComparable value2)
        {
            try
            {
                value1.CannotBeEqualTo(value2);

                Assert.Fail();
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual($"Value cannot be equal to {value2}.", ex.Message);
            }

            try
            {
                value1.CannotBeEqualTo(value2, () => throw new InvalidOperationException("Test."));

                Assert.Fail();
            }
            catch (InvalidOperationException ex)
            {
                Assert.AreEqual("Test.", ex.Message);
            }
        }
Пример #3
0
 public void CannotBeEqualTo(IComparable value1, IComparable value2)
 {
     Assert.AreSame(value1, value1.CannotBeEqualTo(value2));
 }