Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }