예제 #1
0
        public void ShouldUpdateReplayPeriodHours(int replyHours)
        {
            NegotiationFirstStage negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();

            negotiationFirstStage.UpdateReplyPeriod(replyHours);

            Assert.Equal(replyHours, negotiationFirstStage.SupplierReplyPeriodHours);
        }
예제 #2
0
        public void AcceptNegotiationWithExtraDiscountShouldFaildIfGreaterThanTargetedAmount(decimal discountAmount)
        {
            NegotiationFirstStage negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();

            var e = Assert.ThrowsAsync <BusinessRuleException>(async() => negotiationFirstStage.AgreeWithExtraDiscount(discountAmount));

            Assert.Equal(Resources.CommunicationRequest.ErrorMessages.NegotiationFirstStageExtraDiscountValueValidation, e.Result.Message);
        }
예제 #3
0
        public void ShouldDeactivateNegotiation()
        {
            NegotiationFirstStage negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();

            negotiationFirstStage.DeActive();

            Assert.Equal(false, negotiationFirstStage.IsActive);
        }
예제 #4
0
        public void ShouldDeleteQuantityTableItems()
        {
            NegotiationSupplierQuantityTable supplierQuantityTable = new NegotiationDefaults().GetNegotiationSecondStageQunaitityTables();

            supplierQuantityTable.DeleteItems();

            Assert.Equal(ObjectState.Deleted, supplierQuantityTable.NegotiationQuantityItemJson.State);
        }
예제 #5
0
        public void ShouldDeleteQuantityTableItemsWithItemNumber()
        {
            NegotiationSupplierQuantityTable            supplierQuantityTable = new NegotiationDefaults().GetNegotiationSecondStageQunaitityTables();
            List <NegotiationSupplierQuantityTableItem> tableItems            = new List <NegotiationSupplierQuantityTableItem>(supplierQuantityTable.NegotiationQuantityItemJson.NegotiationSupplierQuantityTableItems);

            supplierQuantityTable.DeleteqtItems(tableItems);

            Assert.Empty(supplierQuantityTable.NegotiationQuantityItemJson.NegotiationSupplierQuantityTableItems);
        }
예제 #6
0
        public void ShouldUpdateNegotiationAttachments()
        {
            NegotiationFirstStage negotiationFirstStage       = new NegotiationDefaults().GetNegotiationFirstStage();
            List <NegotiationAttachmentViewModel> attachments = new NegotiationDefaults().GetNegotiationAttachments();

            negotiationFirstStage.UpdateAttachments(attachments);

            Assert.Equal(ObjectState.Added, negotiationFirstStage.Attachments.FirstOrDefault().State);
        }
예제 #7
0
        public void ShouldNegotiationCommunicationRequest()
        {
            AgencyCommunicationRequest agencyRequest         = new AgencyCommunicationRequest();
            NegotiationFirstStage      negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();

            negotiationFirstStage.SetNegotiationCommunicationRequest(agencyRequest);

            Assert.Equal(negotiationFirstStage.AgencyCommunicationRequest, agencyRequest);
        }
예제 #8
0
        public void AcceptNegotiationWithExtraDiscountShould(decimal discountAmount)
        {
            NegotiationFirstStage negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();

            negotiationFirstStage.AgreeWithExtraDiscount(discountAmount);

            Assert.Equal((int)Enums.enNegotiationStatus.SupplierAgreedWithExtraDiscount, negotiationFirstStage.StatusId);
            Assert.Equal(discountAmount, negotiationFirstStage.ExtraDiscountValue);
        }
예제 #9
0
        public void ShouldUpdateNegotiationFirstStageStatus()
        {
            NegotiationFirstStage negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();

            negotiationFirstStage.UpdateNegotiationFirstStageStatus(1, "Test Reason");

            Assert.Equal(1, negotiationFirstStage.StatusId);
            Assert.Equal("Test Reason", negotiationFirstStage.RejectionReason);
        }
        public void ShouldDeleteQuantityItemsByItemNumber(long itemNumber)
        {
            NegotiationQuantityItemJson negotiationQuantityItemJson = new NegotiationDefaults().GetNegotiationQuantityJsonWithItems();

            negotiationQuantityItemJson.Delete(itemNumber);

            Assert.All(negotiationQuantityItemJson.NegotiationSupplierQuantityTableItems, c => Assert.NotEqual(itemNumber, c.ItemNumber));
            Assert.Equal(ObjectState.Modified, negotiationQuantityItemJson.State);
        }
예제 #11
0
        public void ShouldUpdateSupplierNegotiationStatus(int offerId)
        {
            NegotiationFirstStage negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();
            var supplierNegotiation = negotiationFirstStage.NegotiationFirstStageSuppliers.FirstOrDefault(x => x.OfferId == offerId);

            negotiationFirstStage.UpdateSupplierStatus(0, (int)Enums.enNegotiationSupplierStatus.NoReply, DateTime.Now.Date);

            Assert.Equal(DateTime.Now.Date, supplierNegotiation.PeriodStartDateTime.Value.Date);
            Assert.Equal((int)Enums.enNegotiationSupplierStatus.NoReply, supplierNegotiation.NegotiationSupplierStatusId);
        }
예제 #12
0
        public void ShouldStartNegotiation(int offerId, string cr)
        {
            NegotiationFirstStage         negotiationFirstStage         = new NegotiationDefaults().GetNegotiationFirstStage();
            NegotiationFirstStageSupplier negotiationFirstStageSupplier = new NegotiationDefaults().GetNegotiationFirstStageSupplier(offerId, cr);

            negotiationFirstStage.AddSupplier(negotiationFirstStageSupplier);

            Assert.Equal(offerId, negotiationFirstStage.NegotiationFirstStageSuppliers.FirstOrDefault(nego => nego.OfferId == offerId).OfferId);
            Assert.Equal(cr, negotiationFirstStage.NegotiationFirstStageSuppliers.FirstOrDefault(nego => nego.OfferId == offerId).SupplierCR);
        }
예제 #13
0
        public void ShouldUpadteNegotiationQTableItems()
        {
            NegotiationSupplierQuantityTable supplierQuantityTable = new NegotiationDefaults().GetNegotiationSecondStageQunaitityTables();
            List <TenderQuantityItemDTO>     quantityItemDTOList   = new List <TenderQuantityItemDTO>()
            {
                new NegotiationDefaults().GetTenderQuantityItemDTO(),
            };

            supplierQuantityTable.UpadteNegotiationQTableItems(quantityItemDTOList);

            Assert.NotEmpty(supplierQuantityTable.NegotiationQuantityItemJson.NegotiationSupplierQuantityTableItems);
        }
        public void ShouldDeleteNegotiationQuantityTablesItems()
        {
            NegotiationSecondStage negotiationSecondStage = new NegotiationDefaults().GetNegotiationSecondStageWithQTables();
            TenderQuantityItemDTO  tableDto = new NegotiationDefaults().GetTenderQuantityItemDTO();

            negotiationSecondStage.DeleteNegotiationQItems(new List <TenderQuantityItemDTO>()
            {
                tableDto
            });

            Assert.Empty(negotiationSecondStage.negotiationSupplierQuantitiestable.FirstOrDefault().NegotiationQuantityItemJson.NegotiationSupplierQuantityTableItems);
        }
        public void ShouldUpdatNegotiationQuantityTablesItems()
        {
            NegotiationSecondStage negotiationSecondStage = new NegotiationDefaults().GetNegotiationSecondStageWithQTables();
            TenderQuantityItemDTO  tableDto = new NegotiationDefaults().GetTenderQuantityItemDTO();

            negotiationSecondStage.UpdateNegotiationQItems(new List <TenderQuantityItemDTO>()
            {
                tableDto
            });

            Assert.Single(negotiationSecondStage.negotiationSupplierQuantitiestable);
            Assert.Equal(ObjectState.Added, negotiationSecondStage.negotiationSupplierQuantitiestable.FirstOrDefault().State);
        }
        public void ShouldAddSupplierQuantityTables()
        {
            NegotiationSecondStage             negotiationSecondStage      = new NegotiationSecondStage();
            SupplierTenderQuantityTable        supplierTenderQuantityTable = new NegotiationDefaults().GetSupplierTenderQuantityTable();
            List <SupplierTenderQuantityTable> tenderTablelist             = new List <SupplierTenderQuantityTable>()
            {
                supplierTenderQuantityTable
            };

            negotiationSecondStage.AddSupplierQuantityTables(tenderTablelist);

            Assert.Single(negotiationSecondStage.negotiationSupplierQuantitiestable);
            Assert.Equal(ObjectState.Added, negotiationSecondStage.negotiationSupplierQuantitiestable.FirstOrDefault().State);
        }
예제 #17
0
        public async Task RejectNegotiationRequestFirstStage_WithRejectionReason_UpdateNegotiationStatusToBeRejected()
        {
            #region Arrange
            var negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();
            _NegotiationQueries.Setup(que => que.FindWithSuppliersById(It.IsAny <int>()))
            .Returns(() => Task.FromResult(negotiationFirstStage));

            _NegotiationCommands.Setup(negCommand => negCommand.UpdateNegotiationFirstStageAsync(negotiationFirstStage))
            .Returns(Task.FromResult(negotiationFirstStage));
            NegotiationAgencyActionStatusModel negotiationActionStatus = new NegotiationAgencyActionStatusModel();
            #endregion

            var result = await _sut.RejectNegotiationRequestFirstStage(negotiationActionStatus);

            Assert.True(result);
        }