Exemplo n.º 1
0
        public void Remove_should_throw_ArgumentException_if_key_does_not_exist()
        {
            //Arrange
            var table = new Structures.HashTable <int, string>();

            table.Add(1, "1");

            //Act & Assert
            Assert.Throws <ArgumentException>(() => table.Remove(2));
        }
Exemplo n.º 2
0
        public void Remove_should_decrease_count_if_success()
        {
            //Arrange
            var table = new Structures.HashTable <int, string>();

            table.Add(1, "1");
            var expectedCount = 0;

            //Act
            table.Remove(1);
            var count = table.Count;

            //Assert
            Assert.AreEqual(expectedCount, count);
        }
Exemplo n.º 3
0
        public void Remove_should_remove_item_if_key_exists()
        {
            //Arrange
            var table = new Structures.HashTable <int, string>();

            table.Add(1, "1");
            var expectedCount = 0;

            //Act
            table.Remove(1);
            var count = table.Count;

            //Assert
            Assert.AreEqual(expectedCount, count);
        }