public void ActionsByInventarizationsWorks() { // DELETE FROM public."Tasks"; //DELETE FROM public."Users"; //DELETE FROM public."Actions"; //DELETE FROM public."Zones"; //DELETE FROM public."Inventorizations"; //DELETE FROM public."Companies" User user = userRepositoriy.CreateUser(new User() { FirstName = "test_name", FamilyName = "test_family", MiddleName = "test_middlename", Level = UserLevel.Scaner, CreatedAt = DateTime.UtcNow, Login = "******", Password = "******" }); Company company = companyRepositoriy.CreateCompany("Тест1"); Business.Model.Inventorization inventarisation = inventorizationRepositoriy.CreateInventorization(company.Id, DateTime.UtcNow); Guid firstActionId = Guid.NewGuid(); Guid secondActionId = Guid.NewGuid(); Business.Model.Action firstAction = new Business.Model.Action() { Id = firstActionId, DateTime = DateTime.UtcNow, Type = ActionType.FirstScan, UserId = user.Id, Inventorization = inventarisation.Id, BarCode = "1", Quantity = 1, }; Business.Model.Action secondAction = new Business.Model.Action() { Id = firstActionId, DateTime = DateTime.UtcNow, Type = ActionType.FirstScan, UserId = user.Id, Zone = inventarisation.Id, BarCode = "1", Quantity = 1, }; actionRepository.CreateAction(firstAction); actionRepository.CreateAction(secondAction); List <Business.Model.Action> actions = actionRepository.GetActionsByInventorization(inventarisation.Id); Assert.IsNotNull(actions); Assert.AreEqual(2, actions.Count()); actionRepository.DeleteAction(firstActionId); actionRepository.DeleteAction(secondActionId); inventorizationRepositoriy.DeleteInventorization(inventarisation.Id); companyRepositoriy.DeleteCompany(company.Id); userRepositoriy.DeleteUser(user.Id); }
public void TestActionRep_DeleteAction() { Personne _pers = new Utilisateur(); Album _alb = new Album("Tintin au Tibet", "Les Aventures de Tintin", "Tintin au Tibet.jpg", "BD", "Aventure", "Casterman", "Hergé"); var action = new Action("AjouterSouhait", _pers, _alb); _actionRepository.DeleteAction(action); bool possede = false; var actions = _actionRepository.GetAll(); Assert.IsFalse(possede); }
public ActionResult DeleteConfirmed(int id) { _ObjActionRepository.DeleteAction(id); return(RedirectToAction("ActionIndex")); }