public void InterpretCustomDelimiters_ComboSingleMultiCharacterDelimitersProvided_TreatedLikeNoDelimitersProvided() { string userInput = @"//;[***][26]\n11***22***33"; CalculatorInputHandler calculatorInputHandler = new CalculatorInputHandler(); CalculatorInput calculatorInput = calculatorInputHandler.InterpretCalculatorInput(userInput); Assert.IsTrue(calculatorInputHandler.AcceptableDelimiters.Count == 2); Assert.IsTrue(!calculatorInputHandler.AcceptableDelimiters.Contains("***")); Assert.IsTrue(calculatorInput.Numbers.Count == 2); Assert.IsTrue(calculatorInput.Numbers[0] == 0); Assert.IsTrue(calculatorInput.Numbers[1] == 0); }
public void InterpretCustomDelimiters_MoreThanSingleCharacterDelimiterProvided_ReturnSuccessful() { string userInput = @"//;;\n2;5"; CalculatorInputHandler calculatorInputHandler = new CalculatorInputHandler(); CalculatorInput calculatorInput = calculatorInputHandler.InterpretCalculatorInput(userInput); Assert.IsTrue(calculatorInputHandler.AcceptableDelimiters.Count == 2); Assert.IsTrue(!calculatorInputHandler.AcceptableDelimiters.Contains(";")); Assert.IsTrue(calculatorInput.Numbers.Count == 2); Assert.IsTrue(calculatorInput.Numbers[0] == 0); Assert.IsTrue(calculatorInput.Numbers[1] == 0); }
public void InterpretCalculatorInput_NumbersOver1000Excluded_ReturnSuccessful() { string userInput = @"2,1001,6"; CalculatorInputHandler calculatorInputHandler = new CalculatorInputHandler(); calculatorInputHandler.ReplaceAlternativeDelimiterWithArgumentDelimiter("|"); CalculatorInput calculatorInput = calculatorInputHandler.InterpretCalculatorInput(userInput); Assert.IsTrue(calculatorInput.Numbers.Count == 2); Assert.IsTrue(calculatorInput.Numbers[0] == 2); Assert.IsTrue(calculatorInput.Numbers[1] == 6); }
public void InterpretCustomDelimiters_SingleMultiCharacterDelimiterProvided_ReturnSuccessful() { string userInput = @"//[***]\n11***22***33"; CalculatorInputHandler calculatorInputHandler = new CalculatorInputHandler(); CalculatorInput calculatorInput = calculatorInputHandler.InterpretCalculatorInput(userInput); Assert.IsTrue(calculatorInputHandler.AcceptableDelimiters.Count == 3); Assert.IsTrue(calculatorInputHandler.AcceptableDelimiters.Contains("***")); Assert.IsTrue(calculatorInput.Numbers.Count == 3); Assert.IsTrue(calculatorInput.Numbers[0] == 11); Assert.IsTrue(calculatorInput.Numbers[1] == 22); Assert.IsTrue(calculatorInput.Numbers[2] == 33); }
public void InterpretCalculatorInput_MultipleValidNumbersWithCommaAndArgumentDelimiters_ReturnSuccessful() { string userInput = @"1|2,3"; CalculatorInputHandler calculatorInputHandler = new CalculatorInputHandler(); calculatorInputHandler.ReplaceAlternativeDelimiterWithArgumentDelimiter("|"); CalculatorInput calculatorInput = calculatorInputHandler.InterpretCalculatorInput(userInput); Assert.IsTrue(calculatorInput.Numbers.Count == 3); Assert.IsTrue(calculatorInput.Numbers[0] == 1); Assert.IsTrue(calculatorInput.Numbers[1] == 2); Assert.IsTrue(calculatorInput.Numbers[2] == 3); }
public void InterpretCalculatorInput_ArgumentProvidedUpperBoundExcluded_ReturnSuccessful() { const int UPPER_BOUND = 2000; string userInput = @"2,1001,2001,6"; CalculatorInputHandler calculatorInputHandler = new CalculatorInputHandler(); calculatorInputHandler.UpperBound = UPPER_BOUND; CalculatorInput calculatorInput = calculatorInputHandler.InterpretCalculatorInput(userInput); Assert.IsTrue(calculatorInput.Numbers.Count == 3); Assert.IsTrue(calculatorInput.Numbers[0] == 2); Assert.IsTrue(calculatorInput.Numbers[1] == 1001); Assert.IsTrue(calculatorInput.Numbers[2] == 6); }