public void WhenTankNotExists_ShouldThrowException(int id)
 {
     using (var factory = new SqlLiteDbContextFactory())
     {
         using (var context = factory.CreateContext())
         {
             var service = new TankService(context);
             Assert.Throws <Exception>(() => service.Delete(id));
         }
     }
 }
        public IActionResult Delete(int id)
        {
            try
            {
                _tankService.Delete(id);
                TempData["Info"] = "Zbiornik został usunięty";
            }
            catch (Exception)
            {
                TempData["Warning"] = "Wystapił błąd podczas usuwania zbiornika.";
                throw;
            }

            return(RedirectToAction("Index", "Tank"));
        }
            public void WhenTankExists_ShouldDeleteTank(int id)
            {
                using (var factory = new SqlLiteDbContextFactory())
                {
                    using (var context = factory.CreateContext())
                    {
                        SetupTestData(context);

                        var service = new TankService(context);
                        service.Delete(id);

                        var tank = service.FindById(id);
                        Assert.Null(tank);
                    }
                }
            }
 // DELETE api/tank/5
 public void Delete(int id)
 {
     _tankService.Delete(id);
 }