Exemplo n.º 1
0
 public DictionaryTestCase(double timeLimit, Exception expectedException, string description, IListDictionary testedDict, OperationInfo[] operations, int[] expectedFinalState)
     : base(timeLimit, expectedException, description)
 {
     this.testedDict         = testedDict;
     this.operations         = operations;
     this.expectedFinalState = expectedFinalState;
 }
        public bool[] Execute(IListDictionary TestedDict, OperationInfo[] operations)
        {
            bool[] res = new bool[operations.Length];
            for (int i = 0; i < operations.Length; ++i)
            {
                switch (operations[i].oper)
                {
                case 'a':
                    res[i] = TestedDict.Add(operations[i].val);
                    break;

                case 's':
                    res[i] = TestedDict.Search(operations[i].val);
                    break;

                case 'd':
                    res[i] = TestedDict.Delete(operations[i].val);
                    break;
                }
            }
            return(res);
        }
Exemplo n.º 3
0
 public static bool Contains <TKey, TValue>(IListDictionary <TKey, TValue> listDictionary, TKey key, TValue value)
 {
     return(listDictionary.GetValues(key).Contains(value));
 }
Exemplo n.º 4
0
 public static IEnumerable <TValue> GetValues <TKey, TValue>(this IListDictionary <TKey, TValue> listDictionary)
 {
     return(listDictionary.Values);
 }