Skip to content

Commit

Permalink
one more test to check for custom ports
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Apr 28, 2019
1 parent 84ad149 commit 1d31958
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Nancy.Rdf.Tests/RdfResponseProcessorTests.cs
Expand Up @@ -175,6 +175,35 @@ public void Should_not_contain_unnecessary_443_port_in_base_url()
A<MemoryStream>._)).MustHaveHappened();
}

[Test]
public void Should_not_preserve_custom_port_in_base_url()
{
// given
var serializer = A.Fake<IRdfSerializer>();
A.CallTo(() => serializer.CanSerialize(A<MediaRange>.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<MediaRange>.That.Matches(mr => mr == RdfSerialization.RdfXml.MediaType),
A<WrappedModel>.That.Matches(wm => wm.BaseUrl.ToString() == "http://example.com:2345/"),
A<MemoryStream>._)).MustHaveHappened();
}

[Test]
public void Should_pass_actual_requested()
{
Expand Down

0 comments on commit 1d31958

Please sign in to comment.