public void MissingItemsKeysAreNotFound()
        {
            var key1 = 5;
            var key2 = "key2";

            var dictionary = new DoubleKeyDictionary <int, string, string>();

            var result = dictionary.Contains(key1, key2);

            result.Should().BeFalse();
        }
        public void AddedItemsKeysAreFound()
        {
            var key1  = 5;
            var key2  = "key2";
            var value = "asmdpsodfgkhöglhmdfgh d";

            var dictionary = new DoubleKeyDictionary <int, string, string>();

            dictionary.Add(key1, key2, value);

            var result = dictionary.Contains(key1, key2);

            result.Should().BeTrue();
        }
        public void CanRemoveCompleteFirstLevel()
        {
            var key1  = 5;
            var key21 = "key1";
            var key22 = "key2";
            var key12 = 2;

            var dictionary = new DoubleKeyDictionary <int, string, string>();

            dictionary.Add(key1, key21, "value11");
            dictionary.Add(key1, key22, "value2");
            dictionary.Add(key12, key21, "value3");
            dictionary.Add(key12, key22, "value4");

            var result = dictionary.Remove(key1);

            result.Should().BeTrue();
            dictionary.Count.Should().Be(2);
            dictionary.Contains(key1, key21).Should().BeFalse();
            dictionary.Contains(key1, key22).Should().BeFalse();
            dictionary.GetAll().FirstOrDefault(x => x == "value11").Should().BeNullOrEmpty();
            dictionary.GetAll().FirstOrDefault(x => x == "value2").Should().BeNullOrEmpty();
        }
Exemplo n.º 4
0
        private static void AtpaOnce3(double[] resultArray, double[] diagonalP, int rowIndex, DoubleKeyDictionary <int, double> ab)
        {
            var ab1 = ab[rowIndex];

            for (int colIndex = 0; colIndex <= rowIndex; colIndex++)
            {
                if (!ab.Contains(colIndex))
                {
                    continue;
                }
                var    right   = ab[colIndex];
                double cellVal = 0;
                foreach (var qqqq in ab1)
                {
                    int q = qqqq.Key;
                    if (right.ContainsKey(q))
                    {
                        cellVal += qqqq.Value * right[q] * diagonalP[q];
                    }
                }
                int index = GetIndexOfLowerTriangleMatrix(rowIndex, colIndex);
                resultArray[index] = cellVal;
            }
        }