Beispiel #1
0
            public void SetUp()
            {
                pagesRetrieverMock = Substitute.For <IPagesRetriever>();
                richTextGetLinkMetadataActionExecutor = new RichTextGetLinkMetadataActionExecutor(pagesRetrieverMock, "/");

                VirtualContext.SetItem(VirtualContext.PARAM_PREVIEW_LINK, "pv");
                MembershipContext.AuthenticatedUser = Substitute.For <CurrentUserInfo>();
            }
            public void GetObjects_VirtualContextNotInitialized_ThrowsExceptionWithForbiddenStatus()
            {
                VirtualContext.SetItem(VirtualContext.PARAM_PREVIEW_LINK, null);

                var siteService      = Substitute.For <ISiteService>();
                var objectsRetriever = Substitute.For <ObjectsRetriever>(siteService);

                var controllerInstance = new KenticoObjectSelectorController(objectsRetriever);

                var exception = Assert.Throws <HttpResponseException>(() => controllerInstance.GetObjects("", 0));

                Assert.That(exception.Response.StatusCode, Is.EqualTo(HttpStatusCode.Forbidden));
            }
Beispiel #3
0
            public void ProcessAction_PreviewLinkNotInitialized_ReturnsStatusCodeForbidden()
            {
                VirtualContext.SetItem(VirtualContext.PARAM_PREVIEW_LINK, null);

                var result = richTextGetLinkMetadataActionExecutor.ProcessAction("/page");

                Assert.Multiple(() =>
                {
                    Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.Forbidden));
                    Assert.That(result.StatusCodeMessage, Is.Not.Empty);
                    Assert.That(result.StatusCodeMessage, Is.Not.Null);
                });
            }
 public void SetUp()
 {
     VirtualContext.SetItem(VirtualContext.PARAM_PREVIEW_LINK, "pv");
 }
Beispiel #5
0
 public void TearDown()
 {
     VirtualContext.SetItem(VirtualContext.PARAM_PREVIEW_LINK, null);
     MembershipContext.AuthenticatedUser = null;
 }
 private static void FakeVirtualContext()
 {
     VirtualContext.SetItem(VirtualContext.PARAM_PREVIEW_LINK, "testPreviewLink");
     ValidationHelper.HashStringSalt = "78a60095-2b09-40c2-9a9d-e2cc0b511aca";
     VirtualContext.CurrentURLPrefix = "/testPrefix";
 }