public void InterpretAsRangeAllStr_UppercaseVersionOfRangeAllString_ReturnsTrue() { bool stringIsRangeAllStr = EntryFieldInterpretingUtils.InterpretAsRangeAllStr(MssMsgUtil.RANGE_ALL_STR.ToUpper()); Assert.IsTrue(stringIsRangeAllStr); }
public virtual bool GetRangeFromUserInput(string userInput, int minValue, int maxValue, out int rangeBottom, out int rangeTop, out string errorMsg) { int singleRangeValue; int tempRangeTop; int tempRangeBottom; errorMsg = ""; bool validFormat; bool validRange; if (EntryFieldInterpretingUtils.InterpretAsInt(userInput, out singleRangeValue)) { rangeTop = singleRangeValue; rangeBottom = singleRangeValue; validFormat = true; } else if (EntryFieldInterpretingUtils.InterpretAsRangeAllStr(userInput)) { rangeTop = maxValue; rangeBottom = minValue; validFormat = true; } else if (EntryFieldInterpretingUtils.InterpretAsRangeOfInts(userInput, out tempRangeTop, out tempRangeBottom)) { rangeTop = tempRangeTop; rangeBottom = tempRangeBottom; validFormat = true; } else { errorMsg = "Invalid range format"; rangeTop = MssMsgUtil.UNUSED_MSS_MSG_DATA; rangeBottom = MssMsgUtil.UNUSED_MSS_MSG_DATA; validFormat = false; } if (validFormat == true) { if (rangeBottom >= minValue && rangeTop <= maxValue) { validRange = true; } else { errorMsg = "Out of range"; validRange = false; } } else { validRange = false; } return(validRange); }
public void InterpretAsRangeAllStr_NonRangeAllString_ReturnsFalse() { bool stringIsRangeAllStr = EntryFieldInterpretingUtils.InterpretAsRangeAllStr("16"); Assert.IsFalse(stringIsRangeAllStr); }