本文整理汇总了C#中DbItem.Add方法的典型用法代码示例。如果您正苦于以下问题:C# DbItem.Add方法的具体用法?C# DbItem.Add怎么用?C# DbItem.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbItem
的用法示例。
在下文中一共展示了DbItem.Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldReturnItemChildren
public void ShouldReturnItemChildren(GetChildrenCommand sut, DbItem dbitem, DbItem dbchild1, DbItem dbchild2, Item item, Item child1, Item child2)
{
// arrange
dbitem.Add(dbchild1);
dbitem.Add(dbchild2);
sut.DataStorage.GetFakeItem(item.ID).Returns(dbitem);
sut.DataStorage.GetSitecoreItem(dbchild1.ID, item.Language).Returns(child1);
sut.DataStorage.GetSitecoreItem(dbchild2.ID, item.Language).Returns(child2);
sut.Initialize(item);
// act
var children = (ItemList)ReflectionUtil.CallMethod(sut, "DoExecute");
// assert
children[0].Should().Be(child1);
children[1].Should().Be(child2);
}
示例2: ShouldAddChildItem
public void ShouldAddChildItem()
{
// arrange
var parent = new DbItem("parent");
var child = new DbItem("child");
// act
parent.Add(child);
// assert
parent.Children.Single().Should().BeEquivalentTo(child);
}
示例3: ShouldReturnTrueIfHasChildren
public void ShouldReturnTrueIfHasChildren(HasChildrenCommand sut, Item item, DbItem fakeItem, DbItem child)
{
// arrange
fakeItem.Add(child);
sut.DataStorage.GetSitecoreItem(item.ID, item.Language).Returns(item);
sut.DataStorage.GetFakeItem(item.ID).Returns(fakeItem);
sut.Initialize(item);
// act
var result = (bool)ReflectionUtil.CallMethod(sut, "DoExecute");
// assert
result.Should().BeTrue();
}
示例4: ShouldSetChildItemFullPathOnDbInit
public void ShouldSetChildItemFullPathOnDbInit()
{
// arrange
var parent = new DbItem("parent");
var child = new DbItem("child");
parent.Add(child);
// act
using (new Db { parent })
{
// assert
child.FullPath.Should().Be("/sitecore/content/parent/child");
}
}
示例5: AddThrowsIfFieldIdIsNull
public void AddThrowsIfFieldIdIsNull(DbItem sut, string value)
{
Action action = () => sut.Add((ID)null, value);
action.ShouldThrow<ArgumentNullException>().WithMessage("*fieldId");
}
示例6: SutAddsChildItem
public void SutAddsChildItem(DbItem sut, DbItem child)
{
sut.Add(child);
sut.Children.Single().Should().BeEquivalentTo(child);
}
示例7: ShouldReturnFalseIfNoValueFoundForLanguage
public void ShouldReturnFalseIfNoValueFoundForLanguage(DbItem sut, DbField field, string language)
{
field.Values[language] = new Dictionary<int, string>();
sut.Add(field);
sut.RemoveVersion(language).Should().BeFalse();
}
示例8: AddThrowsIfChildItemIsNull
public void AddThrowsIfChildItemIsNull(DbItem sut)
{
Action action = () => sut.Add((DbItem)null);
action.ShouldThrow<ArgumentNullException>().WithMessage("*child");
}