mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user