示例#1
0
        public void RubberStamp_ValidationSummary_MessageSummary_OnlyErrorAndWarning()
        {
            var summary = new ValidationSummary <One>();

            summary.AddResult(new ValidationResult(Severity.Error, "Some Error"));
            summary.AddResult(new ValidationResult(Severity.Warning, "Some Warning"));

            var message  = summary.ValidationMessage;
            var expected = new StringBuilder()
                           .AppendLine("Some Error")
                           .Append("Some Warning")
                           .ToString();

            Assert.AreEqual(expected, message);
        }
示例#2
0
        public void RubberStamp_ValidationSummary_MergeBeforeSetError()
        {
            var summary = new ValidationSummary <One>();

            summary.AddResult(new ValidationResult(Severity.Error, "Some Error"));
            summary.AddResult(new ValidationResult(Severity.Warning, "Some Warning"));
            summary.AddResult(new ValidationResult(Severity.Info, "Some information"));

            var second = new ValidationSummary <Two>();

            second.Merge(summary);
            second.AddResult(new ValidationResult(Severity.Error, "Second Error"));

            Assert.IsTrue(second.ValidationResults.Count() == 4);
        }
示例#3
0
        public void RubberStamp_ValidationSummary_InfoMessages()
        {
            var summary = new ValidationSummary <One>();

            summary.AddResult(new ValidationResult(Severity.Error, "Some Error"));
            summary.AddResult(new ValidationResult(Severity.Warning, "Some Warning"));
            summary.AddResult(new ValidationResult(Severity.Info, "Some Information"));
            summary.AddResult(new ValidationResult(Severity.Info, "Another Information"));

            var message  = summary.GetInfoMessage();
            var expected = new StringBuilder()
                           .AppendLine("Some Information")
                           .AppendLine("Another Information")
                           .ToString()
                           .Trim();

            Assert.AreEqual(expected, message);
        }
示例#4
0
        public void RubberStamp_ValidationSummary_MessageSummary_OnlyInfo()
        {
            var summary = new ValidationSummary <One>();

            summary.AddResult(new ValidationResult(Severity.Info, "Some information"));

            var message  = summary.ValidationMessage;
            var expected = new StringBuilder()
                           .Append("Some information")
                           .ToString();

            Assert.AreEqual(expected, message);
        }