< Summary

Class:ReactiveUI.Validation.States.ValidationState
Assembly:ReactiveUI.Validation
File(s):D:\a\1\s\src\ReactiveUI.Validation\States\ValidationState.cs
Covered lines:10
Uncovered lines:0
Coverable lines:10
Total lines:55
Line coverage:100% (10 of 10)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%50%
get_Component()-100%100%
get_IsValid()-100%100%
get_Text()-100%100%

File(s)

D:\a\1\s\src\ReactiveUI.Validation\States\ValidationState.cs

#LineLine coverage
 1// Copyright (c) 2020 .NET Foundation and Contributors. All rights reserved.
 2// Licensed to the .NET Foundation under one or more agreements.
 3// The .NET Foundation licenses this file to you under the MIT license.
 4// See the LICENSE file in the project root for full license information.
 5
 6using ReactiveUI.Validation.Collections;
 7using ReactiveUI.Validation.Components.Abstractions;
 8
 9namespace ReactiveUI.Validation.States
 10{
 11    /// <summary>
 12    /// Represents the validation state of a validation component.
 13    /// </summary>
 14    public sealed class ValidationState
 15    {
 16        /// <summary>
 17        /// Initializes a new instance of the <see cref="ValidationState"/> class.
 18        /// </summary>
 19        /// <param name="isValid">Determines if the property is valid or not.</param>
 20        /// <param name="text">Validation text.</param>
 21        /// <param name="component">Validation property.</param>
 22        public ValidationState(bool isValid, string text, IValidationComponent component)
 423            : this(isValid, new ValidationText(text), component)
 24        {
 425        }
 26
 27        /// <summary>
 28        /// Initializes a new instance of the <see cref="ValidationState"/> class.
 29        /// </summary>
 30        /// <param name="isValid">Determines if the property is valid or not.</param>
 31        /// <param name="text">Validation text.</param>
 32        /// <param name="component">Validation property.</param>
 19833        public ValidationState(bool isValid, ValidationText text, IValidationComponent component)
 34        {
 19835            IsValid = isValid;
 19836            Text = text ?? throw new System.ArgumentNullException(nameof(text));
 19837            Component = component ?? throw new System.ArgumentNullException(nameof(component));
 19838        }
 39
 40        /// <summary>
 41        /// Gets the associated component.
 42        /// </summary>
 5443        public IValidationComponent Component { get; }
 44
 45        /// <summary>
 46        /// Gets a value indicating whether the validation is currently valid or not.
 47        /// </summary>
 27648        public bool IsValid { get; }
 49
 50        /// <summary>
 51        /// Gets the validation text.
 52        /// </summary>
 23453        public ValidationText Text { get; }
 54    }
 55}