private static void AddDefaultComparerMappings(this SpecFlowContext context)
        {
            const string defaultKey = "__defaultComparersAdded__";

            if (context.GetInheritedOrDefault(defaultKey, false))
            {
                return;
            }

            context.Set(true, defaultKey);

            var stringLookup = new Dictionary <string, ComparerMapping>(StringComparer.OrdinalIgnoreCase);
            var typeLookup   = new Dictionary <Type, ComparerMapping>();

            SetComparerStringMappingLookup(context, stringLookup);
            SetComparerTypeMappingLookup(context, typeLookup);

            Add(new DoubleComparer(context), typeof(double), "Double");
            Add(new FloatComparer(context), typeof(float), "Float", "Single");

            void Add(IComparer comparer, Type type, params string[] keys)
            {
                foreach (string key in keys)
                {
                    AddComparerMapping(context, new ComparerMapping(key, type, comparer));
                }
            }
        }
        public static List <CollectionProcessorFactory> GetCollectionProcessorFactories(this SpecFlowContext context)
        {
            AddDefaultCollectionProcessorFactories(context);

            var lookup = context.GetInheritedOrDefault <Dictionary <string, CollectionProcessorFactory> >(
                "__collectionProcessorLookup__", null);

            if (lookup == null)
            {
                return(new List <CollectionProcessorFactory>());
            }

            return(lookup.Values.ToList());
        }
        public static CollectionProcessorFactory GetCollectionProcessorFactory(
            this SpecFlowContext context,
            string collectionKind)
        {
            AddDefaultCollectionProcessorFactories(context);

            var lookup = context.GetInheritedOrDefault <Dictionary <string, CollectionProcessorFactory> >(
                "__collectionProcessorLookup__", null);

            if (lookup == null)
            {
                return(null);
            }

            lookup.TryGetValue(collectionKind, out CollectionProcessorFactory result);
            return(result);
        }
 public static CollectionProcessorFactory GetDefaultCollectionProcessorFactory(
     this SpecFlowContext context)
 {
     AddDefaultCollectionProcessorFactories(context);
     return(context.GetInheritedOrDefault <CollectionProcessorFactory>("__defaultCollectionProcessorFactory__", null));
 }