Esempio n. 1
0
        public void CountZero()
        {
            // Given | When
            int expectedCount = 0;
            var dictonary = new HashDictonary<int, string>();

            // Then
            Assert.AreEqual(expectedCount, dictonary.Count);
        }
Esempio n. 2
0
        public void KeyNotFound()
        {
            // Given
            var dictonary = new HashDictonary<int, string>() {
                { 1, "Hugo"},
                { 2, "Franz"},
                { 3, "Rudi"}
            };

            // When
            var name = dictonary[4];
        }
Esempio n. 3
0
        public void CountInserted()
        {
            // Given
            int expectedCount = 3;
            var dictonary = new HashDictonary<int, string>();

            // When
            dictonary.Add(1, "Hugo");
            dictonary.Add(2, "Franz");
            dictonary.Add(3, "Rudi");

            // Then
            Assert.AreEqual(expectedCount, dictonary.Count);
        }
Esempio n. 4
0
        public void DuplicateKeyInserted()
        {
            // Given
            var dictonary = new HashDictonary<int, string>();

            // When
            dictonary.Add(1, "Hugo");
            dictonary[1] = "Franz";

            try
            {
                dictonary.Add(1, "Rudi");

                Assert.Fail("ArgumentException expected");
            }
            catch (ArgumentException)
            {
                // Then
            }
        }