Пример #1
0
        public void DeleteBudget()
        {
            var budgetDAO   = new BudgetDAO(sqlManager);
            var listClassif = JsonConvert.DeserializeObject <Dictionary <string, List <SousClassificationDTO> > >(
                new ClassificationDAO(sqlManager).GetClassification());
            var budgetDTO1 = new BudgetDTO()
            {
                budget = "2",
                id_sous_classification = listClassif["EQUIPEMENTS_FOURNITURES_REPARATION"][1].id,
                periode = DateTime.Parse("25/02/2019", CultureInfo.CurrentCulture)
            };

            budgetDAO.SaveBudget(budgetDTO1);
            var result = JsonConvert.DeserializeObject <Dictionary <string, List <BudgetDTO> > >(
                budgetDAO.GetBudget("2019", "EQUIPEMENTS_FOURNITURES_REPARATION"));

            Assert.IsTrue(result["1"].Count > 0);
            budgetDAO.DeleteBudget(new Guid(result["1"][0].id));
            result = JsonConvert.DeserializeObject <Dictionary <string, List <BudgetDTO> > >(
                budgetDAO.GetBudget("2019", "EQUIPEMENTS_FOURNITURES_REPARATION"));
            Assert.IsTrue(result["1"].Count == 0);
        }
 public static bool SupprimerBudget(int id)
 {
     return(BudgetDAO.DeleteBudget(id));
 }