예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void GetIdFromIdUrl_NoUrl_Equal()
        {
            var fixture = new UmbracoUrlServiceTestFixture();

            var sut = fixture.Create <UmbracoUrlService>();

            var result = sut.GetIdFromIdUrl(string.Empty);

            Assert.Equal(0, result);
        }
예제 #4
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);
            }
        }
예제 #5
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);
            }
        }