public void Should_return_an_http_not_found_result() { var sut = new LinkController( Substitute.For <IRetrieveLinks>(), Substitute.For <ISaveLinks>()); var result = sut.Follow("unknown-link-id"); result.Should().BeOfType <NotFoundResult>(); }
public void Should_return_an_http_moved_result() { var getLink = Substitute.For <IRetrieveLinks>(); getLink.WithId("id").Returns(new Link("id,", "http://example.com")); var sut = new LinkController(getLink, Substitute.For <ISaveLinks>()); var result = sut.Follow("id"); result.Should().BeOfType <RedirectResult>(); }
public void Should_return_the_url_of_the_link() { var getLink = Substitute.For <IRetrieveLinks>(); getLink.WithId("id").Returns(new Link("id,", "http://example.com")); var sut = new LinkController(getLink, Substitute.For <ISaveLinks>()); var result = sut.Follow("id"); result.Should().BeOfType <RedirectResult>() .Which.Location.Should().Be("http://example.com/"); }