ServiceBus CreateServiceBus(IEndpointCache endpointCache)
        {
            IEndpoint endpoint = endpointCache.GetEndpoint(_settings.InputAddress);

            var serviceBus = new ServiceBus(endpoint, endpointCache);

            return(serviceBus);
        }
Beispiel #2
0
        public void SendNotification(string subject, IEnumerable <EmailAddress> recipients, string body)
        {
            var message = new SendNotificationMessage
            {
                Recipients = recipients,
                Subject    = subject,
                Body       = body,
                From       =
                    new EmailAddress
                {
                    Address     = EmailAddressConstants.InformationtechnologygroupEmailAddress,
                    DisplayName = "Austin Foam Plastic IT"
                },
                IsBodyHtml = false
            };

            IEndpoint endpoint = _endpointResolver.GetEndpoint(_notificationEndpoint.ToString());

            endpoint.Send(message);
        }
Beispiel #3
0
        public void when_publish_SendNotificationMessage_it_will_go_to_email_service_endpoint()
        {
            var emailServiceEndpointUri = new Queue(ConfigurationManager.AppSettings["EmailServiceHost"], ConfigurationManager.AppSettings["EmailServiceEndpoint"]);

            IEndpoint emailServiceEndpoint = _endpointResolver.GetEndpoint(emailServiceEndpointUri.ToString());

            int startingNummberOfEmailMessages = 0;

            emailServiceEndpoint.Receive(message =>
            {
                startingNummberOfEmailMessages++;
                return(null);
            }, new TimeSpan(0, 1, 0));

            INotificationSender notificationSender = new NotificationSender(emailServiceEndpointUri, _endpointResolver);

            IEnumerable <EmailAddress> emails = new List <EmailAddress>
            {
                new EmailAddress
                {
                    Address     = "*****@*****.**",
                    DisplayName = "test"
                }
            };

            notificationSender.SendNotification("test", emails, "test");

            int finalNummberOfEmailMessages = 0;

            emailServiceEndpoint.Receive(message =>
            {
                finalNummberOfEmailMessages++;
                return(null);
            }, new TimeSpan(0, 1, 0));

            Assert.That(finalNummberOfEmailMessages, Is.EqualTo(startingNummberOfEmailMessages + 1));
        }
Beispiel #4
0
        ServiceBus CreateServiceBus(IEndpointCache endpointCache)
        {
            IEndpoint endpoint = endpointCache.GetEndpoint(_settings.InputAddress);

            return(new ServiceBus(endpoint, endpointCache, _settings.EnablePerformanceCounters));
        }
Beispiel #5
0
        public void Should_get_the_endpoint()
        {
            IEndpoint endpoint = _endpointCache.GetEndpoint("loopback://localhost/mt_client");

            endpoint.ShouldNotBeNull();
        }
        public void SetUp()
        {
            IEndpointCache endpointCache = EndpointCacheFactory.New(x => x.AddTransportFactory <TTransportFactory>());

            _endpoint = endpointCache.GetEndpoint(Address);
        }
 public IEndpoint GetEndpoint(Uri uri)
 {
     return(_endpointCache.GetEndpoint(uri));
 }
        public void Should_throw_an_endpoint_exception_from_the_endpoint_factory()
        {
            IEndpointCache endpointCache = EndpointCacheFactory.New(x => { x.AddTransportFactory <MsmqTransportFactory>(); });

            endpointCache.GetEndpoint(_uri);
        }
 /// <summary>
 /// Returns an IEndpoint for the Uri string specified. If the endpoint has not yet been created,
 /// the factory will attempt to create an endpoint for the Uri string.
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="uriString">The Uri string to resolve to an endpoint (will be checked for valid Uri syntax)</param>
 /// <returns>An IEndpoint instance</returns>
 public static IEndpoint GetEndpoint(this IEndpointCache cache, string uriString)
 {
     return(cache.GetEndpoint(uriString.ToUri("The endpoint URI was invalid")));
 }
Beispiel #10
0
 public void SetUp()
 {
     _endpointCache = EndpointCacheFactory.New(c => { c.AddTransportFactory <TTransportFactory>(); });
     _endpoint      = _endpointCache.GetEndpoint(Address);
 }