public void GivenContextIsNull_GetLinkedItemNames_ReturnsEmptyString() { var itemNamesConcatenated = new ItemNamesConcatenated(); var result = itemNamesConcatenated.GetLinkedItemNames(null, string.Empty); Assert.That(result, Is.EqualTo(string.Empty)); }
public void GivenFieldIsNull_GetLinkedItemNames_ReturnsEmptyString() { var fieldCollection = FieldCollectionBuilder.Create() .WithNullMultiListField("field1") .Build(); var contextItem = ItemBuilder.Create() .WithFieldCollection(fieldCollection) .Build(); var indexable = IndexableBuilder.Create() .WithItem(contextItem) .Build(); var itemNamesConcatenated = new ItemNamesConcatenated(); var result = itemNamesConcatenated.GetLinkedItemNames(indexable, "field1"); Assert.That(result, Is.EqualTo(string.Empty)); }
public void GivenContextIsValid_GetLinkedItemNames_ReturnsCorrectValue() { var fieldCollection = FieldCollectionBuilder.Create() .WithMultiListField("field1", new [] {"Value1", "Value 2","value3"}) .Build(); var contextItem = ItemBuilder.Create() .WithFieldCollection(fieldCollection) .Build(); var indexable = IndexableBuilder.Create() .WithItem(contextItem) .Build(); var itemNamesConcatenated = new ItemNamesConcatenated(); var result = itemNamesConcatenated.GetLinkedItemNames(indexable, "field1"); Assert.That(result, Is.EqualTo("Value1 | Value 2 | value3" )); }
public object ComputeFieldValue(IIndexable indexable) { var itemNamesConcatenated = new ItemNamesConcatenated(); return itemNamesConcatenated.GetLinkedItemNames(new IndexableWrapper(indexable), LinkedField); }