Exemplo n.º 1
0
        public void CastOneDictToAnotherTest()
        {
            // from int-int to string-long
            var source = new Dictionary <int, int> {
                { 1, 1 }, { 2, 2 }, { 3, 3 }
            }.AsReadOnlyDictionary();
            var target = DictConv.Cast <int, int, int, dynamic>(source);

            target.ShouldNotBeNull();
            target.Count.ShouldBe(3);
        }
Exemplo n.º 2
0
        public void ConvertHashtableToDictionaryTest()
        {
            var table = new Hashtable();

            table["Name"] = "Alex";
            table["Age"]  = "10086";

            var dict = DictConv.ToDictionary <string, string>(table);

            dict.ShouldNotBeNull();
            dict.Count.ShouldBe(2);
        }