Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public void FactMethodName()
        {
            dynamic d = new SqlFuDynamic(new KeyValuePair <string, object> [0]);

            Assert.Throws <InvalidOperationException>(() => { d.La = "23"; });
        }