public void When_getting_a_model_as_dynamic_dictionary()
        {
            var model = new Child {
                Name = "Foo", Age = 10
            };
            DynamicDictionary dicWithInheritedProp = model.ToDynamic();

            dicWithInheritedProp.ShouldNotBeNull();
            dicWithInheritedProp.Count.ShouldBe(3);
            dicWithInheritedProp["OriginalName"].ShouldBe("PaPa");
            dicWithInheritedProp["Name"].ShouldBe("Foo");
            dicWithInheritedProp["Age"].ShouldBe(10);

            dicWithInheritedProp.GetDynamicMemberNames().ShouldBe(new[] { "Name", "Age", "OriginalName" });

            var dicWithDeclaredProp = model.ToDynamic(false);

            dicWithDeclaredProp.ShouldNotBeNull();
            dicWithDeclaredProp.Count.ShouldBe(2);
            dicWithDeclaredProp["OriginalName"].ShouldBeNull();
            dicWithDeclaredProp["Name"].ShouldBe("Foo");
            dicWithDeclaredProp["Age"].ShouldBe(10);

            dicWithDeclaredProp.GetDynamicMemberNames().ShouldBe(new[] { "Name", "Age" });
        }
        public void When_testing_as_concrete_type()
        {
            DynamicDictionary dic = new DynamicDictionary();

            dic.Count.ShouldBe(0);

            dic["A"] = "A";
            dic["B"] = "B";
            dic["C"] = "C";
            dic["D"] = 1;

            dic.Count.ShouldBe(4);
            dic["A"].ShouldBe("A");
            dic["a"].ShouldBe("A");
            dic["B"].ShouldBe("B");
            dic["b"].ShouldBe("B");
            dic["C"].ShouldBe("C");
            dic["c"].ShouldBe("C");
            dic["D"].ShouldBe(1);
            dic["d"].ShouldBe(1);

            dic.Keys.ShouldBe(new[] { "A", "B", "C", "D" });
            dic.GetDynamicMemberNames().ShouldBe(new[] { "A", "B", "C", "D" });

            dic.Values.ShouldBe(new object[] { "A", "B", "C", 1 });

            dic["non-existent"].ShouldBeNull();
        }