public void LogicalPortsMustAllBeBound()
        {
            IProcessOrchestrationBinding orchestrationBinding = new ProcessOrchestrationBinding {
                Host = "Host"
            };

            orchestrationBinding.ReceivePort = new Mock <ReceivePort>().Object;
            orchestrationBinding.SendPort    = new Mock <SendPort>().Object;

            Invoking(() => ((ISupportValidation)orchestrationBinding).Validate())
            .Should().Throw <BindingException>()
            .WithMessage($"The '{typeof(Process).FullName}' orchestration has unbound logical ports: 'RequestResponsePort', 'SolicitResponsePort'.");
        }
Example #2
0
        public void LogicalSolicitResponsePortMustBeBoundToTwoWaySendPort()
        {
            IProcessOrchestrationBinding orchestrationBinding = new ProcessOrchestrationBinding();

            orchestrationBinding.Host                = "Host";
            orchestrationBinding.ReceivePort         = new TestApplication.OneWayReceivePort();
            orchestrationBinding.SendPort            = new TestApplication.OneWaySendPort();
            orchestrationBinding.SolicitResponsePort = new TestApplication.OneWaySendPort();
            orchestrationBinding.RequestResponsePort = new TestApplication.TwoWayReceivePort();

            Assert.That(
                () => ((ISupportValidation)orchestrationBinding).Validate(),
                Throws.TypeOf <BindingException>().With.Message.EqualTo("Orchestration's two-way logical port 'SolicitResponsePort' is bound to one-way port 'OneWaySendPort'."));
        }
Example #3
0
        public void LogicalPortsMustAllBeBound()
        {
            IProcessOrchestrationBinding orchestrationBinding = new ProcessOrchestrationBinding();

            orchestrationBinding.Host        = "Host";
            orchestrationBinding.ReceivePort = new Mock <ReceivePort>().Object;
            orchestrationBinding.SendPort    = new Mock <SendPort>().Object;

            Assert.That(
                () => ((ISupportValidation)orchestrationBinding).Validate(),
                Throws.TypeOf <BindingException>()
                .With.Message.EqualTo(
                    string.Format(
                        "The '{0}' orchestration has unbound logical ports: 'RequestResponsePort', 'SolicitResponsePort'.",
                        typeof(Process).FullName)));
        }
        public void LogicalSolicitResponsePortMustBeBoundToTwoWaySendPort()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            IProcessOrchestrationBinding orchestrationBinding = new ProcessOrchestrationBinding {
                Host = "Host"
            };

            orchestrationBinding.ReceivePort         = new OneWayReceivePort();
            orchestrationBinding.SendPort            = new OneWaySendPort();
            orchestrationBinding.SolicitResponsePort = new OneWaySendPort();
            orchestrationBinding.RequestResponsePort = new TwoWayReceivePort();

            Invoking(() => ((ISupportValidation)orchestrationBinding).Validate())
            .Should().Throw <BindingException>()
            .WithMessage("Orchestration's two-way logical port 'SolicitResponsePort' is bound to one-way port 'OneWaySendPort'.");
        }
        public void CreateServiceRef()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var visitor = new BindingInfoBuilder();

            var orchestrationBinding = new ProcessOrchestrationBinding(
                ob => {
                ob.Description         = "Some Useless Orchestration.";
                ob.Host                = "Processing Host Name";
                ob.ReceivePort         = new OneWayReceivePort();
                ob.RequestResponsePort = new TwoWayReceivePort();
                ob.SendPort            = new OneWaySendPort();
                ob.SolicitResponsePort = new TwoWaySendPort();
            });
            var binding = visitor.CreateServiceRef(orchestrationBinding);

            binding.Description.Should().Be("Some Useless Orchestration.");
            binding.Host.Name.Should().Be("Processing Host Name");
            binding.Host.Trusted.Should().BeFalse();
            binding.Host.Type.Should().Be((int)HostType.Invalid);
            binding.Name.Should().Be(typeof(Process).FullName);
            binding.State.Should().Be(ServiceRef.ServiceRefState.Default);
            binding.TrackingOption.Should().Be(OrchestrationTrackingTypes.None);
            binding.Ports.Count.Should().Be(4);

            binding.Ports[0].Modifier.Should().Be((int)PortModifier.Import);
            binding.Ports[0].Name.Should().Be("SendPort");
            binding.Ports[0].ReceivePortRef.Should().BeNull();
            binding.Ports[0].SendPortRef.Name.Should().Be(new OneWaySendPort().ResolveName());
            binding.Ports[1].Modifier.Should().Be((int)PortModifier.Export);

            binding.Ports[1].Name.Should().Be("ReceivePort");
            binding.Ports[1].ReceivePortRef.Name.Should().Be(new OneWayReceivePort().ResolveName());
            binding.Ports[1].SendPortRef.Should().BeNull();

            binding.Ports[2].Modifier.Should().Be((int)PortModifier.Export);
            binding.Ports[2].Name.Should().Be("RequestResponsePort");
            binding.Ports[2].ReceivePortRef.Name.Should().Be(new TwoWayReceivePort().ResolveName());
            binding.Ports[2].SendPortRef.Should().BeNull();

            binding.Ports[3].Modifier.Should().Be((int)PortModifier.Import);
            binding.Ports[3].Name.Should().Be("SolicitResponsePort");
            binding.Ports[3].ReceivePortRef.Should().BeNull();
            binding.Ports[3].SendPortRef.Name.Should().Be(new TwoWaySendPort().ResolveName());
        }
        public void CreateServiceRef()
        {
            var visitor = BindingInfoBuilderVisitor.Create();

            var orchestrationBinding = new ProcessOrchestrationBinding(
                ob => {
                ob.Description         = "Some Useless Orchestration.";
                ob.Host                = "Processing Host Name";
                ob.ReceivePort         = new TestApplication.OneWayReceivePort();
                ob.RequestResponsePort = new TestApplication.TwoWayReceivePort();
                ob.SendPort            = new TestApplication.OneWaySendPort();
                ob.SolicitResponsePort = new TestApplication.TwoWaySendPort();
            });
            var binding = visitor.CreateServiceRef(orchestrationBinding);

            Assert.That(binding.Description, Is.EqualTo("Some Useless Orchestration."));
            Assert.That(binding.Host.Name, Is.EqualTo("Processing Host Name"));
            Assert.That(binding.Host.Trusted, Is.False);
            Assert.That(binding.Host.Type, Is.EqualTo((int)HostType.Invalid));
            Assert.That(binding.Name, Is.EqualTo(typeof(Process).FullName));
            Assert.That(binding.State, Is.EqualTo(ServiceRef.ServiceRefState.Enlisted));
            Assert.That(binding.TrackingOption, Is.EqualTo(OrchestrationTrackingTypes.None));
            Assert.That(binding.Ports.Count, Is.EqualTo(4));

            Assert.That(binding.Ports[0].Modifier, Is.EqualTo((int)PortModifier.Import));
            Assert.That(binding.Ports[0].Name, Is.EqualTo("SendPort"));
            Assert.That(binding.Ports[0].ReceivePortRef, Is.Null);
            Assert.That(binding.Ports[0].SendPortRef.Name, Is.EqualTo(((ISupportNamingConvention) new TestApplication.OneWaySendPort()).Name));
            Assert.That(binding.Ports[1].Modifier, Is.EqualTo((int)PortModifier.Export));

            Assert.That(binding.Ports[1].Name, Is.EqualTo("ReceivePort"));
            Assert.That(binding.Ports[1].ReceivePortRef.Name, Is.EqualTo(((ISupportNamingConvention) new TestApplication.OneWayReceivePort()).Name));
            Assert.That(binding.Ports[1].SendPortRef, Is.Null);

            Assert.That(binding.Ports[2].Modifier, Is.EqualTo((int)PortModifier.Export));
            Assert.That(binding.Ports[2].Name, Is.EqualTo("RequestResponsePort"));
            Assert.That(binding.Ports[2].ReceivePortRef.Name, Is.EqualTo(((ISupportNamingConvention) new TestApplication.TwoWayReceivePort()).Name));
            Assert.That(binding.Ports[2].SendPortRef, Is.Null);

            Assert.That(binding.Ports[3].Modifier, Is.EqualTo((int)PortModifier.Import));
            Assert.That(binding.Ports[3].Name, Is.EqualTo("SolicitResponsePort"));
            Assert.That(binding.Ports[3].ReceivePortRef, Is.Null);
            Assert.That(binding.Ports[3].SendPortRef.Name, Is.EqualTo(((ISupportNamingConvention) new TestApplication.TwoWaySendPort()).Name));
        }