public void When_testing_as_dynamic_type() { dynamic dic = new DynamicDictionary(); ((int)dic.Count).ShouldBe(0); dic["A"] = "A"; dic["B"] = "B"; dic["C"] = "C"; dic["D"] = 1; #pragma warning disable IDE0039 // Use local function Func <int> someFunc = () => 1234; #pragma warning restore IDE0039 // Use local function dic.action = someFunc; ((int)dic.Count).ShouldBe(5); ((string)dic["A"]).ShouldBe("A"); ((string)dic["a"]).ShouldBe("A"); ((string)dic["B"]).ShouldBe("B"); ((string)dic["b"]).ShouldBe("B"); ((string)dic["C"]).ShouldBe("C"); ((string)dic["c"]).ShouldBe("C"); ((int)dic["D"]).ShouldBe(1); ((int)dic["d"]).ShouldBe(1); ((int)dic.action()).ShouldBe(1234); ((int)dic.ACTION()).ShouldBe(1234); ((string)dic.A).ShouldBe("A"); ((string)dic.a).ShouldBe("A"); ((int)dic.D).ShouldBe(1); ((int)dic.d).ShouldBe(1); ((ICollection <string>)dic.Keys).ShouldBe(new[] { "A", "B", "C", "D", "action" }); ((ICollection <object>)dic.Values).ShouldBe(new object[] { "A", "B", "C", 1, someFunc }); ((string)dic["non-existent"]).ShouldBeNull(); dic.foo = "foo"; ((string)dic["foo"]).ShouldBe("foo"); ((string)dic["Foo"]).ShouldBe("foo"); }