public void InterpretAsRangeOfInts_SingleInteger_ReturnsFalse()
        {
            int  outRangeTop;
            int  outRangeBottom;
            bool successfullyInturpreted =
                EntryFieldInterpretingUtils.InterpretAsRangeOfInts("9", out outRangeTop, out outRangeBottom);

            Assert.IsFalse(successfullyInturpreted);
        }
        public void InterpretAsRangeOfInts_RangeWithDecimal_ReturnsFalse()
        {
            int  outRangeTop;
            int  outRangeBottom;
            bool successfullyInturpreted =
                EntryFieldInterpretingUtils.InterpretAsRangeOfInts("10.3-15", out outRangeTop, out outRangeBottom);

            Assert.IsFalse(successfullyInturpreted);
        }
        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 InterpretAsRangeOfInts_BackwardsIntegerRange_SuccessfullyAssignSmallerNumberToRangeBottomAndLargerNumberToRangeTop()
        {
            int  outRangeTop;
            int  outRangeBottom;
            bool successfullyInturpreted =
                EntryFieldInterpretingUtils.InterpretAsRangeOfInts("85-6", out outRangeTop, out outRangeBottom);

            Assert.IsTrue(successfullyInturpreted);
            Assert.AreEqual(6, outRangeBottom);
            Assert.AreEqual(85, outRangeTop);
        }
        public void InterpretAsRangeOfInts_ValidIntegerRange_SuccessfullyExtractsRange()
        {
            int  outRangeTop;
            int  outRangeBottom;
            bool successfullyInturpreted =
                EntryFieldInterpretingUtils.InterpretAsRangeOfInts("10 - 20", out outRangeTop, out outRangeBottom);

            Assert.IsTrue(successfullyInturpreted);
            Assert.AreEqual(10, outRangeBottom);
            Assert.AreEqual(20, outRangeTop);
        }