Пример #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());
 }
Пример #5
0
 /// <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));
 }