public override bool IsValid(object value) { var collection = ((IEnumerable)(value ?? new string[0])).OfType<object>().ToArray(); return collection.Length == 0 || collection.Any(v => v != null && !string.IsNullOrWhiteSpace(v.ToString())); } }
public void CollectionWithBlankStringShouldFail() { var attribute = new NonEmptyCollectionItemAttribute(); Assert.IsFalse(attribute.IsValid(new ReferenceCollection(new[] {""}))); }