예제 #1
0
 public void RemoveVersionReturnsFalseIfNoVersionFound(
     [Greedy] FakeDataProvider sut,
     ItemDefinition itemDefinition,
     VersionUri version,
     DbItem item)
 {
     sut.DataStorage.GetFakeItem(itemDefinition.ID).Returns(item);
     sut.RemoveVersion(itemDefinition, version, null).Should().BeFalse();
 }
예제 #2
0
        public void RemoveVersionThrowsIfItemDefinitionNotFound(
            [Greedy] FakeDataProvider sut,
            ItemDefinition itemDefinition,
            VersionUri baseVersion)
        {
            Action action = () => sut.RemoveVersion(itemDefinition, baseVersion, null);

            action.ShouldThrow <InvalidOperationException>()
            .WithMessage("Unable to remove item version. The item '{0}' is not found.".FormatWith(itemDefinition.ID));
        }
예제 #3
0
        public void RemoveVersionRemovesVersionAndReturnsTrue(
            [Greedy] FakeDataProvider sut,
            ItemDefinition itemDefinition,
            Language language,
            DbItem item)
        {
            sut.DataStorage.GetFakeItem(itemDefinition.ID).Returns(item);
            item.AddVersion(language.Name);
            item.AddVersion(language.Name);
            var       version = new VersionUri(language, Version.Latest);
            const int expectedVersionCount = 1;

            var result = sut.RemoveVersion(itemDefinition, version, null);

            result.Should().BeTrue();
            item.GetVersionCount(language.Name).Should().Be(expectedVersionCount);
        }
예제 #4
0
        public void RemoveVersionThrowsIfBaseVersionIsNull(FakeDataProvider sut, ItemDefinition itemDefinition)
        {
            Action action = () => sut.RemoveVersion(itemDefinition, null, null);

            action.ShouldThrow <ArgumentNullException>().WithMessage("*version");
        }