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"]); }
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"]); }
public IMetadata <T> MetadataAs <T>() { return(_metadata.MetadataAs <T>()); }
public IMetadata <T> MetadataAs <T>() => _metadata.MetadataAs <T>();