예제 #1
0
        public void TestFromClass()
        {
            TestNameClass test = new TestNameClass();

            test.Name = "Super";

            dynamic testFrom = FluentObject.From(test);

            Assert.AreEqual("Super", testFrom.Name);
        }
예제 #2
0
        public void TestFromIDictionary()
        {
            IDictionary <string, int> dictionary = new Dictionary <string, int>();

            dictionary.Add("test", 123);

            dynamic dynamicDictionary = FluentObject.From(dictionary);

            Assert.AreEqual(123, dynamicDictionary["test"]);
            Assert.AreEqual(default(int), (int)(dynamicDictionary["asdf"]));
        }
예제 #3
0
        public void TestFromFluentObject()
        {
            dynamic o = new FluentObject();

            o.test[0].Name.Is.So[12].Cool["YAY"].Oh.Yeah = "MyTest";
            o.test[0].Name.Is.So[12].Yes["HEY"]          = 4;
            o.test[0].Name.Is.So[12].Yes["YOU"]          = 7;

            dynamic o2 = FluentObject.From(o);

            Assert.AreEqual("MyTest", o2.test[0].Name.Is.So[12].Cool["YAY"].Oh.Yeah);
        }