public void DefaultUnknownOutboundAdapterFailsValidate()
        {
            var spt = new SendPortTransport {
                Host = "Host"
            };

            Assert.That(
                () => ((ISupportValidation)spt).Validate(),
                Throws.TypeOf <BindingException>().With.Message.EqualTo("Transport's Adapter is not defined."));
        }
        public void DefaultUnknownOutboundAdapterFailsValidate()
        {
            var spt = new SendPortTransport <string>(new Mock <ISendPort <string> >().Object)
            {
                Host = "Host"
            };

            Invoking(() => ((ISupportValidation)spt).Validate())
            .Should().Throw <BindingException>()
            .WithMessage("Transport's Adapter is not defined.");
        }
        public void ForwardsApplyEnvironmentOverridesToServiceWindow()
        {
            var serviceWindowMock = new Mock <ServiceWindow>();
            var environmentSensitiveServiceWindowMock = serviceWindowMock.As <ISupportEnvironmentOverride>();

            var spt = new SendPortTransport {
                ServiceWindow = serviceWindowMock.Object
            };

            ((ISupportEnvironmentOverride)spt).ApplyEnvironmentOverrides("ACC");

            environmentSensitiveServiceWindowMock.Verify(m => m.ApplyEnvironmentOverrides("ACC"), Times.Once);
        }
        public void ForwardsApplyEnvironmentOverridesToRetryPolicy()
        {
            var retryPolicyMock = new Mock <RetryPolicy>();
            var environmentSensitiveRetryPolicyMock = retryPolicyMock.As <ISupportEnvironmentOverride>();

            var spt = new SendPortTransport {
                RetryPolicy = retryPolicyMock.Object
            };

            ((ISupportEnvironmentOverride)spt).ApplyEnvironmentOverrides("ACC");

            environmentSensitiveRetryPolicyMock.Verify(m => m.ApplyEnvironmentOverrides("ACC"), Times.Once);
        }
        public void ForwardsApplyEnvironmentOverridesToServiceWindow()
        {
            var serviceWindowMock = new Mock <ServiceWindow>();
            var environmentSensitiveServiceWindowMock = serviceWindowMock.As <ISupportEnvironmentOverride>();

            var spt = new SendPortTransport <string>(new Mock <ISendPort <string> >().Object)
            {
                ServiceWindow = serviceWindowMock.Object
            };

            ((ISupportEnvironmentOverride)spt).ApplyEnvironmentOverrides(TargetEnvironment.ACCEPTANCE);

            environmentSensitiveServiceWindowMock.Verify(m => m.ApplyEnvironmentOverrides(TargetEnvironment.ACCEPTANCE), Times.Once);
        }
        public void ForwardsApplyEnvironmentOverridesToRetryPolicy()
        {
            var retryPolicyMock = new Mock <RetryPolicy>();
            var environmentSensitiveRetryPolicyMock = retryPolicyMock.As <ISupportEnvironmentOverride>();

            var spt = new SendPortTransport <string>(new Mock <ISendPort <string> >().Object)
            {
                RetryPolicy = retryPolicyMock.Object
            };

            ((ISupportEnvironmentOverride)spt).ApplyEnvironmentOverrides(TargetEnvironment.ACCEPTANCE);

            environmentSensitiveRetryPolicyMock.Verify(m => m.ApplyEnvironmentOverrides(TargetEnvironment.ACCEPTANCE), Times.Once);
        }
        public void DelegatesHostNameResolutionToHostResolutionPolicy()
        {
            var sendPortMock = new Mock <ISendPort <string> >();

            var sut = new Mock <HostResolutionPolicy> {
                CallBase = true
            };

            var spt = new SendPortTransport <string>(sendPortMock.Object)
            {
                Host = sut.Object
            };

            sut.Setup(p => p.ResolveHost(spt)).Returns("name");
            spt.ResolveHost();

            sut.Verify(p => p.ResolveHost(spt));
        }
 protected internal SendPortBase()
 {
     Priority  = Priority.Normal;
     Transport = new SendPortTransport();
 }