示例#1
0
        public IMutableDictionary <TKey, TValue> Update <TKey, TValue>(IMutableDictionary <TKey, TValue> current, TKey key, TValue value)
        {
            if ((current.Count == _TransitionToDictionary) && (!current.ContainsKey(key)))
            {
                return(GetNext(current).AddMutable(key, value));
            }

            current[key] = value;
            return(current);
        }
示例#2
0
 private void SetEmulation()
 {
     _MutableDictionary.Count.Returns(_Emulated.Count);
     _MutableDictionary.GetEnumerator().Returns(args => _Emulated.GetEnumerator());
     _MutableDictionary.When(md => md.CopyTo(Arg.Any <KeyValuePair <string, string>[]>(), Arg.Any <int>()))
     .Do((arg => _Emulated.CopyTo((KeyValuePair <string, string>[])(arg[0]), (int)arg[1])));
     _MutableDictionary.ContainsKey(Arg.Any <string>()).Returns(arg => _Emulated.ContainsKey((string)arg[0]));
     _MutableDictionary.Keys.Returns(_Emulated.Keys);
     _MutableDictionary.Values.Returns(_Emulated.Values);
 }
示例#3
0
 public bool ContainsKey(TKey key)
 {
     return  _Implementation.ContainsKey(key);
 }