示例#1
0
        public void GetRedirects_RedirectsFoundForCulture_Equal()
        {
            var fixture = new UmbracoRedirectsServiceTestFixture();
            var guid    = Guid.NewGuid();

            var expected = "/en-us/redirect";

            fixture.RedirectUrlService
            .GetContentRedirectUrls(guid)
            .Returns(new List <IRedirectUrl>()
            {
                new RedirectUrl()
                {
                    ContentId  = 1234,
                    ContentKey = guid,
                    Culture    = "en-US",
                    Url        = expected
                }
            });

            fixture.UmbracoUrlService
            .GetUrlFromIdUrl(Arg.Any <string>(), Arg.Any <string>())
            .Returns(expected);

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

            var redirect = sut.GetRedirects(guid, "en-US")[0];

            Assert.Equal(expected, redirect);
        }
示例#2
0
        public void GetRedirects_NoRedirectsFound_Empty()
        {
            var fixture = new UmbracoRedirectsServiceTestFixture();
            var guid    = Guid.NewGuid();

            fixture.RedirectUrlService
            .GetContentRedirectUrls(guid)
            .Returns(new List <IRedirectUrl>());

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

            Assert.Empty(sut.GetRedirects(guid, "en-US"));
        }
示例#3
0
        public void GetRedirects_NoRedirectsFoundForCulture_Empty()
        {
            var fixture = new UmbracoRedirectsServiceTestFixture();
            var guid    = Guid.NewGuid();

            fixture.RedirectUrlService
            .GetContentRedirectUrls(guid)
            .Returns(new List <IRedirectUrl>()
            {
                new RedirectUrl()
                {
                    ContentId  = 1234,
                    ContentKey = guid,
                    Culture    = "da-DK",
                    Url        = "/da-dk/redirect"
                }
            });

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

            Assert.Empty(sut.GetRedirects(guid, "en-US"));
        }