Skip to content

Commit

Permalink
Added tests to check nullable properties are being evaluated correctly..
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Atkinson committed Apr 26, 2017
1 parent fee2f0f commit bae780b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/DatabaseSchema.Tests/OleDb/OleDbTableColumnExtractorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,45 @@ public void Extract_ShouldReturn_CollectionOf_DbColumn()
}
}

[Test]
public void Extract_WithNullableValuesSet_ShouldReturn_CollectionOf_DbColumn()
{
var columns = new[]
{
new OleDbColumn
{
Name = "Price",
DataType = DbType.Decimal,
OleDbType = OleDbType.Decimal,
IsNullable = false,
Position = 1,
MaxLength = 10,
NumericPrecision = 1,
NumericScale = 2
}
};
var schema = TableColumnSchemaHelper.Build(columns);

_connection
.Setup(x => x.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, null, "test_1" }))
.Returns(schema);

var results = _extractor.Extract("test_1").ToArray();

Assert.AreEqual(1, results.Length);

for (var i = 0; i < columns.Length; i++)
{
Assert.AreEqual(columns[i].Name, results[i].Name);
Assert.AreEqual(columns[i].DataType, results[i].DataType);
Assert.AreEqual(columns[i].IsNullable, results[i].IsNullable);
Assert.AreEqual(columns[i].Position, results[i].Position);
Assert.AreEqual(columns[i].MaxLength, results[i].MaxLength);
Assert.AreEqual(columns[i].NumericPrecision, results[i].NumericPrecision);
Assert.AreEqual(columns[i].NumericScale, results[i].NumericScale);
}
}

[Test]
public void Extract_WithRealConnection_ShouldReturn_CollectionOf_DbColumn()
{
Expand Down

0 comments on commit bae780b

Please sign in to comment.