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"); }
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'."); }
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(); }
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."); }
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."); }
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'."); }