public void AllNegative()
        {
            var expected = new NotificationAssertion();
            expected.RegisterMessage("Name", Notification.REQUIRED_FIELD, Severity.Error);
            expected.RegisterMessage("Amount", Notification.REQUIRED_FIELD, Severity.Error);
            expected.RegisterMessage("TradeDate", Notification.REQUIRED_FIELD, Severity.Error);

            var target = new RequiredPropertyTarget();

            var actual = Validator.ValidateObject(target);
            expected.AssertEquals(actual);
        }
        public void Customize_the_message_builder()
        {
            RequiredAttribute.GetMessage = (att, prop) => prop.Name + " is required";

            var expected = new NotificationAssertion();
            expected.RegisterMessage("Name", "Name is required", Severity.Error);
            expected.RegisterMessage("Amount", "Amount is required", Severity.Error);
            expected.RegisterMessage("TradeDate", "TradeDate is required", Severity.Error);

            var target = new RequiredPropertyTarget();

            var actual = Validator.ValidateObject(target);
            expected.AssertEquals(actual);
        }
        public void Empty_string_fails_validation()
        {
            var expected = new NotificationAssertion();
            expected.RegisterMessage("Name", Notification.REQUIRED_FIELD, Severity.Error);

            var target = new RequiredPropertyTarget(){Amount = 3, TradeDate = DateTime.Today, Name = string.Empty};

            var actual = Validator.ValidateObject(target);
            expected.AssertEquals(actual);
        }