public void GetIdFromIdUrl_NoIdInUrl_Equal() { var fixture = new UmbracoUrlServiceTestFixture(); var sut = fixture.Create <UmbracoUrlService>(); var result = sut.GetIdFromIdUrl("/url/with-no-id"); Assert.Equal(0, result); }
public void GetIdFromIdUrl_MultipleIntegersInUrl_Equal() { var fixture = new UmbracoUrlServiceTestFixture(); var sut = fixture.Create <UmbracoUrlService>(); var result = sut.GetIdFromIdUrl("1234/url/with-id/5678"); Assert.Equal(1234, result); }
public void GetIdFromIdUrl_NoUrl_Equal() { var fixture = new UmbracoUrlServiceTestFixture(); var sut = fixture.Create <UmbracoUrlService>(); var result = sut.GetIdFromIdUrl(string.Empty); Assert.Equal(0, result); }
public void GetUrlFromIdUrl_NoDomains_Equal() { var fixture = new UmbracoUrlServiceTestFixture(); using (var umbracoContextReference = fixture.EnsureUmbracoContext()) { fixture.UmbracoContextProvider .GetContext() .Returns(umbracoContextReference.UmbracoContext); fixture.DomainCache .GetAssigned(Arg.Any <int>(), Arg.Any <bool>()) .Returns(new List <Domain>()); var sut = fixture.Create <UmbracoUrlService>(); var result = sut.GetUrlFromIdUrl("1234/url/with-id", "en-US"); Assert.Equal("/url/with-id", result); } }
public void GetUrlFromIdUrl_Domains_Equal() { var fixture = new UmbracoUrlServiceTestFixture(); using (var umbracoContextReference = fixture.EnsureUmbracoContext()) { fixture.UmbracoContextProvider .GetContext() .Returns(umbracoContextReference.UmbracoContext); umbracoContextReference.UmbracoContext.Domains .GetAssigned(1234, false) .Returns(new List <Domain>() { new Domain(5678, "https://enterspeed.com", 1234, new CultureInfo("en-US"), false) }); var sut = fixture.Create <UmbracoUrlService>(); var result = sut.GetUrlFromIdUrl("1234/url/with-id", "en-US"); Assert.Equal("https://enterspeed.com/url/with-id", result); } }