本文整理汇总了C#中DbItem.AddVersion方法的典型用法代码示例。如果您正苦于以下问题:C# DbItem.AddVersion方法的具体用法?C# DbItem.AddVersion怎么用?C# DbItem.AddVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbItem
的用法示例。
在下文中一共展示了DbItem.AddVersion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldDecreaseFakeItemVersionCount
public void ShouldDecreaseFakeItemVersionCount(RemoveVersionCommand sut, Item item, DbItem dbItem)
{
// arrange
dbItem.AddVersion("en");
dbItem.AddVersion("en");
sut.DataStorage.GetFakeItem(item.ID).Returns(dbItem);
sut.Initialize(item);
// act
var result = (bool)ReflectionUtil.CallMethod(sut, "DoExecute");
// assert
result.Should().BeTrue();
dbItem.GetVersionCount("en").Should().Be(1);
}
示例2: ShouldGetItemVersionsCount
public void ShouldGetItemVersionsCount(GetVersionsCommand sut, Item item, Language language, DbItem versionedItem)
{
// arrange
versionedItem.AddVersion(language.Name);
versionedItem.AddVersion(language.Name);
sut.DataStorage.GetFakeItem(item.ID).Returns(versionedItem);
sut.Initialize(item, language);
// act
var versionCollection = (VersionCollection)ReflectionUtil.CallMethod(sut, "DoExecute");
// assert
versionCollection.Count.Should().Be(2);
versionCollection.Should().BeEquivalentTo(new Version(1), new Version(2));
}
示例3: ShouldAddFewVersions
public void ShouldAddFewVersions(DbItem sut)
{
sut.AddVersion("en");
sut.AddVersion("en");
sut.GetVersionCount("en").Should().Be(2);
}
示例4: AddVersionThrowsIfVersionIsNegative
public void AddVersionThrowsIfVersionIsNegative(DbItem sut)
{
Action action = () => sut.AddVersion("en", -1);
action.ShouldThrow<ArgumentOutOfRangeException>().WithMessage("*version");
}
示例5: AddVersionThrowsIfLanguageIsNull
public void AddVersionThrowsIfLanguageIsNull(DbItem sut)
{
Action action = () => sut.AddVersion(null, 0);
action.ShouldThrow<ArgumentNullException>().WithMessage("*language");
}