@@ -26,6 +26,10 @@ public class AisManagerTest : IDisposable
2626 public AisManagerTest ( )
2727 {
2828 _manager = new AisManager ( "Test" , true , 269110660u , "Cirrus" ) ;
29+
30+ // Our test data isn't _that_ old.
31+ // We need to disable this test when replaying data with their original time stamps
32+ _manager . PositionProvider . Cache . MaxDataAge = TimeSpan . FromDays ( 10000 ) ;
2933 }
3034
3135 public void Dispose ( )
@@ -158,9 +162,9 @@ public void CheckSafety1()
158162 }
159163
160164 [ Theory ]
161- [ InlineData ( 600 , 1852 , 20 ) ] // Default settings
165+ [ InlineData ( 600 , 1852 , 18 ) ] // Default settings
162166 [ InlineData ( 600 , 0 , 0 ) ] // Warning distance zero -> No warnings
163- [ InlineData ( 10 , 1852 , 39 ) ] // Very short warning timeout -> Many warnings
167+ [ InlineData ( 10 , 1852 , 34 ) ] // Very short warning timeout -> Many warnings
164168 public void CheckSafetyPermanently ( int warningRepeatSeconds , int warningDistance , int expectedWarningCount )
165169 {
166170 // This does a safety check all the time. Very expensive...
@@ -185,7 +189,8 @@ public void CheckSafetyPermanently(int warningRepeatSeconds, int warningDistance
185189 reader . OnNewSequence += ( source , msg ) =>
186190 {
187191 _manager . SendSentence ( source , msg ) ;
188- if ( msg . SentenceId == new SentenceId ( "VDM" ) )
192+ // Do the test when we find VDM sequences, but ignore anything until we have a valid time sync for the data
193+ if ( msg . SentenceId == new SentenceId ( "VDM" ) && msg . DateTime . Year > 1970 )
189194 {
190195 // This is a big number that misses some dangerous encounters, but causes the test to end in reasonable time (10s instead of 22s)
191196 if ( ( msgCount ++ % 60 ) == 0 )
@@ -212,7 +217,7 @@ public void CheckSafetyPermanently(int warningRepeatSeconds, int warningDistance
212217 Assert . False ( ship ! . IsEstimate ) ;
213218 Assert . NotNull ( ship . RelativePosition ) ;
214219 Assert . True ( ship . RelativePosition ! . From . Name == "Cirrus" ) ;
215- Assert . Equal ( 8260.2 , ship . RelativePosition . Distance . Meters , 1 ) ;
220+ Assert . Equal ( 8258.7 , ship . RelativePosition . Distance . Meters , 1 ) ;
216221 }
217222
218223 [ Fact ]
0 commit comments