Exemplo n.º 1
0
        public void ConvertStringArrayToIntArray()
        {
            // Given
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            Metadata metadata = new Metadata(engine);

            // When
            metadata = metadata.Clone(new[] { new KeyValuePair<string, object>("A", new string[] { "1", "2", "3" }) });
            IMetadata<int[]> metadataAs = metadata.MetadataAs<int[]>();

            // Then
            CollectionAssert.AreEqual(new string[] { "1", "2", "3" }, (IEnumerable)metadata["A"]);
            CollectionAssert.AreEqual(new int[] { 1, 2, 3 }, (IEnumerable)metadataAs["A"]);
        }
Exemplo n.º 2
0
        public void ConvertIntToString()
        {
            // Given
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            Metadata metadata = new Metadata(engine);

            // When
            metadata = metadata.Clone(new[] { new KeyValuePair<string, object>("A", 1) });
            IMetadata<string> metadataAs = metadata.MetadataAs<string>();

            // Then
            Assert.AreEqual(1, metadata["A"]);
            Assert.AreEqual("1", metadataAs["A"]);
        }
Exemplo n.º 3
0
 public IMetadata <T> MetadataAs <T>()
 {
     return(_metadata.MetadataAs <T>());
 }
Exemplo n.º 4
0
 public IMetadata <T> MetadataAs <T>() => _metadata.MetadataAs <T>();