public void TestEquals()
        {
            CcTD ccTd = new CcTD
            {
                AreaId = "BN",
                Description = "2R94",
                Time = DateTime.UtcNow,
                To = "COUT",
                Type = "CC"
            };

            TDElement nonMatchingElement = new TDElement
            {
                TD = "BN",
                FROMBERTH = "123",
                TOBERTH = "COUT"
            };

            TDElement matchingElement = new TDElement
            {
                TD = "BN",
                FROMBERTH = string.Empty,
                TOBERTH = "COUT"
            };

            Assert.IsFalse(nonMatchingElement.Equals(ccTd));
            Assert.IsTrue(matchingElement.Equals(ccTd));
        }
        /// <summary>
        /// Update a train movement
        /// </summary>
        /// <param name="trainId">id of live train</param>
        /// <param name="tiplocIds">reporting tiploc(s)</param>
        /// <param name="eventType">arrival or departure to update</param>
        /// <param name="actualTime">actual time to set</param>
        /// <param name="source">source of data</param>
        /// <returns>true if a row updated</returns>
        public bool UpdateMovement(Guid trainId, TDElement td, IEnumerable<short> tiplocIds, TrainMovementEventType eventType, DateTime actualTime, LiveTrainStopSource source = LiveTrainStopSource.TD)
        {
            const string sql = @"
                UPDATE [dbo].[LiveTrainStop]
                SET  [ActualTimestamp] = @actualTime
                    ,[Platform] = @platform
                    ,[LiveTrainStopSourceId] = @source
                WHERE   [TrainId] = @trainId
                    AND [ReportingTiplocId] IN @tiplocIds
                    AND [EventTypeId] = @eventType
                    AND [LiveTrainStopSourceId] != @source
                    AND [ActualTimeStamp] >= @timeBefore
                    AND [ActualTimeStamp] <= @timeAfter";

            return ExecuteNonQuery(sql, new
            {
                trainId,
                platform = td.PLATFORM,
                tiplocIds,
                eventType,
                actualTime,
                source,
                timeBefore = actualTime.AddMinutes(-145),
                timeAfter = actualTime.AddMinutes(30)
            }) > 0;
        }