Exemplo n.º 1
0
        public void Test_DeleteManufacturerFromDB_ManufacturerDeleted()
        {
            //Arrange
            IRepository <TruckManufacturer> _truckManufacturerContext = new Mocks.MockTruckCheckUpContext <TruckManufacturer>();
            ILogger _logger = new MockTruckCheckUpLogger();
            TruckManufacturerService truckManufacturerService = new TruckManufacturerService(_truckManufacturerContext, _logger);

            truckManufacturerService.ValidateTruckManufacturerToAdd(
                new TruckManufacturerViewModel()
            {
                Description = "Chevrolet"
            });

            truckManufacturerService.ValidateTruckManufacturerToAdd(
                new TruckManufacturerViewModel()
            {
                Description = "Dodge"
            });

            var manufacturer = new TruckManufacturerViewModel();

            manufacturer.Description = "Chevrolet";

            var manufacturerToDelete = truckManufacturerService.SearchTruckManufacturer(manufacturer);

            //Act
            truckManufacturerService.ValidateTruckManufacturerToDelete(manufacturerToDelete.Id);
            _logger.Info("Test-DeleteManufacturerFromDB-ManufacturerDeleted");
            var result = truckManufacturerService.SearchTruckManufacturer(manufacturer);

            //Assert
            Assert.AreEqual(false, result.ExistInDB);
        }
Exemplo n.º 2
0
 public JsonResult Delete(string Id)
 {
     try
     {
         _truckManufacturerService.ValidateTruckManufacturerToDelete(Id);
         return(Json(Id, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         throw;
     }
 }