Exemplo n.º 1
0
        public void CampaignManagerSubscriberAddOnReceiveActionToChannel()
        {
            var testNotificationChannel   = new InProcNotificationChannel <ILeadEntity>(new Mock <ILogger>().Object);
            var testNotificationPublisher =
                new Publisher <ILeadEntity>(new INotificationChannel <ILeadEntity>[] { testNotificationChannel }, true);
            var testNotificationSubscriber = new Subscriber <ILeadEntity>(testNotificationChannel, true);

            // Set up the action to be invoked when a leadEntity is received
            bool actionWasInvoked = false;
            Action <ILeadEntity> leadEntityReceiveAction = campaignManagerDriver => actionWasInvoked = true;

            // Setup the Subscriber to execute the action when invoked
            var campaignManagerSubscriber =
                new CampaignManagerSubscriber(testNotificationSubscriber, _loggerClient.Object);

            campaignManagerSubscriber.SetupAddOnReceiveActionToChannel(leadEntityReceiveAction);

            // Let the Notification Publisher broadcast a leadEntity
            testNotificationPublisher.BroadcastMessage(_testLleadEntity);

            // Sleep a little while for the Notification Channel to pick up the LeadEntity
            Thread.Sleep(5);

            // The subscriber should now have executed the action
            Assert.AreEqual(true, actionWasInvoked);
        }
Exemplo n.º 2
0
 public void CampaignManagerSubscriberConstructorNullLoggerClientTest()
 {
     try
     {
         var campaignManagerSubscriber = new CampaignManagerSubscriber(_notificationSubscriber.Object, null);
         Assert.Fail("An Argument Null Exception is expected when the LoggerClient is null");
     }
     catch (Exception exception)
     {
         Assert.AreEqual(typeof(ArgumentNullException), exception.GetType());
         Assert.AreEqual("Value cannot be null. Parameter name: loggerClient", exception.Message.Replace(Environment.NewLine, " "));
     }
 }
Exemplo n.º 3
0
 public void CampaignManagerSubscriberConstructorTest()
 {
     var campaignManagerSubscriber = new CampaignManagerSubscriber(_notificationSubscriber.Object, _loggerClient.Object);
 }