public void SetupCalculator() { Console.Clear(); Console.WriteLine(_banner.RenderBanner()); Console.WriteLine("Please enter a number: "); var userInput = Console.ReadLine(); long numberToCalculate; while (!long.TryParse(userInput, out numberToCalculate)) { Console.WriteLine("Not a valid number! Please enter a number: "); userInput = Console.ReadLine(); } var calculation = new Calculation(numberToCalculate); while (calculation.NumberToCalculate > 1) { if (_checkIsOdd.NumberIsOdd(calculation.NumberToCalculate)) { calculation.NumberToCalculate = _isOddRule.ApplyIsOddRule(calculation.NumberToCalculate); } else { calculation.NumberToCalculate = _isEvenCalculationRule.CalculateOutput(calculation.NumberToCalculate); } calculation.StepsTaken++; Console.Write(calculation.NumberToCalculate + ", "); } Console.WriteLine("\nSteps taken: " + calculation.StepsTaken); CalculateAgainQuestion(); }
public void NumberIsOdd_ReturnsCorrectBoolValue() { // Arrange var inputNumber = 11; // Act var result = _checkIsOdd.NumberIsOdd(inputNumber); // Assert Assert.True(result); }