public void RemoveStorage(AccountOrganization organization, Storage storage, User user) { user.CheckStorageAvailability(storage, Permission.Storage_AccountOrganization_Remove); // Проверяем накладные данной организации на данном складе CheckPossibilityToDeleteAccountOrganizationToStorageLink(organization, storage); organization.RemoveStorage(storage); }
public void AccountOrganization_Storage_Additon_And_Removing_Must_Be_Ok() { var storage = new Storage("Склад", StorageType.DistributionCenter); var jp = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)); var org = new AccountOrganization("Тест", "Тест", jp); org.AddStorage(storage); Assert.AreEqual(1, org.StorageCount); Assert.AreEqual(1, storage.AccountOrganizationCount); org.RemoveStorage(storage); Assert.AreEqual(0, org.StorageCount); Assert.AreEqual(0, storage.AccountOrganizationCount); }
public void AccountOrganization_Deletion_Not_Added_Storage_Must_Throw_Exception() { try { var storage = new Storage("Склад", StorageType.DistributionCenter); var jp = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)); var org = new AccountOrganization("Тест", "Тест", jp); org.RemoveStorage(storage); Assert.Fail("Исключение не вызвано."); } catch (Exception ex) { Assert.AreEqual("Данное место хранения не связано с этой организацией. Возможно, оно было удалено.", ex.Message); } }