Example #1
0
 // GET api/values
 public IEnumerable <string> Get()
 {
     return(new string[] { _sampleLogic.AddMessage(1, 2),
                           _sampleLogic.SubtractMessage(5, 3),
                           _sampleLogic.MultiplyMessage(99, 99),
                           _sampleLogic.DivideMessage(100, 10) });
 }
Example #2
0
        public void SampleLogic_DivideMessage()
        {
            int first = 100, second = 10;
            int returnVal = 10;

            _mockCalculator.Setup(c => c.Divide(first, second)).Returns(returnVal);

            var result = _sampleLogic.DivideMessage(first, second);

            Assert.Equal($"{first} % {second} = {returnVal}", result);
        }
Example #3
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(_sampleLogic.AddMessage(1, 2));
            sb.AppendLine(_sampleLogic.SubtractMessage(10, 7));
            sb.AppendLine(_sampleLogic.MultiplyMessage(10000, 5));
            sb.AppendLine(_sampleLogic.DivideMessage(2000, 2));

            foreach (string model in _sampleLogic.LoadSampleModel())
            {
                sb.AppendLine(model);
            }

            return(Content(sb.ToString()));
        }