public void ShouldSucceedForArgumentHasLengthGreaterThanWhenArrayHasManyItems(int[] arrayArg, string message) { // Given arrayArg = new[] { 1, 2, 3 }; var argument = TestUtility.CreateArgument(() => arrayArg); // When var action = new TestDelegate(() => Has.LengthGreaterThan <int>(() => 2)(argument, message)); // Then Assert.DoesNotThrow(action); }
public void ShouldFailForArgumentHasLengthGreaterThanWhenArrayHasLessItemsSingular(int[] arrayArg, string message, string format) { // Given var argument = TestUtility.CreateArgument(() => arrayArg); var expected = string.Format(format, "Provided array parameter should have greater than 1 element, but has 0 elements", "arrayArg"); // When var action = new TestDelegate(() => Has.LengthGreaterThan <int>(() => 1)(argument, message)); // Then var exception = Assert.Throws <ArgumentException>(action); exception.ParamName.ShouldBe("arrayArg"); exception.Message.ShouldBe(expected); exception.InnerException.ShouldBe(null); }