public void Range_WhenNullParameterPassed_ShouldThrowArgumentNullException() { //Arrange verbEx = VerbalExpressions.DefaultExpression; object[] value = null; //Act //Assert verbEx.Range(value); }
public void Range_WhenArrayParameterHasOnlyOneValue_ShouldThrowArgumentOutOfRangeException() { //Arrange verbEx = VerbalExpressions.DefaultExpression; object[] value = new object[1] { 0 }; //Act //Assert verbEx.Range(value); }
public void Range_WhenNullParameterPassed_ShouldThrowArgumentNullException() { //Arrange object[] value = null; //Act //Assert verbEx.Range(value); }
public void Range_WhenOddNumberOfItemsInArray_ShouldAppendWithPipe() { //Arrange verbEx = VerbalExpressions.DefaultExpression; object[] range = new object[3] { 1, 6, 7 }; string expectedExpression = "[1-6]|7"; //Act verbEx.Range(range); //Assert Assert.AreEqual(expectedExpression, verbEx.ToString()); }
public void Range_WhenOddNumberOfItemsInArray_ShouldAppendLastElementWithOrClause() { //Arrange verbEx = VerbalExpressions.DefaultExpression; string text = "abcd7sdadqascdaswde"; object[] range = new object[3] { 1, 6, 7 }; //Act verbEx.Range(range); //Assert Assert.IsTrue(verbEx.IsMatch(text)); }
public void Range_WhenArrayContainsNullParameter_ItIsIgnoredAndRemovedFromList() { //Arrange verbEx = VerbalExpressions.DefaultExpression; object[] inversedOrderArray = new object[4] { 1, null, null, 7 }; verbEx.Range(inversedOrderArray); string lookupString = "testing 5 testing"; //Act bool isMatch = verbEx.IsMatch(lookupString); //Assert Assert.IsTrue(isMatch); }
public void Range_WhenArrayParameterHasValuesInReverseOrder_ReturnsCorrectResultForCorrectOrder() { //Arrange verbEx = VerbalExpressions.DefaultExpression; object[] inversedOrderArray = new object[2] { 9, 2 }; verbEx.Range(inversedOrderArray); string lookupString = "testing 8 another test"; //Act bool isMatch = verbEx.IsMatch(lookupString); //Assert Assert.IsTrue(isMatch); }
public VerbalExpression Range(string from, string to) { _verbalExpression.Range(from, to); return(this); }