diff --git a/src/Nancy.Rdf.Tests/RdfResponseProcessorTests.cs b/src/Nancy.Rdf.Tests/RdfResponseProcessorTests.cs index dc7ab09..8f3b6fe 100644 --- a/src/Nancy.Rdf.Tests/RdfResponseProcessorTests.cs +++ b/src/Nancy.Rdf.Tests/RdfResponseProcessorTests.cs @@ -175,6 +175,35 @@ public void Should_not_contain_unnecessary_443_port_in_base_url() A._)).MustHaveHappened(); } + [Test] + public void Should_not_preserve_custom_port_in_base_url() + { + // given + var serializer = A.Fake(); + A.CallTo(() => serializer.CanSerialize(A.Ignored)).Returns(true); + var processor = new RdfResponseProcessorTestable(new[] { serializer }); + + var path = new Url("http://example.com:2345/api/test") + { + BasePath = "api" + }; + + var nancyContext = new NancyContext + { + Request = new Request("GET", path) + }; + + // when + var response = processor.Process(new MediaRange("application/rdf+xml"), new object(), nancyContext); + response.Contents(new MemoryStream()); + + // then + A.CallTo(() => serializer.Serialize( + A.That.Matches(mr => mr == RdfSerialization.RdfXml.MediaType), + A.That.Matches(wm => wm.BaseUrl.ToString() == "http://example.com:2345/"), + A._)).MustHaveHappened(); + } + [Test] public void Should_pass_actual_requested() {