コード例 #1
0
        private void BuildContractChangeNotifications(List <ContractChange> changes)
        {
            try
            {
                Customer customer = _customerRepo.GetCustomerByCustomerNumber(changes[0].CustomerNumber,
                                                                              changes[0].BranchId);

                if (customer != null)
                {
                    var notifcation = BuildContractChangeNotification(changes, customer);
                    _queueRepo.PublishToDirectedExchange(notifcation.ToJson(),
                                                         BEKConfiguration.Get("RabbitMQNotificationServer"),
                                                         BEKConfiguration.Get("RabbitMQNotificationPublisherUserName"),
                                                         BEKConfiguration.Get("RabbitMQNotificationPublisherUserPassword"),
                                                         BEKConfiguration.Get("RabbitMQNotificationVHost"),
                                                         BEKConfiguration.Get("RabbitMQNotificationExchangeV2"),
                                                         Constants.RABBITMQ_NOTIFICATION_HASNEWS_ROUTEKEY);
                    _log.WriteInformationLog(string.Format("Published to notification exchange, {0}",
                                                           notifcation.ToJson()));
                }
            }
            catch (Exception ex)
            {
                _log.WriteErrorLog("Error creating contract change notification", ex);
            }

            if (changes != null &&
                changes.Count > 0)
            {
                _contractChangesRepo.Update(changes.First().ParentList_Id, true);
            }
        }
コード例 #2
0
            public void CallUpdate_Completes()
            {
                // arrange
                IContractChangesRepository repo = MakeRepo();
                int  testId   = 1;
                bool testSent = true;

                // act
                try {
                    repo.Update(testId, testSent);
                    // assert
                    Assert.True(true); //no exception
                }
                catch
                {
                    Assert.True(false);//exception
                }
            }