public void ShouldSendMandatoryListToApprove() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); mandatoryList.SendToApproval(); Assert.Equal((int)Enums.MandatoryListStatus.WaitingApproval, mandatoryList.StatusId); }
public void ShouldThrowBusinessExceptionWhileRejctingMandatoryListWhenWrongStatus(string rejectionReason) { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.Reject(rejectionReason)); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShouldApproveMandatoryList() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingApprove(); mandatoryList.Approve(); Assert.Equal((int)Enums.MandatoryListStatus.Approved, mandatoryList.StatusId); }
public void ShouldThrowBusinessExceptionWhileSendMandatoryListToApproveWithWrongStatus() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusApprove(); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.SendToApproval()); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShoulsThrowBusinessExceptionWhileClosingChangeRequestWhenWrongStatus() { MandatoryListChangeRequest changeRequest = new MandatoryListDefault().GetMandatoryListChangeRequest(); var e = Assert.Throws <BusinessRuleException>(() => changeRequest.Close()); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShouldThrowBusinessExceptionWihleApproveAndWrongStatus() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.Approve()); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShoulsThrowBusinessExceptionWhileRejectingChangeRequestWhenEmptyReason(string rejectionReason) { MandatoryListChangeRequest changeRequest = new MandatoryListDefault().GetMandatoryListChangeRequest(); var e = Assert.Throws <BusinessRuleException>(() => changeRequest.Reject(rejectionReason)); Assert.Equal(Resources.MandatoryListResources.ErrorMessages.RejectionReasonCannotBeEmpty, e.Message); }
public void ShouldApproveChangeRequest() { MandatoryListChangeRequest changeRequest = new MandatoryListDefault().GetMandatoryListChangeRequest(); changeRequest.Approve(); Assert.Equal((int)Enums.MandatoryListChangeRequestStatus.Approved, changeRequest.StatusId); }
public void ShouldCreateCancelRequest() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusApprove(); mandatoryList.RequestDelete(); Assert.Equal((int)Enums.MandatoryListStatus.WaitingCancelApproval, mandatoryList.StatusId); }
public void ShouldCloseChangeRequest() { MandatoryListChangeRequest changeRequest = new MandatoryListDefault().GetMandatoryListChangeRequestWithRejectedStatus(); changeRequest.Close(); Assert.Equal((int)Enums.MandatoryListChangeRequestStatus.Closed, changeRequest.StatusId); }
public void ShouldDeleteMandatoryList() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); mandatoryList.Delete(); Assert.False(mandatoryList.IsActive); }
public void ShouldThrowBusinessExceptionWhileRejctingMandatoryListWithoutReason(string rejectionReason) { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingApprove(); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.Reject(rejectionReason)); Assert.Equal(Resources.MandatoryListResources.ErrorMessages.RejectionReasonCannotBeEmpty, e.Message); }
public void ShouldThrowBusinessExceptionWhileReOpenMandatoryListtWhenWrongRequestStatus() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusApprove(); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.Reopen()); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShouldReopenMandatoryList() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusRejected(); mandatoryList.Reopen(); Assert.Equal((int)Enums.MandatoryListStatus.UnderEstablishing, mandatoryList.StatusId); }
public void ShouldAddNewMandatoryList() { MandatoryList MandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); MandatoryList.Add(); Assert.Equal((int)Enums.MandatoryListStatus.UnderEstablishing, MandatoryList.StatusId); Assert.All(MandatoryList.Products, c => Assert.Equal(ObjectState.Added, c.State)); }
public void ShouldRejectMandatoryListCorrectlly(string rejectionReason) { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingApprove(); mandatoryList.Reject(rejectionReason); Assert.Equal(rejectionReason, mandatoryList.RejectionReason); Assert.Equal((int)Enums.MandatoryListStatus.Rejected, mandatoryList.StatusId); }
public void ShouldrejectChangeRequest(string rejectionReason) { MandatoryListChangeRequest changeRequest = new MandatoryListDefault().GetMandatoryListChangeRequest(); changeRequest.Reject(rejectionReason); Assert.Equal((int)Enums.MandatoryListChangeRequestStatus.Rejected, changeRequest.StatusId); Assert.Equal(rejectionReason, changeRequest.RejectionReason); }
public void UpdateMandatoryListShouldThrowBusinessExceptionWhenWrongStatus() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingApprove(); MandatoryList updatedMandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.Update(updatedMandatoryList)); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShouldApproveCancelRequest() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingCancelRequest(); mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequest()); mandatoryList.ApproveDelete(); Assert.Equal((int)Enums.MandatoryListStatus.Canceled, mandatoryList.StatusId); }
public void ShouldThrowBusinessExceptionWhileApprovingCancelRequestWhenWrongStatus() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusApprove(); mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequest()); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.ApproveDelete()); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShouldCreateNewChangeRequest() { MandatoryListChangeRequest changeRequest = new MandatoryListDefault().GetMandatoryListChangeRequest(); changeRequest.Add(); Assert.Equal((int)Enums.MandatoryListChangeRequestStatus.WaitingApproval, changeRequest.StatusId); Assert.Equal(ObjectState.Added, changeRequest.State); Assert.All(changeRequest.Products, c => Assert.Equal(ObjectState.Added, c.State)); }
public void ShouldAddMandatoryListChangeRequest() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); MandatoryListChangeRequest changeRequest = new MandatoryListDefault().GetMandatoryListChangeRequest(); mandatoryList.AddChangeRequest(changeRequest); Assert.All(mandatoryList.ChangeRequests, c => Assert.Equal((int)Enums.MandatoryListChangeRequestStatus.WaitingApproval, c.StatusId)); Assert.All(mandatoryList.ChangeRequests, c => Assert.Equal(ObjectState.Added, c.State)); }
public void ShouldCloseEditRequest() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusApprove(); mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequestWithRejectedStatus()); mandatoryList.CloseEdit(); Assert.Equal((int)Enums.MandatoryListChangeRequestStatus.Closed, mandatoryList.ChangeRequests.FirstOrDefault().StatusId); }
public void ShouldThrowBusinessExceptionWhileClosingEditRequestWhenWrongStatus() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequestWithRejectedStatus()); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.CloseEdit()); Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message); }
public void ShouldThrowBusinessExceptionWhileRejectingCancelRequestWhenEmptyReason(string rejectionReason) { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingCancelRequest(); mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequest()); var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.RejectDelete(rejectionReason)); Assert.Equal(Resources.MandatoryListResources.ErrorMessages.RejectionReasonCannotBeEmpty, e.Message); }
public void ShouldRejectEditRequest(string rejectionReason) { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusApprove(); mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequest()); mandatoryList.RejectEdit(rejectionReason); Assert.Equal((int)Enums.MandatoryListChangeRequestStatus.Rejected, mandatoryList.ChangeRequests.FirstOrDefault().StatusId); Assert.Equal(rejectionReason, mandatoryList.ChangeRequests.FirstOrDefault().RejectionReason); }
public void ShouldRejectCancelRequest(string rejectionReason) { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingCancelRequest(); mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequest()); mandatoryList.RejectDelete(rejectionReason); Assert.Equal((int)Enums.MandatoryListStatus.CancelRejected, mandatoryList.StatusId); Assert.Equal(rejectionReason, mandatoryList.RejectionReason); }
public void ShouldUpdateMandatoryList() { MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); MandatoryList updatedMandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts(); mandatoryList.Update(updatedMandatoryList); Assert.Equal(updatedMandatoryList.DivisionCode, mandatoryList.DivisionCode); Assert.Equal(updatedMandatoryList.DivisionNameAr, mandatoryList.DivisionNameAr); Assert.Equal(updatedMandatoryList.DivisionNameEn, mandatoryList.DivisionNameEn); }
public void ShouldUpdateMandatoryListProductChangeRequest() { MandatoryListProductChangeRequest product = new MandatoryListProductChangeRequest(); MandatoryListProductChangeRequest updatedProduct = new MandatoryListDefault().GetMandatoryListProductChangeRequest(); product.Update(updatedProduct); Assert.Equal(updatedProduct.NameAr, product.NameAr); Assert.Equal(updatedProduct.NameEn, product.NameEn); Assert.Equal(updatedProduct.CSICode, product.CSICode); Assert.Equal(updatedProduct.DescriptionAr, product.DescriptionAr); Assert.Equal(updatedProduct.DescriptionEn, product.DescriptionEn); Assert.Equal(updatedProduct.PriceCelling, product.PriceCelling); Assert.Equal(ObjectState.Modified, product.State); }