public void ShouldRemoveVersionFromFakeDbFields() { // arrange var itemId = ID.NewID; var dbitem = new DbItem("item") { Fields = { new DbField("Title") { { "en", "Hello!" } } } }; this.dataStorage.GetFakeItem(itemId).Returns(dbitem); var item = ItemHelper.CreateInstance(this.database, itemId); var command = new OpenRemoveVersionCommand(); command.Initialize(item); command.Initialize(this.dataStorage); // act var result = command.DoExecute(); // assert result.Should().BeTrue(); dbitem.Fields.Single().Values["en"].Values.Should().BeEmpty(); }
public void ShouldNotRemoveVersionIfNoVersionFoundInSpecificLanguage() { // arrange var itemId = ID.NewID; var dbitem = new DbItem("item") { Fields = { new DbField("Title") } }; this.dataStorage.GetFakeItem(itemId).Returns(dbitem); var item = ItemHelper.CreateInstance(this.database, itemId); var command = new OpenRemoveVersionCommand(); command.Initialize(item); command.Initialize(this.dataStorage); // act var result = command.DoExecute(); // assert result.Should().BeFalse(); }
public void ShouldDecreaseFakeItemVersionCount() { // arrange var itemId = ID.NewID; var dbitem = new DbItem("item"); dbitem.VersionsCount.Add("en", 2); this.dataStorage.GetFakeItem(itemId).Returns(dbitem); var item = ItemHelper.CreateInstance(this.database, itemId); var command = new OpenRemoveVersionCommand(); command.Initialize(item); command.Initialize(this.dataStorage); // act var result = command.DoExecute(); // assert result.Should().BeTrue(); dbitem.VersionsCount["en"].Should().Be(1); }