Esempio n. 1
0
		public void SharedFields_DoesNotReturnVersionedValues(Db db, DbItem item, Guid fieldId)
		{
			item.Fields.Add(new DbField(new ID(fieldId)) { Value = "test field" });

			var dbItem = db.CreateItem(item);

			new ItemData(dbItem).SharedFields.Any(f => f.FieldId == fieldId).Should().BeFalse();
		}
Esempio n. 2
0
		public void SharedFields_ReturnsExpectedValues(Db db, DbItem item, Guid fieldId)
		{
			item.Fields.Add(new DbField(new ID(fieldId)) { Shared = true, Value = "test field" });

			var dbItem = db.CreateItem(item);

			new ItemData(dbItem).SharedFields.Any(f => f.FieldId == fieldId).Should().BeTrue();
		}
Esempio n. 3
0
        public void Field_Value_ReturnsExpectedValue(Db db, DbItem item, Guid fieldId)
        {
            item.Fields.Add(new DbField(new ID(fieldId))
            {
                Shared = true,
                Value = "test"
            });

            var dbItem = db.CreateItem(item);

            new ItemData(dbItem).SharedFields.First(f => f.FieldId == fieldId).FieldId.Should().Be(fieldId);
        }
Esempio n. 4
0
        public void Field_NameHint_ReturnsExpectedValue(Db db, DbItem item, Guid fieldId)
        {
            item.Fields.Add(new DbField(new ID(fieldId))
            {
                Name = "Foo",
                Shared = true,
                Value = "foo"
            });

            var dbItem = db.CreateItem(item);

            new ItemData(dbItem).SharedFields.First(f => f.FieldId == fieldId).NameHint.Should().Be("Foo");
        }
Esempio n. 5
0
		public void Versions_ReturnsExpectedVersions(Db db, DbItem item, Guid fieldId)
		{
			item.Fields.Add(new DbField(new ID(fieldId))
				{
					{"en", 1, "test value"},
					{"en", 2, "test v2"}
				});

			var dbItem = db.CreateItem(item);
			var itemData = new ItemData(dbItem);

			dbItem.Versions.Count.Should().Be(itemData.Versions.Count());
			itemData.Versions.Any(v => v.Language.Name == "en" && v.VersionNumber == 1).Should().BeTrue();
			itemData.Versions.Any(v => v.Language.Name == "en" && v.VersionNumber == 2).Should().BeTrue();
		}
Esempio n. 6
0
		public void Version_Fields_DoesNotReturnSharedValues(Db db, DbItem item, Guid fieldId)
		{
			item.Fields.Add(new DbField(new ID(fieldId)) {Shared = true, Value = "test"});

			var dbItem = db.CreateItem(item);

			new ItemData(dbItem).Versions.First().Fields.FirstOrDefault(f => f.FieldId == fieldId).Should().BeNull();
		}
Esempio n. 7
0
		public void Version_Fields_ReturnsExpectedValues(Db db, DbItem item, Guid fieldId)
		{
			item.Fields.Add(new DbField(new ID(fieldId))
			{
				{"en", 1, "test"}
			});

			var dbItem = db.CreateItem(item);

			new ItemData(dbItem).Versions.First().Fields.First(f => f.FieldId == fieldId).Value.Should().Be("test");
		}