当前位置: 首页>>代码示例>>C#>>正文


C# ValidationResult.ToString方法代码示例

本文整理汇总了C#中ValidationResult.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ValidationResult.ToString方法的具体用法?C# ValidationResult.ToString怎么用?C# ValidationResult.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ValidationResult的用法示例。


在下文中一共展示了ValidationResult.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanCreate

 public void CanCreate()
 {
     var validationIssues = new List<ValidationIssue>();
     var validationResult = new ValidationResult(validationIssues);
     validationResult.ValidationIssues.Should().Be.Equals(validationIssues);
     validationResult.HasErrors.Should().Be.False();
     validationResult.ToString().Should().Be.EqualTo(string.Empty);
     validationIssues.Add(new ValidationIssue("Invalid property", "MyProperty", "NotAValidValue"));
     validationResult.HasErrors.Should().Be.True();
     validationResult.ToString().Should().Contain("Invalid property");
     validationResult.ToString().Should().Contain("MyProperty");
     validationResult.ToString().Should().Contain("NotAValidValue");
 }
开发者ID:RudyYang,项目名称:BusinessLight,代码行数:13,代码来源:ValidationResultTests.cs

示例2: AddValidationResult

        /// <summary>
        /// Adds the supplied <see cref="ValidationResult"/> to its current <see cref="ValidationResultCollectionScope"/>.
        /// </summary>
        /// <param name="result">The supplied <see cref="ValidationResult"/>.</param>
        public void AddValidationResult(ValidationResult result)
        {
            var currentScope = CurrentScope;
            currentScope.ValidationResult.Add(result);

            LogManager.Log(LogLevel.Informational, result.ToString()); // log validation messages with informational level only for debugging purposes
        }
开发者ID:erwinbovendeur,项目名称:ADF,代码行数:11,代码来源:BusinessRuleValidationContext.cs

示例3: ValidationException

 public ValidationException(ValidationResult validationResult, Exception innerException)
     : this(validationResult != null ? validationResult.ToString() : string.Empty, innerException)
 {
     this.ValidationResult = validationResult;
 }
开发者ID:njmube,项目名称:Nemo,代码行数:5,代码来源:ValidationException.cs

示例4: ToString_ReturnsExpected

 public void ToString_ReturnsExpected(string errorMessage, string expected)
 {
     ValidationResult validationResult = new ValidationResult(errorMessage);
     Assert.Equal(expected, validationResult.ToString());
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:5,代码来源:ValidationResultTests.cs

示例5: ValidationResult_ToString_ErrorMessage_Empty

 public void ValidationResult_ToString_ErrorMessage_Empty() {
     ValidationResult result = new ValidationResult(string.Empty);
     Assert.AreEqual(string.Empty, result.ToString());
 }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:4,代码来源:ValidationResultTest.cs

示例6: ValidationResult_ToString_ErrorMessage_Null

 public void ValidationResult_ToString_ErrorMessage_Null() {
     ValidationResult result = new ValidationResult(null);
     Assert.AreEqual(typeof(ValidationResult).FullName, result.ToString());
 }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:4,代码来源:ValidationResultTest.cs

示例7: ValidationResult_ToString_ErrorMessage_Specified

 public void ValidationResult_ToString_ErrorMessage_Specified() {
     string message = "This is the error message";
     ValidationResult result = new ValidationResult(message);
     Assert.AreEqual(message, result.ToString());
 }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:5,代码来源:ValidationResultTest.cs


注:本文中的ValidationResult.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。