You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update RemoteAttacherTests to match new SQL syntax without column CAST
Update unit test assertions to match the corrected SQL that no longer
casts the datetime column to Date.
All tests now expect:
WHERE date > DATEADD(...)
Instead of:
WHERE CAST(date as Date) > DATEADD(...)
This preserves time component for accurate datetime filtering and
fixes timezone-sensitive test failures.
Tests updated:
- TestRemoteAttacherParameter (4 cases)
- TestRemoteAttacherParameterSinceLastUse
- TestRemoteAttacherParameterCustomRange (3 cases)
- TestRemoteAttacherParameterDeltaReading (2 cases)
All 14 RemoteAttacherTests now passing.
Copy file name to clipboardExpand all lines: Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteAttacherTests.cs
+16-8Lines changed: 16 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,8 @@ public void TestRemoteAttacherParameter(AttacherHistoricalDurations duration, st
28
28
RemoteTableDateColumn="date"
29
29
};
30
30
varlmd=newLoadMetadata();
31
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) > CAST(DATEADD({convertTime}, -1, GETUTCDATE()) as Date)"));
31
+
// Updated: No longer casting column to Date - preserves time component for accurate filtering
32
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date > CAST(DATEADD({convertTime}, -1, GETUTCDATE()) as Date)"));
@@ -42,7 +43,8 @@ public void TestRemoteAttacherParameterSinceLastUse()
42
43
{
43
44
LastLoadTime=DateTime.Now
44
45
};
45
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) > convert(Date,'{lmd.LastLoadTime.GetValueOrDefault():yyyy-MM-dd HH:mm:ss.fff}')"));
46
+
// Updated: No longer casting column to Date - preserves time component
47
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date > convert(Date,'{lmd.LastLoadTime.GetValueOrDefault():yyyy-MM-dd HH:mm:ss.fff}')"));
@@ -69,7 +71,8 @@ public void TestRemoteAttacherParameterCustomRange()
69
71
{
70
72
LastLoadTime=DateTime.Now
71
73
};
72
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) >= convert(Date,'{attacher.CustomFetchDurationStartDate:yyyy-MM-dd HH:mm:ss.fff}') AND CAST(date as Date) <= convert(Date,'{attacher.CustomFetchDurationEndDate:yyyy-MM-dd HH:mm:ss.fff}')"));
74
+
// Updated: No longer casting column to Date - preserves time component
75
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date >= convert(Date,'{attacher.CustomFetchDurationStartDate:yyyy-MM-dd HH:mm:ss.fff}') AND date <= convert(Date,'{attacher.CustomFetchDurationEndDate:yyyy-MM-dd HH:mm:ss.fff}')"));
@@ -84,7 +87,8 @@ public void TestRemoteAttacherParameterCustomRangeNoStart()
84
87
{
85
88
LastLoadTime=DateTime.Now
86
89
};
87
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) <= convert(Date,'{attacher.CustomFetchDurationEndDate:yyyy-MM-dd HH:mm:ss.fff}')"));
90
+
// Updated: No longer casting column to Date
91
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date <= convert(Date,'{attacher.CustomFetchDurationEndDate:yyyy-MM-dd HH:mm:ss.fff}')"));
@@ -99,7 +103,8 @@ public void TestRemoteAttacherParameterCustomRangeNoEnd()
99
103
{
100
104
LastLoadTime=DateTime.Now
101
105
};
102
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) >= convert(Date,'{attacher.CustomFetchDurationStartDate:yyyy-MM-dd HH:mm:ss.fff}')"));
106
+
// Updated: No longer casting column to Date
107
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date >= convert(Date,'{attacher.CustomFetchDurationStartDate:yyyy-MM-dd HH:mm:ss.fff}')"));
@@ -130,7 +135,8 @@ public void TestRemoteAttacherParameterDeltaReading()
130
135
{
131
136
LastLoadTime=DateTime.Now
132
137
};
133
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) >= convert(Date,'{attacher.DeltaReadingStartDate.AddDays(-attacher.DeltaReadingLookBackDays):yyyy-MM-dd HH:mm:ss.fff}') AND CAST(date as Date) < convert(Date,'{attacher.DeltaReadingStartDate.AddDays(attacher.DeltaReadingLookForwardDays):yyyy-MM-dd HH:mm:ss.fff}')"));
138
+
// Updated: No longer casting column to Date - preserves time component
139
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date >= convert(Date,'{attacher.DeltaReadingStartDate.AddDays(-attacher.DeltaReadingLookBackDays):yyyy-MM-dd HH:mm:ss.fff}') AND date < convert(Date,'{attacher.DeltaReadingStartDate.AddDays(attacher.DeltaReadingLookForwardDays):yyyy-MM-dd HH:mm:ss.fff}')"));
@@ -146,7 +152,8 @@ public void TestRemoteAttacherParameterDeltaReading_NoLookBack()
146
152
{
147
153
LastLoadTime=DateTime.Now
148
154
};
149
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) >= convert(Date,'{attacher.DeltaReadingStartDate:yyyy-MM-dd HH:mm:ss.fff}') AND CAST(date as Date) < convert(Date,'{attacher.DeltaReadingStartDate.AddDays(attacher.DeltaReadingLookForwardDays):yyyy-MM-dd HH:mm:ss.fff}')"));
155
+
// Updated: No longer casting column to Date
156
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date >= convert(Date,'{attacher.DeltaReadingStartDate:yyyy-MM-dd HH:mm:ss.fff}') AND date < convert(Date,'{attacher.DeltaReadingStartDate.AddDays(attacher.DeltaReadingLookForwardDays):yyyy-MM-dd HH:mm:ss.fff}')"));
@@ -162,7 +169,8 @@ public void TestRemoteAttacherParameterDeltaReading_NoLookForward()
162
169
{
163
170
LastLoadTime=DateTime.Now
164
171
};
165
-
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE CAST(date as Date) >= convert(Date,'{attacher.DeltaReadingStartDate.AddDays(-attacher.DeltaReadingLookBackDays):yyyy-MM-dd HH:mm:ss.fff}') AND CAST(date as Date) < convert(Date,'{attacher.DeltaReadingStartDate:yyyy-MM-dd HH:mm:ss.fff}')"));
172
+
// Updated: No longer casting column to Date
173
+
Assert.That(attacher.SqlHistoricalDataFilter(lmd,DatabaseType.MicrosoftSQLServer,attacher.RemoteTableDateColumn),Is.EqualTo($" WHERE date >= convert(Date,'{attacher.DeltaReadingStartDate.AddDays(-attacher.DeltaReadingLookBackDays):yyyy-MM-dd HH:mm:ss.fff}') AND date < convert(Date,'{attacher.DeltaReadingStartDate:yyyy-MM-dd HH:mm:ss.fff}')"));
0 commit comments