Example #1
0
        public void AddVersionThrowsIfItemDefinitionNotFound(
            [Greedy] FakeDataProvider sut,
            ItemDefinition itemDefinition,
            VersionUri baseVersion)
        {
            Action action = () => sut.AddVersion(itemDefinition, baseVersion, null);

            action.ShouldThrow <InvalidOperationException>()
            .WithMessage("Unable to add item version. The item '{0}' is not found.".FormatWith(itemDefinition.ID));
        }
Example #2
0
        public void AddVersionAddsNewVersionAndReturnsNewVersionNumber(
            [Greedy] FakeDataProvider sut,
            ItemDefinition itemDefinition,
            Language language,
            int version,
            DbItem item)
        {
            sut.DataStorage.GetFakeItem(itemDefinition.ID).Returns(item);
            var baseVersion     = new VersionUri(language, Version.Parse(version));
            var expectedVersion = version + 1;

            var result = sut.AddVersion(itemDefinition, baseVersion, null);

            result.Should().Be(expectedVersion);
            item.GetVersionCount(language.Name).Should().Be(expectedVersion);
        }
Example #3
0
        public void AddVersionThrowsIfBaseVersionIsNull(FakeDataProvider sut, ItemDefinition itemDefinition)
        {
            Action action = () => sut.AddVersion(itemDefinition, null, null);

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