示例#1
0
        /// <summary>
        /// Returns an indication of whether all the selected types satisfy the conditions.
        /// </summary>
        /// <returns>An indication of whether the conditions are true, along with a list of types failing the check if they are not.</returns>
        public TestResult GetResult()
        {
            bool success;

            if (_should)
            {
                // All the classes should meet the condition
                success = (_sequence.Execute(_types).Count() == _types.Count());
            }
            else
            {
                // No classes should meet the condition
                success = (!_sequence.Execute(_types).Any());
            }

            if (success)
            {
                return(TestResult.Success());
            }

            // If we've failed, get a collection of failing types so these can be reported in a failing test.
            var failedTypes = _sequence.Execute(_types, selected: !_should).ToList();

            return(TestResult.Failure(failedTypes));
        }
示例#2
0
        public ConditionList Should(Filter filter = null)
        {
            var inputs           = _sequence.Execute(_types);
            var functionSequence = new FunctionSequence();

            if (filter != null)
            {
                functionSequence.Add(filter);
            }
            return(new ConditionList(inputs, true, functionSequence));
        }
示例#3
0
 /// <summary>
 /// Returns an indication of whether all the selected types satisfy the conditions.
 /// </summary>
 /// <returns>An indication of whether the conditions are true.</returns>
 public bool GetResult()
 {
     if (_should)
     {
         // All the classes should meet the condition
         return(_sequence.Execute(_types).Count() == _types.Count());
     }
     else
     {
         // No classes should meet the condition
         return(!_sequence.Execute(_types).Any());
     }
 }
示例#4
0
 /// <summary>
 /// Returns an indication of whether all the selected types satisfy the conditions.
 /// </summary>
 /// <returns>An indication of whether the conditions are true.</returns>
 public bool GetResult()
 {
     return(_sequence.Execute(_types).Count() == _types.Count());
 }
 /// <summary>
 /// Links a predicate defining a set of classes to a condition that tests them.
 /// </summary>
 /// <returns>A condition that tests classes against a given criteria.</returns>
 public Conditions Should()
 {
     return(new Conditions(_sequence.Execute(_types), true));
 }