Пример #1
0
        public void DeleteFromIndex_MissingContentlink_DoesNotCallDelete()
        {
            _fixture.ServiceLocationMock.IndexerMock.Reset();

            IndexingEvents.DeleteFromIndex(null, null);

            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Delete(It.IsAny <ContentReference>()), Times.Never);
        }
Пример #2
0
        public void UpdateIndex_PublishEvent_CallsUpdate()
        {
            var input = GetPublishScenario();

            _fixture.ServiceLocationMock.IndexerMock.Reset();

            IndexingEvents.UpdateIndex(null, input.Args);

            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Update(input.Content, null), Times.Once);
        }
Пример #3
0
        public void DeleteFromIndex_ValidContentlink_CallsDelete()
        {
            var input = GetDeleteScenario();

            _fixture.ServiceLocationMock.IndexerMock.Reset();

            IndexingEvents.DeleteFromIndex(null, input.Args);

            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Delete(input.Content.ContentLink), Times.Once);
        }
Пример #4
0
        public void UpdateIndex_PageInWasteBasket_CallsDelete()
        {
            var input = GetMoveToWasteBasketScenario();

            _fixture.ServiceLocationMock.IndexerMock.Reset();

            IndexingEvents.UpdateIndex(null, input.Args);

            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Delete(input.Content.ContentLink), Times.Once);
            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Update(input.Content, null), Times.Never);
        }
Пример #5
0
        public void UpdateIndex_MoveWithDescendents_UpdatesAll()
        {
            var child1 = Factory.GetPageData();
            var child2 = Factory.GetPageData();
            var input  = GetMoveScenario(child1.ContentLink, child2.ContentLink);

            _fixture.ServiceLocationMock.ContentLoaderMock
            .Setup(m => m.GetItems(new[] { child1.ContentLink, child2.ContentLink }, It.IsAny <CultureInfo>()))
            .Returns(new[] { child1, child2 });

            _fixture.ServiceLocationMock.IndexerMock.Reset();

            IndexingEvents.UpdateIndex(null, input.Args);

            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Update(input.Content, null), Times.Once);
            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Update(child1, null), Times.Once);
            _fixture.ServiceLocationMock.IndexerMock.Verify(m => m.Update(child2, null), Times.Once);
        }