Adding validation of timespan columns w/in 24hrs (#275)

Very small feature add to make sure that values entered for `TIME` columns are < 24hrs. If the value is >=24hrs when setting the column, an exception will be thrown that the edit/updateCell handler will catch and convert into an error on the JSON RPC side.

* Adding validation of timespan columns

* Fixing a merge conflict
This commit is contained in:
Benjamin Russell
2017-03-10 13:46:13 -08:00
committed by GitHub
parent 125fe8b0e7
commit 471e64fb1c
7 changed files with 730 additions and 979 deletions

View File

@@ -166,6 +166,17 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
Assert.Throws<ArgumentOutOfRangeException>(() => new CellUpdate(col, "12345"));
}
[Theory]
[InlineData("24:00:00")]
[InlineData("105:00:00")]
public void TimeSpanTooLargeTest(string value)
{
// If: I create a cell update for a timespan column and provide a value that is over 24hrs
// Then: It should throw an exception
DbColumnWrapper col = GetWrapper<TimeSpan>("time");
Assert.Throws<InvalidOperationException>(() => new CellUpdate(col, value));
}
[Theory]
[MemberData(nameof(RoundTripTestParams))]
public void RoundTripTest(DbColumnWrapper col, object obj)