public void ReturnsFalseForInvalidValue() { // Given MetadataDictionary initialMetadata = new MetadataDictionary { ["A"] = "a" }; MetadataStack metadata = new MetadataStack(initialMetadata); // When object value; bool contains = metadata.TryGetValue("B", out value); // Then Assert.IsFalse(contains); Assert.AreEqual(null, value); }
public void ReturnsCorrectResultWithMetadataValue() { // Given MetadataDictionary initialMetadata = new MetadataDictionary { ["A"] = new SimpleMetadataValue { Value = "a" } }; MetadataStack metadata = new MetadataStack(initialMetadata); // When object value; bool contains = metadata.TryGetValue("A", out value); // Then Assert.IsTrue(contains); Assert.AreEqual("a", value); }
public bool TryGetValue <T>(string key, out T value) => _metadata.TryGetValue <T>(key, out value);
public bool TryGetValue(string key, out object value) => _metadata.TryGetValue(key, out value);