public void ReturnsTrueForValidValue() { // Given InitialMetadata initialMetadata = new InitialMetadata {["A"] = "a"}; Metadata metadata = new Metadata(initialMetadata); // When object value; bool contains = metadata.TryGetValue("A", out value); // Then Assert.IsTrue(contains); Assert.AreEqual("a", value); }
public void TryGetValueWithMetadataValueReturnsCorrectResult() { // Given Engine engine = new Engine(); engine.Trace.AddListener(new TestTraceListener()); engine.Metadata["A"] = new SimpleMetadataValue { Value = "a" }; Metadata metadata = new Metadata(engine); // When object value; bool contains = metadata.TryGetValue("A", out value); // Then Assert.IsTrue(contains); Assert.AreEqual("a", value); }
public void ReturnsCorrectResultWithMetadataValue() { // Given InitialMetadata initialMetadata = new InitialMetadata { ["A"] = new SimpleMetadataValue { Value = "a" } }; Metadata metadata = new Metadata(initialMetadata); // When object value; bool contains = metadata.TryGetValue("A", out value); // Then Assert.IsTrue(contains); Assert.AreEqual("a", value); }
public void TryGetValueReturnsFalseForInvalidValue() { // Given Engine engine = new Engine(); engine.Trace.AddListener(new TestTraceListener()); engine.Metadata["A"] = "a"; Metadata metadata = new Metadata(engine); // When object value; bool contains = metadata.TryGetValue("B", out value); // Then Assert.IsFalse(contains); Assert.AreEqual(null, value); }