public void CanAddMessagesByRange()
        {
            // Arrange
            var messages = new ValidationMessageStore(new EditContext(new object()));
            var field1   = new FieldIdentifier(new object(), "field1");
            var entries  = new[] { "A", "B", "C" };

            // Act
            messages.AddRange(field1, entries);

            // Assert
            Assert.Equal(entries, messages[field1]);
        }
예제 #2
0
 /// <summary>
 /// Adds the messages from the specified collection for the specified field.
 /// </summary>
 /// <param name="store">The <see cref="ValidationMessageStore"/>.</param>
 /// <param name="accessor">Identifies the field for which to add the messages.</param>
 /// <param name="messages">The validation messages to be added.</param>
 public static void AddRange(this ValidationMessageStore store, Expression <Func <object> > accessor, IEnumerable <string> messages)
 => store.AddRange(FieldIdentifier.Create(accessor), messages);