示例#1
0
    public void TryGetValue_NonExistingElement_ShouldReturnFalse()
    {
        // Arrange
        var dictionary = new DictionaryDataStructure.Dictionary<int, string>();

        // Act
        string value;
        var result = dictionary.TryGetValue(555, out value);

        // Assert
        Assert.IsFalse(result);
    }
示例#2
0
    public void TryGetValue_ExistingElement_ShouldReturnTheValue()
    {
        // Arrange
        var dictionary = new DictionaryDataStructure.Dictionary<int, string>();

        // Act
        dictionary.Add(555, "Peter");
        string value;
        var result = dictionary.TryGetValue(555, out value);

        // Assert
        Assert.AreEqual("Peter", value);
        Assert.IsTrue(result);
    }