Beispiel #1
0
        public void MultiValues_AnonymousType()
        {
            dynamic mv = MultiValues.Values(new { Int = 1, Double = 2.0, String = "Toto" });

            Assert.AreEqual(1, mv.Int);
            Assert.AreEqual(2.0, mv.Double);
            Assert.AreEqual("Toto", mv.String);

            Assert.AreEqual(1, mv["Int"]);
            Assert.AreEqual(2.0, mv["Double"]);
            Assert.AreEqual("Toto", mv["String"]);
        }
Beispiel #2
0
        public void MultiValues_Dictionary()
        {
            var values = new Dictionary <string, object>()
            {
                { "Int", 1 }, { "Double", 2.0 }, { "String", "Toto" }
            };
            dynamic mv = MultiValues.Values(values);

            Assert.AreEqual(1, mv.Int);
            Assert.AreEqual(2.0, mv.Double);
            Assert.AreEqual("Toto", mv.String);
            Assert.AreEqual("Toto", mv.@String);
        }
Beispiel #3
0
 public void MultiValues_CallingInvalidProperty()
 {
     dynamic mv = MultiValues.Values(new { Int = 1, Double = 2.0, String = "Toto" });
     int     v  = mv.Bad;
 }