public void RegisterMessage(Accessor accessor, NotificationMessage notificationMessage) { notificationMessage.AddAccessor(accessor); notificationMessage.AddSubstitution(TemplateValue.For(FIELD, LocalizationManager.GetText(accessor.InnerProperty))); _messages.Fill(notificationMessage); }
public void RegisterMessage <T>(Expression <Func <T, object> > property, string message) { var notificationMessage = new NotificationMessage(message); var accessor = property.ToAccessor(); notificationMessage.AddAccessor(accessor); _messages.Fill(notificationMessage); }
public void prepend_property() { var message = new NotificationMessage(ValidationKeys.Required); message.AddAccessor(ReflectionHelper.GetAccessor<ContinuationRuleTester.ContactModel>(x => x.FirstName)); message.AddAccessor(ReflectionHelper.GetAccessor<ContinuationRuleTester.ContactModel>(x => x.LastName)); var property = ReflectionHelper.GetAccessor<CompositeModel>(x => x.Contact); var prepended = message.Prepend(property); prepended.ShouldNotBeTheSameAs(message); prepended.Accessors.Select(x => x.Name).ShouldHaveTheSameElementsAs("ContactFirstName", "ContactLastName"); prepended.StringToken.ShouldBe(ValidationKeys.Required); }