Пример #1
0
            public void ReturnsCorrectResultWithDerivedMetadataValue()
            {
                // Given
                InitialMetadata initialMetadata = new InitialMetadata
                {
                    ["A"] = new DerivedMetadataValue { Key = "X" },
                    ["X"] = "x"
                };
                Metadata metadata = new Metadata(initialMetadata);

                // When
                object value = metadata.Get("A");

                // Then
                Assert.AreEqual("x", value);
            }
Пример #2
0
            public void MetadataValueCalledForEachRequest()
            {
                // Given
                SimpleMetadataValue metadataValue = new SimpleMetadataValue { Value = "a" };
                InitialMetadata initialMetadata = new InitialMetadata { ["A"] = metadataValue };
                Metadata metadata = new Metadata(initialMetadata);

                // When
                object value = metadata.Get("A");
                value = metadata.Get("A");
                value = metadata.Get("A");

                // Then
                Assert.AreEqual("a", value);
                Assert.AreEqual(3, metadataValue.Calls);
            }
Пример #3
0
        public void GetWithMetadataValueCalledForEachRequest()
        {
            // Given
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            SimpleMetadataValue metadataValue = new SimpleMetadataValue { Value = "a" };
            engine.Metadata["A"] = metadataValue;
            Metadata metadata = new Metadata(engine);

            // When
            object value = metadata.Get("A");
            value = metadata.Get("A");
            value = metadata.Get("A");

            // Then
            Assert.AreEqual("a", value);
            Assert.AreEqual(3, metadataValue.Calls);
        }
Пример #4
0
            public void GetWithMetadataValueReturnsCorrectResult()
            {
                // Given
                InitialMetadata initialMetadata = new InitialMetadata { ["A"] = "a" };
                Metadata metadata = new Metadata(initialMetadata);

                // When
                object value = metadata.Get("A");

                // Then
                Assert.AreEqual("a", value);
            }
Пример #5
0
        public void GetWithDerivedMetadataValueReturnsCorrectResult()
        {
            // Given
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            engine.Metadata["X"] = "x";
            engine.Metadata["A"] = new DerivedMetadataValue { Key = "X" };
            Metadata metadata = new Metadata(engine);

            // When
            object value = metadata.Get("A");

            // Then
            Assert.AreEqual("x", value);
        }