Esempio n. 1
0
        public void ComputeReceiveLocationNameTwoWay()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

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

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

            var receivePortMock = new Mock <IReceivePort <NamingConventionSpy> >();

            receivePortMock.Setup(rp => rp.GetType()).Returns(typeof(StandaloneReceivePort));
            receivePortMock.Setup(rp => rp.ApplicationBinding).Returns(applicationBindingMock.Object);
            receivePortMock.Setup(rp => rp.Name).Returns(new NamingConventionSpy {
                Party = "SomeParty"
            });
            receivePortMock.Setup(rp => rp.IsTwoWay).Returns(true);

            var receiveLocationMock = new Mock <IReceiveLocation <NamingConventionSpy> >();

            receiveLocationMock.Setup(rl => rl.GetType()).Returns(typeof(StandaloneReceiveLocation));
            receiveLocationMock.Setup(rl => rl.ReceivePort).Returns(receivePortMock.Object);
            receiveLocationMock.Setup(rl => rl.Transport)
            .Returns(new ReceiveLocationTransport <NamingConventionSpy>(receiveLocationMock.Object)
            {
                Adapter = new FileAdapter.Inbound(_ => { })
            });

            var sut = new NamingConventionSpy {
                Subject = "SomeMessage", MessageFormat = "SomeFormat"
            };

            sut.ComputeReceiveLocationNameSpy(receiveLocationMock.Object).Should().Be("SomeApplication.RL2.SomeParty.SomeMessage.FILE.SomeFormat");
        }
Esempio n. 2
0
        public void ComputeReceiveLocationNameRequiresAggregateToMatchItsReceivePortOneIfItHasOne()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

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

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

            var receivePortMock = new Mock <IReceivePort <NamingConventionSpy> >();

            receivePortMock.Setup(rp => rp.GetType()).Returns(typeof(TaxAgencyReceivePort));
            receivePortMock.Setup(rp => rp.ApplicationBinding).Returns(applicationBindingMock.Object);
            receivePortMock.Setup(rp => rp.Name).Returns(new NamingConventionSpy {
                Party = "ReceivePortParty"
            });

            var receiveLocationMock = new Mock <IReceiveLocation <NamingConventionSpy> >();

            receiveLocationMock.Setup(rl => rl.GetType()).Returns(typeof(BankReceiveLocation));
            receiveLocationMock.Setup(rl => rl.ReceivePort).Returns(receivePortMock.Object);
            receiveLocationMock.Setup(rl => rl.Transport)
            .Returns(new ReceiveLocationTransport <NamingConventionSpy>(receiveLocationMock.Object)
            {
                Adapter = new FileAdapter.Inbound(_ => { })
            });

            var sut = new NamingConventionSpy {
                Subject = "SomeMessage", MessageFormat = "SomeFormat"
            };

            Invoking(() => sut.ComputeReceiveLocationNameSpy(receiveLocationMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithMessage($"'{nameof(BankReceiveLocation)}' ReceiveLocation's Aggregate, 'Income', does not match its ReceivePort's one, 'Invoice'.");
        }
Esempio n. 3
0
        public void ComputeReceiveLocationNameDoesNotRequireAggregateToMatchItsReceivePortOneIfItHasNone()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

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

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

            var receivePortMock = new Mock <IReceivePort <NamingConventionSpy> >();

            receivePortMock.Setup(rp => rp.GetType()).Returns(typeof(StandaloneReceivePort));
            receivePortMock.Setup(rp => rp.ApplicationBinding).Returns(applicationBindingMock.Object);
            receivePortMock.Setup(rp => rp.Name).Returns(new NamingConventionSpy {
                Party = "ReceivePortParty"
            });

            var receiveLocationMock = new Mock <IReceiveLocation <NamingConventionSpy> >();

            receiveLocationMock.Setup(rl => rl.GetType()).Returns(typeof(BankReceiveLocation));
            receiveLocationMock.Setup(rl => rl.ReceivePort).Returns(receivePortMock.Object);
            receiveLocationMock.Setup(rl => rl.Transport)
            .Returns(new ReceiveLocationTransport <NamingConventionSpy>(receiveLocationMock.Object)
            {
                Adapter = new FileAdapter.Inbound(_ => { })
            });

            var sut = new NamingConventionSpy {
                Subject = "SomeMessage", MessageFormat = "SomeFormat"
            };

            Invoking(() => sut.ComputeReceiveLocationNameSpy(receiveLocationMock.Object)).Should().NotThrow();
        }
Esempio n. 4
0
        public void ComputeReceiveLocationNameRequiresParty()
        {
            var receivePortMock = new Mock <IReceivePort <NamingConventionSpy> >();

            receivePortMock.Setup(rp => rp.Name).Returns(new NamingConventionSpy());

            var receiveLocationMock = new Mock <IReceiveLocation <NamingConventionSpy> >();

            receiveLocationMock.Setup(rp => rp.GetType()).Returns(typeof(BankReceiveLocation));
            receiveLocationMock.Setup(rl => rl.ReceivePort).Returns(receivePortMock.Object);

            var sut = new NamingConventionSpy();

            Invoking(() => sut.ComputeReceiveLocationNameSpy(receiveLocationMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithMessage($"'{nameof(BankReceiveLocation)}' ReceiveLocation's Party is required.");
        }
Esempio n. 5
0
        public void ComputeReceiveLocationNameRequiresNonNullMessageFormat()
        {
            var receivePortMock = new Mock <IReceivePort <NamingConventionSpy> >();

            receivePortMock.Setup(rp => rp.Name).Returns(new NamingConventionSpy {
                Party = "ReceivePortParty"
            });

            var receiveLocationMock = new Mock <IReceiveLocation <NamingConventionSpy> >();

            receiveLocationMock.Setup(rl => rl.ReceivePort).Returns(receivePortMock.Object);

            var sut = new NamingConventionSpy {
                Subject = "SomeMessage"
            };

            Invoking(() => sut.ComputeReceiveLocationNameSpy(receiveLocationMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithMessage("A non null MessageFormat is required.");
        }
Esempio n. 6
0
        public void ComputeReceiveLocationNameRequiresPartyToMatchItsReceivePortOne()
        {
            var receivePortMock = new Mock <IReceivePort <NamingConventionSpy> >();

            receivePortMock.Setup(rp => rp.Name).Returns(new NamingConventionSpy {
                Party = "ReceivePortParty"
            });

            var receiveLocationMock = new Mock <IReceiveLocation <NamingConventionSpy> >();

            receiveLocationMock.Setup(rp => rp.GetType()).Returns(typeof(BankReceiveLocation));
            receiveLocationMock.Setup(rl => rl.ReceivePort).Returns(receivePortMock.Object);

            var sut = new NamingConventionSpy {
                Party = "ReceiveLocationParty", Subject = "SomeMessage", MessageFormat = "SomeFormat"
            };

            Invoking(() => sut.ComputeReceiveLocationNameSpy(receiveLocationMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithMessage($"'{nameof(BankReceiveLocation)}' ReceiveLocation's Party, 'ReceiveLocationParty', does not match its ReceivePort's one, 'ReceivePortParty'.");
        }