public void CancelAcceptance(AccountingPriceList accountingPriceList, DateTime currentDateTime, User user) { CheckPossibilityToCancelAcceptance(accountingPriceList, user); // регулярная проверка - не появились ли РЦ для переоценки articleRevaluationService.CheckAccountingPriceListWithoutCalculatedRevaluation(currentDateTime); accountingPriceList.CancelAcceptance(); accountingPriceListRepository.Save(accountingPriceList); // удаление показателей учетных цен articleAccountingPriceIndicatorService.Delete(accountingPriceList.Id); articleRevaluationService.AccountingPriceListAcceptanceCancelled(accountingPriceList, currentDateTime); }
public void AccountingPriceList_AcceptAndCancellationMustWork() { var accountingPriceList = new AccountingPriceList("234", DateTime.Today.AddYears(1), DateTime.Today.AddYears(2), storage1, articleAccountingPriceCorrectList1, user); var dateBeforeAccept = DateTime.Now; accountingPriceList.Accept(DateTime.Now); var dateAfterAccept = DateTime.Now; Assert.AreEqual(AccountingPriceListState.Accepted, accountingPriceList.State); Assert.IsNotNull(accountingPriceList.AcceptanceDate); Assert.IsTrue(dateBeforeAccept <= accountingPriceList.AcceptanceDate && accountingPriceList.AcceptanceDate <= dateAfterAccept); accountingPriceList.CancelAcceptance(); Assert.AreEqual(AccountingPriceListState.New, accountingPriceList.State); Assert.IsNull(accountingPriceList.AcceptanceDate); }