Ejemplo n.º 1
0
        public void Call_PurgePage_WithValidCommandAndPageContentNotAllowed_ShouldReturnErrorResponse()
        {
            // Arrange
            int     tabId    = 91;
            int     portalId = 1;
            TabInfo tab      = new TabInfo();

            tab.TabID    = tabId;
            tab.PortalID = portalId;
            PortalSettings portalSettings = new PortalSettings();

            portalSettings.PortalId = portalId;

            _tabControllerMock.Setup(t => t.GetTab(tabId, portalId)).Returns(tab);
            _contentVerifierMock.Setup(p => p.IsContentExistsForRequestedPortal(portalId, portalSettings, It.IsAny <Boolean>())).Returns(false);

            IConsoleCommand purgeCommand = new PurgePage(_tabControllerMock.Object, _recyclebinControllerMock.Object, _contentVerifierMock.Object);

            var args = new[] { "purge-page", tabId.ToString() };

            purgeCommand.Initialize(args, portalSettings, null, 0);

            // Act
            var result = purgeCommand.Run();

            // Assert
            Assert.IsTrue(result.IsError);
        }
Ejemplo n.º 2
0
        public void Call_PurgePage_PageDoesNotExist_ShouldReturnErrorResponse()
        {
            // Arrange
            int            tabId          = 919;
            PortalSettings portalSettings = new PortalSettings();

            IConsoleCommand purgeCommand = new PurgePage(_tabControllerMock.Object, _recyclebinControllerMock.Object, _contentVerifierMock.Object);

            var args = new[] { "purge-page", tabId.ToString() };

            purgeCommand.Initialize(args, portalSettings, null, 0);

            // Act
            var result = purgeCommand.Run();

            // Assert
            Assert.IsTrue(result.IsError);
            _tabControllerMock.Verify(t => t.GetTab(tabId, portalSettings.PortalId));
        }