Exemplo n.º 1
0
        public void Remove_ShouldRemoveItem(int id)
        {
            // Act
            TruckService.Remove(id);

            var truck = FakeUnitOfWork.TruckRepository.GetAll(t => t.Id == id).FirstOrDefault();

            // Assert
            Assert.IsNull(truck, "Item was not deleted");
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id, TruckViewModel truckViewModel)
        {
            try
            {
                TruckService.Remove(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, ex.Message);
                return(View(truckViewModel));
            }
        }