Пример #1
0
        public void TryGet_should_return_true_if_key_exists()
        {
            //Arrange
            var table = new Structures.HashTable <int, string>();

            table.Add(1, "1");

            //Act
            var result = table.TryGet(1, out var value);

            //Assert
            Assert.True(result);
        }
Пример #2
0
        public void TryGet_should_return_value_if_key_exists()
        {
            //Arrange
            var table = new Structures.HashTable <int, string>();

            table.Add(1, "2");

            //Act
            var result = table.TryGet(1, out var outValue);

            //Assert
            Assert.AreEqual("2", outValue);
        }
Пример #3
0
        public void TryGet_should_return_null_object_if_key_does_not_exist()
        {
            //Arrange
            var table = new Structures.HashTable <int, string>();

            table.Add(1, "1");

            //Act
            var result = table.TryGet(2, out var value);

            //Assert
            Assert.Null(value);
        }