public void sqlfu_dynamic_can_be_cast_to_read_only_IDictionary() { var data=new SqlFuDynamic(new [] {"Id","Name"}); Array.Copy(new object[] {1,"Test"},data.ColumnValues,2); dynamic dyn = data; var dict = (IDictionary<string, object>) dyn; dict["Id"].Should().Be(1); dict["Name"].Should().Be("Test"); dict.IsReadOnly.Should().BeTrue(); dict.Count.Should().Be(2); dict.First().Key.Should().Be("Id"); dict.First().Value.Should().Be(1); }
public void sqlfu_dynamic_can_be_cast_to_read_only_IDictionary() { var data = new SqlFuDynamic(new [] { "Id", "Name" }); Array.Copy(new object[] { 1, "Test" }, data.ColumnValues, 2); dynamic dyn = data; var dict = (IDictionary <string, object>)dyn; dict["Id"].Should().Be(1); dict["Name"].Should().Be("Test"); dict.IsReadOnly.Should().BeTrue(); dict.Count.Should().Be(2); dict.First().Key.Should().Be("Id"); dict.First().Value.Should().Be(1); }
public void FactMethodName() { dynamic d = new SqlFuDynamic(new KeyValuePair <string, object> [0]); Assert.Throws <InvalidOperationException>(() => { d.La = "23"; }); }