Beispiel #1
0
            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);
            }
Beispiel #2
0
        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);
        }
Beispiel #3
0
            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);
            }
Beispiel #4
0
        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);
        }