Esempio n. 1
0
        public void ComputeSendPortNameRequiresApplicationBinding()
        {
            var sendPortMock = new Mock <ISendPort <NamingConventionSpy> >();

            sendPortMock.Setup(sp => sp.GetType()).Returns(typeof(StandaloneSendPort));

            var sut = new NamingConventionSpy();

            Invoking(() => sut.ComputeSendPortNameSpy(sendPortMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithMessage($"'{nameof(StandaloneSendPort)}' SendPort is not bound to application's send port collection.");
        }
Esempio n. 2
0
        public void ComputeSendPortNameRequiresParty()
        {
            var applicationBindingMock = new Mock <IApplicationBinding <NamingConventionSpy> >();

            var sendPortMock = new Mock <ISendPort <NamingConventionSpy> >();

            sendPortMock.Setup(sp => sp.GetType()).Returns(typeof(StandaloneSendPort));
            sendPortMock.Setup(sp => sp.ApplicationBinding).Returns(applicationBindingMock.Object);

            var sut = new NamingConventionSpy();

            Invoking(() => sut.ComputeSendPortNameSpy(sendPortMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithMessage($"'{nameof(StandaloneSendPort)}' SendPort's Party is required.");
        }
Esempio n. 3
0
        public void ComputeSendPortNameRequiresNonNullMessageFormat()
        {
            var applicationBindingMock = new Mock <IApplicationBinding <NamingConventionSpy> >();

            applicationBindingMock.Setup(snc => snc.ResolveName()).Returns("SomeApplication");

            var sendPortMock = new Mock <ISendPort <NamingConventionSpy> >();

            sendPortMock.Setup(sp => sp.GetType()).Returns(typeof(StandaloneSendPort));
            sendPortMock.Setup(sp => sp.ApplicationBinding).Returns(applicationBindingMock.Object);

            var sut = new NamingConventionSpy {
                Party = "SomeParty", Subject = "SomeMessage"
            };

            Invoking(() => sut.ComputeSendPortNameSpy(sendPortMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithMessage("A non null MessageFormat is required.");
        }
Esempio n. 4
0
        public void ComputeSendPortNameEmbedsEmptyMessageFormat()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var applicationBindingMock = new Mock <IApplicationBinding <NamingConventionSpy> >();

            applicationBindingMock.Setup(snc => snc.ResolveName()).Returns("SomeApplication");

            var sendPortMock = new Mock <ISendPort <NamingConventionSpy> >();

            sendPortMock.Setup(sp => sp.GetType()).Returns(typeof(StandaloneSendPort));
            sendPortMock.Setup(sp => sp.ApplicationBinding).Returns(applicationBindingMock.Object);
            sendPortMock.Setup(sp => sp.Transport).Returns(new SendPortTransport <NamingConventionSpy>(sendPortMock.Object)
            {
                Adapter = new FileAdapter.Outbound(_ => { })
            });

            var sut = new NamingConventionSpy {
                Party = "SomeParty", Subject = "SomeMessage", MessageFormat = string.Empty
            };

            sut.ComputeSendPortNameSpy(sendPortMock.Object).Should().Be("SomeApplication.SP1.SomeParty.SomeMessage.FILE");
        }