示例#1
0
        public void ShouldSendMandatoryListToApprove()
        {
            MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts();

            mandatoryList.SendToApproval();

            Assert.Equal((int)Enums.MandatoryListStatus.WaitingApproval, mandatoryList.StatusId);
        }
示例#2
0
        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);
        }
示例#3
0
        public void ShouldApproveMandatoryList()
        {
            MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingApprove();

            mandatoryList.Approve();

            Assert.Equal((int)Enums.MandatoryListStatus.Approved, mandatoryList.StatusId);
        }
示例#4
0
        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);
        }
示例#6
0
        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);
        }
示例#9
0
        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);
        }
示例#11
0
        public void ShouldDeleteMandatoryList()
        {
            MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithProdcuts();

            mandatoryList.Delete();

            Assert.False(mandatoryList.IsActive);
        }
示例#12
0
        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);
        }
示例#13
0
        public void ShouldThrowBusinessExceptionWhileReOpenMandatoryListtWhenWrongRequestStatus()
        {
            MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusApprove();

            var e = Assert.Throws <BusinessRuleException>(() => mandatoryList.Reopen());

            Assert.Equal(Resources.SharedResources.ErrorMessages.NotAddedAuthorized, e.Message);
        }
示例#14
0
        public void ShouldReopenMandatoryList()
        {
            MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusRejected();

            mandatoryList.Reopen();

            Assert.Equal((int)Enums.MandatoryListStatus.UnderEstablishing, mandatoryList.StatusId);
        }
示例#15
0
        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));
        }
示例#16
0
        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);
        }
示例#18
0
        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);
        }
示例#19
0
        public void ShouldApproveCancelRequest()
        {
            MandatoryList mandatoryList = new MandatoryListDefault().GetMandatoryListWithStatusWaitingCancelRequest();

            mandatoryList.ChangeRequests.Add(new MandatoryListDefault().GetMandatoryListChangeRequest());

            mandatoryList.ApproveDelete();

            Assert.Equal((int)Enums.MandatoryListStatus.Canceled, mandatoryList.StatusId);
        }
示例#20
0
        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));
        }
示例#22
0
        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));
        }
示例#23
0
        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);
        }
示例#24
0
        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);
        }
示例#25
0
        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);
        }
示例#26
0
        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);
        }
示例#27
0
        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);
        }
示例#28
0
        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);
        }
示例#29
0
        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);
        }