public static void True_ThrowsArgumentException_ForFalse_1() { // Arrange var paramName = "paramName"; Action act = () => Enforce.True(false, paramName); // Act var ex = Record.Exception(act); // Assert Assert.NotNull(ex); Assert.NotNull(ex.Message); var argex = Assert.IsType <ArgumentException>(ex); Assert.Equal(paramName, argex.ParamName); }
public static void True_ThrowsArgumentException_ForFalse_2() { // Arrange var paramName = "paramName"; var message = "My message"; Action act = () => Enforce.True(false, paramName, message); // Act var ex = Record.Exception(act); // Assert Assert.NotNull(ex); var argex = Assert.IsType <ArgumentException>(ex); Assert.Equal(paramName, argex.ParamName); // ArgumentException appends some info to our message. Assert.StartsWith(message, ex.Message, StringComparison.OrdinalIgnoreCase); }
public static void True_DoesNotThrow_ForTrue_2() => Enforce.True(true, "paramName", "My message");
public static void True_DoesNotThrow_ForTrue_1() => Enforce.True(true, "paramName");