Example #1
0
        public void NoOrdersInList()
        {
            //Arrange
            var Ordrar   = new List <Order>();
            var expected = 0;

            //Act
            var totalpris = TotalPris.Summera(Ordrar);

            //Assert
            var actual = totalpris;

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void NegativeNumbers()
        {
            //Arrange
            var lista = new List <Order> {
                new Order {
                    Pris = -50
                }
            };
            var expected = -1;
            //Act

            var actual = TotalPris.Summera(lista);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        // GET: Gäst/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var gäst = await _context.Gäster
                       .Include(g => g.Order)
                       .FirstOrDefaultAsync(m => m.Id == id);

            if (gäst == null)
            {
                return(NotFound());
            }

            var ordrar = _context.Ordrar.Where(x => x.GästId == gäst.Id).Select(x => x).ToList();

            ViewBag.totalpris = TotalPris.Summera(ordrar);
            return(View(gäst));
        }
Example #4
0
        public void ForeachTestReturnOnThird()
        {
            //Arrange
            var lista = new List <Order> {
                new Order {
                    Pris = 600
                },
                new Order {
                    Pris = 600
                },
                new Order {
                    Pris = -50
                }
            };
            var expected = -1;
            //Act

            var actual = TotalPris.Summera(lista);

            //Assert
            Assert.AreEqual(expected, actual);
        }