public void ComputeReceivePortNameRequiresApplicationBinding() { var receivePortMock = new Mock <IReceivePort <NamingConventionDouble> >(); receivePortMock.Setup(rp => rp.GetType()).Returns(typeof(StandaloneReceivePort)); var sut = new NamingConventionDouble(); Assert.That( () => sut.ComputeReceivePortNameSpy(receivePortMock.Object), Throws.TypeOf <NamingConventionException>().With.Message.EqualTo( string.Format( "'{0}' ReceivePort is not bound to application's receive port collection.", typeof(StandaloneReceivePort).Name))); }
public void ComputeReceivePortNameEmbedsApplicationNameAndParty() { var applicationBindingMock = new Mock <IApplicationBinding <NamingConventionDouble> >(); applicationBindingMock.As <ISupportNamingConvention>().Setup(snc => snc.Name).Returns("SomeApplication"); var receivePortMock = new Mock <IReceivePort <NamingConventionDouble> >(); receivePortMock.Setup(rp => rp.GetType()).Returns(typeof(StandaloneReceivePort)); receivePortMock.Setup(rp => rp.ApplicationBinding).Returns(applicationBindingMock.Object); var sut = new NamingConventionDouble { Party = "SomeParty" }; Assert.That(sut.ComputeReceivePortNameSpy(receivePortMock.Object), Is.EqualTo("SomeApplication.RP1.SomeParty")); }