Exemplo n.º 1
0
 public void Add()
 {
     foreach (var type in _types)
     {
         var name = _vector.GetOrAdd(type, t => t.Name);
         name.Should().Be(type.Name);
     }
 }
Exemplo n.º 2
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);
        }