public ConfigureSignature(Type declaringType, ConfigurePriority priority, string signature, string dependencySignature)
 {
     DeclaringType       = declaringType;
     Priority            = priority;
     Signature           = signature;
     DependencySignature = dependencySignature;
 }
 private PriorityTestCase(Type type, ConfigurePriority priority, IEnumerable <string> methods)
     : base(new[] { type })
 {
     _type     = type;
     _priority = priority;
     _methods  = methods;
 }
Ejemplo n.º 3
0
            internal override IEnumerable<MethodInfo> OrderConfigure(Type type, ConfigurePriority priority, IEnumerable<MethodInfo> configures)
            {
                var priorities = _typeDefinitions.GetOrAdd(type, new ConcurrentDictionary<ConfigurePriority, IEnumerable<string>>());
                priorities.TryAdd(priority, configures.Select(m => m.ToString()));

                return configures;
            }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates method test cases based on the information given
 /// </summary>
 /// <param name="type">Type of the project or solution to analyze</param>
 /// <param name="priority">Priority group of the methods</param>
 /// <param name="methods">Methods to analyze</param>
 /// <returns>The test cases to execute</returns>
 public static IEnumerable<BaseTestCase> CreateMethodTestCase(Type type, ConfigurePriority priority, IEnumerable<string> methods)
 {
     int i = 0;
     foreach (var method in methods.Skip(1))
     {
         yield return new MethodTestCase(type, priority, method, methods, ++i);
     }
 }
            internal override IEnumerable <MethodInfo> OrderConfigure(Type type, ConfigurePriority priority, IEnumerable <MethodInfo> configures)
            {
                if (type == _type && priority == _priority)
                {
                    return(configures.Reverse());
                }

                return(configures);
            }
 private MethodTestCase(Type type, ConfigurePriority priority, string method, IEnumerable <string> methods, int index)
     : base(new[] { type })
 {
     _type     = type;
     _priority = priority;
     _method   = method;
     _methods  = methods;
     _max      = index;
     _min      = 0;
 }
Ejemplo n.º 7
0
        public ConfigureMethodInfo(Tuple <Type, ConfigurePriority, string> method)
        {
            var configures = ConfigureCollection.Create(method.Item1);

            Method              = configures.Single(m => m.ToString() == method.Item3);
            _metadataTypeMap    = GetAncestorsWithMethod(method.Item1, Method.ToString());
            MethodAncestorTypes = _metadataTypeMap.SelectMany(types => types.Value);
            Type     = _metadataTypeMap[Method.MetadataToken].Last();
            Priority = method.Item2;
        }
            internal override IEnumerable <MethodInfo> OrderConfigure(Type type, ConfigurePriority priority, IEnumerable <MethodInfo> configures)
            {
                foreach (var analyzer in _analyzers)
                {
                    if (analyzer.HaveToGenerate(type))
                    {
                        return(analyzer.OrderConfigure(type, priority, configures));
                    }
                }

                return(configures);
            }
 /// <summary>
 /// Creates method test cases based on the information given
 /// Should be call if you know that the methods contains an error.
 /// </summary>
 /// <param name="type">Type of the project or solution to analyze</param>
 /// <param name="priority">Priority group of the methods</param>
 /// <param name="methods">Methods to analyze</param>
 /// <param name="suspectedMethods">[out] The methods suspected before processing if any</param>
 /// <returns>The test cases to execute</returns>
 public static IEnumerable <BaseTestCase> CreateMethodTestCase(
     Type type,
     ConfigurePriority priority,
     IEnumerable <string> methods,
     out IEnumerable <ConfigureSignature> suspectedMethods)
 {
     if (methods.Count() > 2)
     {
         suspectedMethods = Enumerable.Empty <ConfigureSignature>();
         return(CreateMethodTestCase(type, priority, methods));
     }
     else
     {
         suspectedMethods = new[] { new ConfigureSignature(type, priority, methods.Last(), methods.First()) };
         return(Enumerable.Empty <BaseTestCase>());
     }
 }
            internal override IEnumerable <MethodInfo> OrderConfigure(Type type, ConfigurePriority priority, IEnumerable <MethodInfo> configures)
            {
                if (type.Equals(_type) && priority.Equals(_priority))
                {
                    var reordered = new List <MethodInfo>();

                    foreach (var configure in configures)
                    {
                        if (configure.ToString().Equals(_method))
                        {
                            reordered.Insert(_testIndex, configure);
                        }
                        else
                        {
                            reordered.Add(configure);
                        }
                    }

                    return(reordered);
                }

                return(configures);
            }
 private MethodTestCase(Type type, ConfigurePriority priority, string method, IEnumerable <string> methods, int max, int min, int testIndex)
     : this(type, priority, method, methods, max)
 {
     _min       = min;
     _testIndex = testIndex;
 }
Ejemplo n.º 12
0
 internal virtual IEnumerable <MethodInfo> OrderConfigure(Type type, ConfigurePriority priority, IEnumerable <MethodInfo> methods)
 {
     return(methods);
 }
Ejemplo n.º 13
0
 internal override IEnumerable<MethodInfo> OrderConfigure(Type type, ConfigurePriority priority, IEnumerable<MethodInfo> configures)
 {
     return configures.Reverse();
 }