Example #1
0
        public void InitializeFromDictionary()
        {
            var dictionary = _types.ToDictionary(type => type, type => type.Name);
            var vector     = new DangerousVector <Type, string>(dictionary);

            vector.Count.Should().Be(dictionary.Count);
        }
Example #2
0
        public DangerousVectorShould()
        {
            _arg    = nameof(DangerousVectorShould);
            _vector = new DangerousVector <Type, string>();

            _types = typeof(DangerousVector <,>).Assembly.DefinedTypes.Cast <Type>().ToArray();
        }
Example #3
0
        public int Vector_Many()
        {
            var vector = new DangerousVector <Type, string>();

            var stub = 0;

            Parallel.ForEach(_keys, key =>
            {
                var value = vector.GetOrAdd(_key, k => k.Name);
                if (value.Length % 2 == 0)
                {
                    stub++;
                }
            });

            return(stub);
        }