Exemplo n.º 1
0
        public void CalculateTest(double firstArgument, double secondArgument, double result)
        {
            var calculator = new TakeAway();
            var testResult = calculator.Calculate(firstArgument, secondArgument);

            Assert.AreEqual(result, testResult);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("TakeAwayID,Request,Description")] TakeAway takeAway)
        {
            if (id != takeAway.TakeAwayID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(takeAway);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TakeAwayExists(takeAway.TakeAwayID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(takeAway));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("TakeAwayID,Request,Description")] TakeAway takeAway)
        {
            if (ModelState.IsValid)
            {
                _context.Add(takeAway);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(takeAway));
        }
Exemplo n.º 4
0
 public void CalculateTest(double firstArgument, double secondArgument, double result)
 {
     var calculator = new TakeAway();
     var testResult = calculator.Calculate(firstArgument, secondArgument);
     Assert.AreEqual(result, testResult);
 }