public void ImportHierarchy(Warehouse _wh) { var validator = new WarehouseValidation(); var checkWarehouse = validator.Validate(_wh); if (!checkWarehouse.IsValid) { throw new Exception("Import Warehouse Tree failed in BL"); } var whDAL = _mapper.Map <DAL.Warehouse>(_wh); try { _sqlRepo.ClearDatabase(); _sqlRepo.Create(whDAL); } catch (DAL.DALException exc) { _logger.LogError(exc.ToString()); throw new BLException($"{exc.GetType()} Exception in {System.Reflection.MethodBase.GetCurrentMethod().Name}", exc); } catch (Exception exc) { _logger.LogError(exc.ToString()); throw new BLException($"{exc.GetType()} Exception in {System.Reflection.MethodBase.GetCurrentMethod().Name}", exc); } }
public void ClearDatabase() { Warehouse hop = new Warehouse() { Code = "BNDA04" }; string code = _dal.Create(hop); Assert.NotNull(code); _dal.ClearDatabase(); var hopback = _dal.GetByCode(code); Assert.IsNull(hopback); }