public void GetBaseUri_returns_root_of_the_domain_when_the_request_is_https() { // Arrange var requestUri = new Uri("https://example.com/foo"); var expectedUri = new Uri("https://example.com/"); var sut = new ApplicationBaseUriProvider(Mock.Of <HttpRequestBase>(x => x.Url == requestUri), null); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); }
public void GetBaseUri_returns_root_of_the_application_when_url_helper_indicates_a_path() { // Arrange var requestUri = new Uri("https://example.com/foo/bar/baz"); var urlHelper = Mock.Of <UrlHelper>(x => x.Content("~") == "/foo/"); var expectedUri = new Uri("https://example.com/foo/"); var sut = new ApplicationBaseUriProvider(Mock.Of <HttpRequestBase>(x => x.Url == requestUri), urlHelper); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); }