public void MustBeGreaterThanFail(IComparable value, IComparable minValue) { try { value.MustBeGreaterThan(minValue); Assert.Fail(); } catch (ArgumentNullException ex) { Assert.AreEqual("Value cannot be null.", ex.Message); } catch (ArgumentException ex) { Assert.AreEqual($"Value must be greater than {minValue}.", ex.Message); } try { value.MustBeGreaterThan(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); } }
public void MustBeGreaterThan(IComparable value, IComparable minValue) { Assert.AreSame(value, value.MustBeGreaterThan(minValue)); }