Ejemplo n.º 1
0
 public async Task IsValidToGetSupplierPlain(TenderPlaintCommunicationRequestModel tender)
 {
     if (tender == null)
     {
         throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.UnexpectedError);
     }
     if ((DateTime.Now < tender.TenderAwardingDate || DateTime.Now > tender.TenderAwardingDate.Value.AddDays(tender.AwardingStoppingPeriod.Value)) /*|| tender.PlaintRequestId != 0*/)
     {
         throw new UnHandledAccessException(Resources.TenderResources.ErrorMessages.UnexpectedError);
     }
 }
Ejemplo n.º 2
0
        public async Task Should_CreateCommunicationRequest()
        {
            TenderPlaintCommunicationRequestModel model = new TenderPlaintCommunicationRequestModel()
            {
                EncryptedTenderId = Util.Encrypt(1)
            };

            _moqCommunicationQueries.Setup(t => t.FindTenderWithPlaintRequestByTenderId(It.IsAny <int>(), It.IsAny <string>()))
            .Returns(() => { return(Task.FromResult <Tender>(new TenderDefault().GetGeneralTender())); });
            _moqCommunicationDomainService.Setup(d => d.IsValidToCreatePlain(It.IsAny <Tender>(), It.IsAny <string>()))
            .Verifiable();
            _moqNotificationAppService.Setup(o => o.SendNotificationForCommitteeUsers(It.IsAny <int>(), null, It.IsAny <MainNotificationTemplateModel>()))
            .Verifiable();

            var result = await _sutCommunicationService.CreateCommunicationRequest(model, It.IsAny <string>());

            _moqTenderCommand.Verify(g => g.UpdateAsync(It.IsAny <Tender>()));
            Assert.NotNull(result);
        }