Example #1
0
        public void GetParentIdThrowsIfItemDefinitionIsNull(
            [Greedy] FakeDataProvider sut,
            CallContext context)
        {
            Action action = () => sut.GetParentID(null, context);

            action.ShouldThrow <ArgumentNullException>().WithMessage("*itemDefinition");
        }
Example #2
0
        public void GetParentIdReturnsNullIfNoItemFound(
            [Greedy] FakeDataProvider sut,
            ItemDefinition itemDefinition,
            CallContext context)
        {
            var result = sut.GetParentID(itemDefinition, context);

            result.Should().BeNull();
        }
Example #3
0
        public void GetParentIdReturnsParentId(
            [Greedy] FakeDataProvider sut,
            ItemDefinition itemDefinition,
            DbItem item,
            CallContext context)
        {
            sut.DataStorage.GetFakeItem(itemDefinition.ID).Returns(item);
            var result = sut.GetParentID(itemDefinition, context);

            result.Should().Be(item.ParentID);
        }
Example #4
0
        public void GetParentIdReturnsNullForSitecoreRootItem(
            [Greedy] FakeDataProvider sut,
            string itemName,
            ID id,
            ID templateId,
            CallContext context)
        {
            var itemDefinition = new ItemDefinition(ItemIDs.RootID, itemName, id, templateId);
            var result         = sut.GetParentID(itemDefinition, context);

            result.Should().BeNull();
        }