Beispiel #1
0
 public void ShouldGetEmptyVersionsIfNoFakeItemFound(
     [Greedy] FakeDataProvider sut,
     ItemDefinition def,
     CallContext context)
 {
     sut.GetItemVersions(def, context).Should().BeEmpty();
 }
        public void ShouldGetAllThePossibleItemVersions([Greedy] FakeDataProvider sut, ItemDefinition def, CallContext context)
        {
            // arrange
            var item = new DbItem("home", def.ID, def.TemplateID)
            {
                Fields =
                {
                    new DbField("Field 1")
                    {
                        { "en", 1, string.Empty }, { "en", 2, string.Empty }, { "da", 1, string.Empty }
                    },
                    new DbField("Field 2")
                    {
                        { "en", 1, string.Empty }, { "da", 1, string.Empty }, { "da", 2, string.Empty }
                    }
                }
            };

            sut.DataStorage.GetFakeItem(def.ID).Returns(item);

            // act
            var versions = sut.GetItemVersions(def, context);

            // assert
            versions.Count.Should().Be(4);
            versions[0].Language.Name.Should().Be("en");
            versions[0].Version.Number.Should().Be(1);
            versions[1].Language.Name.Should().Be("en");
            versions[1].Version.Number.Should().Be(2);
            versions[2].Language.Name.Should().Be("da");
            versions[2].Version.Number.Should().Be(1);
            versions[3].Language.Name.Should().Be("da");
            versions[3].Version.Number.Should().Be(2);
        }