Ejemplo n.º 1
0
        /// <summary>
        /// execute indicator
        /// </summary>
        /// <param name="argument"></param>
        /// <returns></returns>
        public bool?Indicate(ArgumentProvider argument)
        {
            var actual   = argument.Format(Actual);
            var expected = Expected.Select(x => argument.Format(x));

            var match = expected.Any(x => string.Equals(actual, x, StringComparison.CurrentCultureIgnoreCase));

            if (Not)
            {
                match = !match;
            }

            if (match)
            {
                if (IsSuccess)
                {
                    return(true);
                }
                else if (IsFail)
                {
                    return(false);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public string GetMessage()
        {
            string expectedString = $"Expected ";

            if (Expected.Count() > 1)
            {
                expectedString += "one of ";
            }

            expectedString += string.Join(", ", Expected.Select(x => string.IsNullOrEmpty(x) ? "EOF" : x).Distinct());
            expectedString += $" but found {Found}.";
            return(expectedString);
        }