Example #1
0
        public void WithColumnIndex_ValidColumnIndex_Success(int columnIndex)
        {
            OneToOneMap <string> propertyMap = Map(t => t.Value);

            Assert.Same(propertyMap, propertyMap.WithColumnIndex(columnIndex));

            ColumnIndexValueReader reader = Assert.IsType <ColumnIndexValueReader>(propertyMap.CellReader);

            Assert.Equal(columnIndex, reader.ColumnIndex);
        }
Example #2
0
        public void WithColumnIndex_OptionalColumn_Success()
        {
            OneToOneMap <string> propertyMap = Map(t => t.Value).MakeOptional();

            Assert.True(propertyMap.Optional);
            Assert.Same(propertyMap, propertyMap.WithColumnIndex(1));
            Assert.True(propertyMap.Optional);

            ColumnIndexValueReader innerReader = Assert.IsType <ColumnIndexValueReader>(propertyMap.CellReader);

            Assert.Equal(1, innerReader.ColumnIndex);
        }
Example #3
0
        public void WithColumnIndex_NegativeColumnIndex_ThrowsArgumentOutOfRangeException()
        {
            OneToOneMap <string> propertyMap = Map(t => t.Value);

            Assert.Throws <ArgumentOutOfRangeException>("columnIndex", () => propertyMap.WithColumnIndex(-1));
        }