本文整理汇总了C#中Sitecore.FakeDb.Db.CreateItem方法的典型用法代码示例。如果您正苦于以下问题:C# Db.CreateItem方法的具体用法?C# Db.CreateItem怎么用?C# Db.CreateItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sitecore.FakeDb.Db
的用法示例。
在下文中一共展示了Db.CreateItem方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SharedFields_DoesNotReturnVersionedValues
public void SharedFields_DoesNotReturnVersionedValues(Db db, DbItem item, Guid fieldId)
{
item.Fields.Add(new DbField(new ID(fieldId)) { Value = "test field" });
var dbItem = db.CreateItem(item);
new ItemData(dbItem).SharedFields.Any(f => f.FieldId == fieldId).Should().BeFalse();
}
示例2: SharedFields_ReturnsExpectedValues
public void SharedFields_ReturnsExpectedValues(Db db, DbItem item, Guid fieldId)
{
item.Fields.Add(new DbField(new ID(fieldId)) { Shared = true, Value = "test field" });
var dbItem = db.CreateItem(item);
new ItemData(dbItem).SharedFields.Any(f => f.FieldId == fieldId).Should().BeTrue();
}
示例3: Field_Value_ReturnsExpectedValue
public void Field_Value_ReturnsExpectedValue(Db db, DbItem item, Guid fieldId)
{
item.Fields.Add(new DbField(new ID(fieldId))
{
Shared = true,
Value = "test"
});
var dbItem = db.CreateItem(item);
new ItemData(dbItem).SharedFields.First(f => f.FieldId == fieldId).FieldId.Should().Be(fieldId);
}
示例4: Field_NameHint_ReturnsExpectedValue
public void Field_NameHint_ReturnsExpectedValue(Db db, DbItem item, Guid fieldId)
{
item.Fields.Add(new DbField(new ID(fieldId))
{
Name = "Foo",
Shared = true,
Value = "foo"
});
var dbItem = db.CreateItem(item);
new ItemData(dbItem).SharedFields.First(f => f.FieldId == fieldId).NameHint.Should().Be("Foo");
}
示例5: Versions_ReturnsExpectedVersions
public void Versions_ReturnsExpectedVersions(Db db, DbItem item, Guid fieldId)
{
item.Fields.Add(new DbField(new ID(fieldId))
{
{"en", 1, "test value"},
{"en", 2, "test v2"}
});
var dbItem = db.CreateItem(item);
var itemData = new ItemData(dbItem);
dbItem.Versions.Count.Should().Be(itemData.Versions.Count());
itemData.Versions.Any(v => v.Language.Name == "en" && v.VersionNumber == 1).Should().BeTrue();
itemData.Versions.Any(v => v.Language.Name == "en" && v.VersionNumber == 2).Should().BeTrue();
}
示例6: Version_Fields_DoesNotReturnSharedValues
public void Version_Fields_DoesNotReturnSharedValues(Db db, DbItem item, Guid fieldId)
{
item.Fields.Add(new DbField(new ID(fieldId)) {Shared = true, Value = "test"});
var dbItem = db.CreateItem(item);
new ItemData(dbItem).Versions.First().Fields.FirstOrDefault(f => f.FieldId == fieldId).Should().BeNull();
}
示例7: Version_Fields_ReturnsExpectedValues
public void Version_Fields_ReturnsExpectedValues(Db db, DbItem item, Guid fieldId)
{
item.Fields.Add(new DbField(new ID(fieldId))
{
{"en", 1, "test"}
});
var dbItem = db.CreateItem(item);
new ItemData(dbItem).Versions.First().Fields.First(f => f.FieldId == fieldId).Value.Should().Be("test");
}