コード例 #1
0
        public void NoneValidationTextIsEmpty()
        {
            ValidationText vt = ValidationText.None;

            Assert.Equal(0, vt.Count);

            // Calling Count() checks the enumeration returns no results, unlike the Count property.
#pragma warning disable CA1829 // Use Length/Count property instead of Count() when available
            Assert.Equal(0, vt.Count());
#pragma warning restore CA1829 // Use Length/Count property instead of Count() when available
            Assert.Equal(string.Empty, vt.ToSingleLine());
        }
コード例 #2
0
        public void CombineValidationTextEmptyReturnsTwoEmpty()
        {
            ValidationText vt = ValidationText.Create(new[] { ValidationText.Empty, ValidationText.Empty });

            Assert.NotSame(ValidationText.Empty, vt);
            Assert.Equal(2, vt.Count);

            // Calling Count() checks the enumeration returns no results, unlike the Count property.
#pragma warning disable CA1829 // Use Length/Count property instead of Count() when available
            Assert.Equal(2, vt.Count());
#pragma warning restore CA1829 // Use Length/Count property instead of Count() when available
            Assert.Equal(string.Empty, vt[0]);
            Assert.Equal(string.Empty, vt[1]);

            Assert.Equal("|", vt.ToSingleLine("|"));
        }