本文整理匯總了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");
}