示例#1
0
        public void GetByOrdinal()
        {
            var header = new RowHeader
            {
                HasRows = true,
                Names   = new List <string> {
                    "cola", "colb"
                },
                Types = new List <int> {
                    (int)FieldType.Object, (int)FieldType.String
                }
            };

            var f = ValidField;
            var r = new RowInformation(header);

            r.Add(new ColumnInformation(f, 0, "cola", false));
            r.Add(new ColumnInformation(ValidField, 1, "colb", false));

            var c = r.Get(0);

            Assert.AreEqual(c.Ordinal, 0);
            Assert.AreEqual(c.Name, "cola");
            Assert.AreEqual(f.Name, c.Field.Name);
            Assert.AreEqual(f.Type, c.Field.Type);
        }
示例#2
0
        public void CheckNullValue()
        {
            var header = new RowHeader
            {
                HasRows = true,
                Names   = new List <string> {
                    "cola", "colb"
                },
                Types = new List <int> {
                    (int)FieldType.Object, (int)FieldType.String
                }
            };

            var f = ValidField;
            var r = new RowInformation(header);

            r.Add(new ColumnInformation(f, 0, "cola", true));
            r.Add(new ColumnInformation(ValidField, 1, "colb", false));

            Assert.IsTrue(r.Get(0).IsNull);
            Assert.IsFalse(r.Get(1).IsNull);
        }
示例#3
0
        public void GetByNameCaseInsensitive()
        {
            var header = new RowHeader
            {
                HasRows = true,
                Names   = new List <string> {
                    "cola", "colb", "colc"
                },
                Types = new List <int> {
                    (int)FieldType.Object, (int)FieldType.String, (int)FieldType.Double
                }
            };

            var f = ValidField;
            var r = new RowInformation(header);

            r.Add(new ColumnInformation(f, 0, "cola", false));
            r.Add(new ColumnInformation(ValidField, 1, "colb", false));

            Assert.IsNotNull(r.Get("cola"));
            Assert.IsNotNull(r.Get("COLA"));
            Assert.IsNotNull(r.Get("ColA"));
        }
示例#4
0
        public void TryingToGetByOrdinalThatDoesNotExist()
        {
            var header = new RowHeader
            {
                HasRows = true,
                Names   = new List <string> {
                    "cola", "colb"
                },
                Types = new List <int> {
                    (int)FieldType.Object, (int)FieldType.String
                }
            };

            var r = new RowInformation(header);

            r.Add(new ColumnInformation(ValidField, 0, "cola", false));
            r.Add(new ColumnInformation(ValidField, 1, "colb", false));

            Assert.Throws <IndexOutOfRangeException>(() => r.Get(2));
        }