public void Test2()
        {
            var factNumModel = new FactCalcModel();

            factNumModel.InputFactNumber = 10;

            Assert.Throws <InvalidOperationException>(
                () => _services.CalculateFactorial(factNumModel)
                );
        }
Пример #2
0
        public ActionResult <FactCalcModel> Index(FactCalcModel factNumModel)
        {
            var factorialCalculated = _services.CalculateFactorial(factNumModel);

            if (factorialCalculated == null)
            {
                return(NotFound());
            }

            //Input For adding to a physical file
            string inputStreamToFile = string.Empty;

            inputStreamToFile = "Factorial of " + factNumModel.InputFactNumber.ToString() + " is " + factNumModel.OutputFactNumber.ToString();
            this.GetFile(inputStreamToFile);

            return(View(factorialCalculated));
        }